cmd/uplink/cmd: set exact argument counts

It was possible to call

   uplink cp a b c d e sj://bucket/something

Change-Id: I731da0da4530a3b3f8fbc569f363ba40cf84853a
This commit is contained in:
Egon Elbre 2020-02-07 14:09:12 +02:00
parent 6cd86b2145
commit d2fca76146
10 changed files with 10 additions and 1 deletions

View File

@ -37,7 +37,7 @@ func init() {
Use: "list",
Short: "Prints name and associated satellite of all available accesses.",
RunE: accessList,
Args: cobra.MaximumNArgs(0),
Args: cobra.NoArgs,
}
RootCmd.AddCommand(accessCmd)

View File

@ -17,6 +17,7 @@ func init() {
Use: "cat sj://BUCKET/KEY",
Short: "Copies a Storj object to standard out",
RunE: catMain,
Args: cobra.ExactArgs(1),
}, RootCmd)
}

View File

@ -33,6 +33,7 @@ func init() {
Use: "cp SOURCE DESTINATION",
Short: "Copies a local file or Storj object to another location locally or in Storj",
RunE: copyMain,
Args: cobra.ExactArgs(2),
}, RootCmd)
progress = cpCmd.Flags().Bool("progress", true, "if true, show progress")

View File

@ -26,6 +26,7 @@ func init() {
Use: "ls [sj://BUCKET[/PREFIX]]",
Short: "List objects and prefixes or all buckets",
RunE: list,
Args: cobra.MaximumNArgs(1),
}, RootCmd)
lsRecursiveFlag = lsCmd.Flags().Bool("recursive", false, "if true, list recursively")
lsEncryptedFlag = lsCmd.Flags().Bool("encrypted", false, "if true, show paths as base64-encoded encrypted paths")

View File

@ -21,6 +21,7 @@ func init() {
Use: "mb sj://BUCKET",
Short: "Create a new bucket",
RunE: makeBucket,
Args: cobra.ExactArgs(1),
}, RootCmd)
}

View File

@ -19,6 +19,7 @@ func init() {
Use: "get [KEY] PATH",
Short: "Get a Storj object's metadata",
RunE: metaGetMain,
Args: cobra.RangeArgs(1, 2),
}, metaCmd)
}

View File

@ -17,6 +17,7 @@ func init() {
Use: "put sj://BUCKET/KEY",
Short: "Copies data from standard in to a Storj object",
RunE: putMain,
Args: cobra.ExactArgs(1),
}, RootCmd)
}

View File

@ -18,6 +18,7 @@ func init() {
Use: "rb sj://BUCKET",
Short: "Remove an empty bucket",
RunE: deleteBucket,
Args: cobra.ExactArgs(1),
}, RootCmd)
}

View File

@ -23,6 +23,7 @@ func init() {
Use: "rm sj://BUCKET/KEY",
Short: "Delete an object",
RunE: deleteObject,
Args: cobra.ExactArgs(1),
}, RootCmd)
rmEncryptedFlag = rmCmd.Flags().Bool("encrypted", false, "if true, treat paths as base64-encoded encrypted paths")
setBasicFlags(rmCmd.Flags(), "encrypted")

View File

@ -25,6 +25,7 @@ var (
Short: "Create an uplink config file",
RunE: cmdSetup,
Annotations: map[string]string{"type": "setup"},
Args: cobra.NoArgs,
}
setupCfg UplinkFlags
)