Make args a bit more sane
parent
b27376a8b9
commit
e781ce149f
32
main.go
32
main.go
|
|
@ -39,13 +39,16 @@ func main() {
|
||||||
|
|
||||||
func config() lastn.Config {
|
func config() lastn.Config {
|
||||||
as := args.NewArgSet()
|
as := args.NewArgSet()
|
||||||
as.Append(args.INT, "n", "number of backups to retain", 5)
|
|
||||||
as.Append(args.STRING, "conf", "path to rclone conf", path.Join(os.Getenv("HOME"), "/.config/rclone/rclone.conf"))
|
|
||||||
as.Append(args.STRING, "root", "path to root", "./public")
|
|
||||||
as.Append(args.STRING, "ns", "ns for backups", path.Join("lastn", "dev"))
|
|
||||||
as.Append(args.STRING, "rclone", "rclone backend name", "blapointe-drive-enc")
|
|
||||||
as.Append(args.STRING, "store", "type of store, like [map rclone]", "map")
|
|
||||||
as.Append(args.STRING, "cmd", "[backup, restore, list, clean]", "backup")
|
as.Append(args.STRING, "cmd", "[backup, restore, list, clean]", "backup")
|
||||||
|
as.Append(args.INT, "n", "number of backups to retain", 5)
|
||||||
|
as.Append(args.STRING, "root", "path to root", "./public")
|
||||||
|
as.Append(args.STRING, "store", "type of store, like [map rclone]", "map")
|
||||||
|
as.Append(args.STRING, "storeaddr", "addr of store", "")
|
||||||
|
as.Append(args.STRING, "storeuser", "user of store", "")
|
||||||
|
as.Append(args.STRING, "storepass", "pass of store", "")
|
||||||
|
as.Append(args.STRING, "ns", "ns for backups", path.Join("lastn", "dev"))
|
||||||
|
as.Append(args.STRING, "rclone-conf", "path to rclone conf", path.Join(os.Getenv("HOME"), "/.config/rclone/rclone.conf"))
|
||||||
|
as.Append(args.STRING, "rclone-alias", "rclone backend name", "blapointe-drive-enc")
|
||||||
if err := as.Parse(); err != nil {
|
if err := as.Parse(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
@ -54,12 +57,15 @@ func config() lastn.Config {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
return lastn.Config{
|
return lastn.Config{
|
||||||
N: as.Get("n").GetInt(),
|
N: as.Get("n").GetInt(),
|
||||||
Conf: as.Get("conf").GetString(),
|
RcloneConf: as.Get("rclone-conf").GetString(),
|
||||||
Rclone: as.Get("rclone").GetString(),
|
RcloneAlias: as.Get("rclone-alias").GetString(),
|
||||||
Root: root,
|
Root: root,
|
||||||
Ns: as.Get("ns").GetString(),
|
Ns: as.Get("ns").GetString(),
|
||||||
Store: as.Get("store").GetString(),
|
Store: as.Get("store").GetString(),
|
||||||
Cmd: as.Get("cmd").GetString(),
|
StoreAddr: as.Get("storeaddr").GetString(),
|
||||||
|
StoreUser: as.Get("storeuser").GetString(),
|
||||||
|
StorePass: as.Get("storepass").GetString(),
|
||||||
|
Cmd: as.Get("cmd").GetString(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue