[#160] Update object CLI flags
* remove no-leaf * rename leaf to phy * remove no-root Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
32219bb294
commit
e580f2afd6
1 changed files with 5 additions and 19 deletions
|
@ -117,9 +117,7 @@ func init() {
|
||||||
_ = objectSearchCmd.MarkFlagRequired("cid")
|
_ = objectSearchCmd.MarkFlagRequired("cid")
|
||||||
objectSearchCmd.Flags().String("filters", "", "Filters in the form hdrName=value,...")
|
objectSearchCmd.Flags().String("filters", "", "Filters in the form hdrName=value,...")
|
||||||
objectSearchCmd.Flags().Bool("root", false, "Search for user objects")
|
objectSearchCmd.Flags().Bool("root", false, "Search for user objects")
|
||||||
objectSearchCmd.Flags().Bool("no-root", false, "Search for service objects")
|
objectSearchCmd.Flags().Bool("phy", false, "Search physically stored objects")
|
||||||
objectSearchCmd.Flags().Bool("leaf", false, "Search physically stored objects")
|
|
||||||
objectSearchCmd.Flags().Bool("no-leaf", false, "Search for virtual objects")
|
|
||||||
|
|
||||||
objectCmd.AddCommand(objectHeadCmd)
|
objectCmd.AddCommand(objectHeadCmd)
|
||||||
objectHeadCmd.Flags().String("file", "", "File to write header to. Default: stdout.")
|
objectHeadCmd.Flags().String("file", "", "File to write header to. Default: stdout.")
|
||||||
|
@ -449,25 +447,13 @@ func parseSearchFilters(cmd *cobra.Command) (object.SearchFilters, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
root, _ := cmd.Flags().GetBool("root")
|
root, _ := cmd.Flags().GetBool("root")
|
||||||
noroot, _ := cmd.Flags().GetBool("no-root")
|
if root {
|
||||||
switch {
|
|
||||||
case root && noroot:
|
|
||||||
return nil, errors.New("'--root' and '--no-root' flags can't be set together")
|
|
||||||
case root:
|
|
||||||
fs.AddRootFilter()
|
fs.AddRootFilter()
|
||||||
case noroot:
|
|
||||||
fs.AddNonRootFilter()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
leaf, _ := cmd.Flags().GetBool("leaf")
|
phy, _ := cmd.Flags().GetBool("phy")
|
||||||
noleaf, _ := cmd.Flags().GetBool("no-leaf")
|
if phy {
|
||||||
switch {
|
fs.AddPhyFilter()
|
||||||
case leaf && noleaf:
|
|
||||||
return nil, errors.New("'--leaf' and '--no-leaf' flags can't be set together")
|
|
||||||
case leaf:
|
|
||||||
fs.AddLeafFilter()
|
|
||||||
case noleaf:
|
|
||||||
fs.AddNonLeafFilter()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return fs, nil
|
return fs, nil
|
||||||
|
|
Loading…
Reference in a new issue