Merge pull request #2905 from MichaelEischer/fix-ls-help

ls: Explicitly enforce that the user specifies a snapshot ID
This commit is contained in:
rawtaz 2020-09-05 10:44:01 +02:00 committed by GitHub
commit d3a286928a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -16,7 +16,7 @@ import (
)
var cmdLs = &cobra.Command{
Use: "ls [flags] [snapshotID] [dir...]",
Use: "ls [flags] snapshotID [dir...]",
Short: "List files in a snapshot",
Long: `
The "ls" command lists files and directories in a snapshot.
@ -89,8 +89,8 @@ type lsNode struct {
}
func runLs(opts LsOptions, gopts GlobalOptions, args []string) error {
if len(args) == 0 && len(opts.Hosts) == 0 && len(opts.Tags) == 0 && len(opts.Paths) == 0 {
return errors.Fatal("Invalid arguments, either give one or more snapshot IDs or set filters.")
if len(args) == 0 {
return errors.Fatal("no snapshot ID specified")
}
// extract any specific directories to walk