feat: added the "bb ls -R" flag.
This commit is contained in:
parent
702e8e05af
commit
d286351445
1 changed files with 9 additions and 2 deletions
|
@ -126,17 +126,24 @@ ls(p string, fold int) error {
|
||||||
|
|
||||||
func Run(flagSet *mtool.Flags) {
|
func Run(flagSet *mtool.Flags) {
|
||||||
var foldLvl int
|
var foldLvl int
|
||||||
flagSet.IntVar(&foldLvl, "r", 1, "List recursively with choosing deepness, can't be negative or zero.")
|
var rFlag bool
|
||||||
flagSet.BoolVar(&listHidden, "a", false, "List hidden files.")
|
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()
|
flagSet.Parse()
|
||||||
args = flagSet.Args()
|
args = flagSet.Args()
|
||||||
|
|
||||||
|
if rFlag {
|
||||||
|
foldLvl = 9999999
|
||||||
|
}
|
||||||
if foldLvl<0 {
|
if foldLvl<0 {
|
||||||
flagSet.Usage()
|
flagSet.Usage()
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if foldLvl==0 && len(args)==0 {
|
if foldLvl==0 && len(args)==0 {
|
||||||
flagSet.Usage()
|
flagSet.Usage()
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
|
|
Loading…
Reference in a new issue