From d28635144598de06794fae7ced846b7315e527a8 Mon Sep 17 00:00:00 2001 From: surdeus Date: Wed, 24 Jan 2024 20:34:01 +0300 Subject: [PATCH] feat: added the "bb ls -R" flag. --- tool/ls/ls.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tool/ls/ls.go b/tool/ls/ls.go index 132d3a9..943e83a 100644 --- a/tool/ls/ls.go +++ b/tool/ls/ls.go @@ -126,17 +126,24 @@ ls(p string, fold int) error { func Run(flagSet *mtool.Flags) { var foldLvl int - flagSet.IntVar(&foldLvl, "r", 1, "List recursively with choosing deepness, can't be negative or zero.") - flagSet.BoolVar(&listHidden, "a", false, "List hidden files.") + var rFlag bool + flagSet.BoolVar(&rFlag, "R", false, "set the '-r' flags value to the max depth (overrides the '-r')") + flagSet.IntVar(&foldLvl, "r", 1, "list recursively with choosing deepness, can't be negative or zero.") + flagSet.BoolVar(&listHidden, "a", false, "list hidden files.") flagSet.Parse() args = flagSet.Args() + if rFlag { + foldLvl = 9999999 + } if foldLvl<0 { flagSet.Usage() + os.Exit(1) } if foldLvl==0 && len(args)==0 { flagSet.Usage() + os.Exit(1) } if len(args) == 0 {