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

View file

@ -16,7 +16,7 @@ import (
) )
var cmdLs = &cobra.Command{ var cmdLs = &cobra.Command{
Use: "ls [flags] [snapshotID] [dir...]", Use: "ls [flags] snapshotID [dir...]",
Short: "List files in a snapshot", Short: "List files in a snapshot",
Long: ` Long: `
The "ls" command lists files and directories in a snapshot. 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 { 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 { if len(args) == 0 {
return errors.Fatal("Invalid arguments, either give one or more snapshot IDs or set filters.") return errors.Fatal("no snapshot ID specified")
} }
// extract any specific directories to walk // extract any specific directories to walk