diff --git a/config.go b/config.go index 64fd558..e25b1b9 100644 --- a/config.go +++ b/config.go @@ -32,7 +32,7 @@ type pathConfig struct { // optPathConfig is like pathConfig, but the Path is optional. // If Path is empty, it looks for a single account to match. type optPathConfig struct { - Path string `arg:"" optional:"" help:"file on local filesystem. Empty matches all files,xor=opath"` + Path string `arg:"" optional:"" help:"file on local filesystem. Empty matches all files"` account remoteFile string accounts []account diff --git a/list.go b/list.go index ace9ade..68ee577 100644 --- a/list.go +++ b/list.go @@ -1,6 +1,7 @@ package main import ( + "errors" "fmt" "net/url" "os" @@ -12,13 +13,20 @@ import ( type list struct { optPathConfig - Recursive bool `kong:"short=r,help='recursively descend into folders',xor=opath"` + Recursive bool `kong:"short=r,help='recursively descend into folders'"` } func isSubfile(dir, f string) bool { return dir == "/" || dir == f || strings.HasPrefix(f, dir+"/") } +func (l *list) AfterApply() error { + if l.Path == "" && l.Recursive { + return errors.New("omitted path matches all shares, --recursive (-r) is unnecessary") + } + return nil +} + func (l *list) Run() error { accounts := l.accounts if l.remoteFile != "" {