diff --git a/cmd/tree-main.go b/cmd/tree-main.go index db2b9953..14cc3a9a 100644 --- a/cmd/tree-main.go +++ b/cmd/tree-main.go @@ -94,12 +94,12 @@ EXAMPLES: 3. List all buckets in "mybucket" on Amazon S3 cloud storage hosted on Microsoft Windows in a tree format. $ {{.HelpName}} s3\mybucket\ - + 4. List all buckets and objects in "mybucket" on Amazon S3 cloud storage in a tree format. - $ {{.HelpName}} -f myminio/mybucket/ - + $ {{.HelpName}} --files myminio/mybucket/ + 5. Set the depth of the tree for listing. - $ {{.HelpName}} -d 2 myminio/mybucket/ + $ {{.HelpName}} --depth 2 myminio/mybucket/ 6. List all the directories irrespective to the depth. $ {{.HelpName}} myminio/mybucket/ @@ -110,16 +110,11 @@ EXAMPLES: func checkTreeSyntax(ctx *cli.Context) { args := ctx.Args() - var depth = -1 if ctx.IsSet("depth") { - depth = ctx.Int("depth") - if depth == -1 { - depth = 0 + if ctx.Int("depth") <= 0 { + fatalIf(errInvalidArgument().Trace(args...), "depth should have a value greater than 0") } } - if depth != -1 && depth <= 0 { - fatalIf(errInvalidArgument().Trace(args...), "depth should have a value greater than 0") - } if (args.Present()) && len(args) == 0 { return