From 37ee30ec035b7cebda6e83d31e4592cda474965e Mon Sep 17 00:00:00 2001 From: milarin Date: Tue, 7 Mar 2023 00:26:35 +0100 Subject: [PATCH] added flag to set resursive depth for console output --- .gitignore | 24 +----------------------- commands.go | 2 +- main.go | 8 ++++---- 3 files changed, 6 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index b0ee365..2861426 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,2 @@ -# ---> Go -# If you prefer the allow list template instead of the deny list, see community template: -# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore -# -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Dependency directories (remove the comment below to include it) -# vendor/ - -# Go workspace file -go.work - diskspace +output \ No newline at end of file diff --git a/commands.go b/commands.go index 7190cce..1f5de58 100644 --- a/commands.go +++ b/commands.go @@ -32,7 +32,7 @@ func ls(args []string) { for _, entry := range entries { fmt.Println() - fmt.Println(entry.StringRecursive(1)) + fmt.Println(entry.StringRecursive(*RecursiveDirDepth)) } } diff --git a/main.go b/main.go index 5e8a3fa..01e45b6 100644 --- a/main.go +++ b/main.go @@ -24,9 +24,9 @@ var ( ColorBlue = color.New(color.FgBlue) ColorGreen = color.New(color.FgGreen) - IconTheme = flag.String("i", "unicode", "icon theme (currently supported: default, unicode, nerd)") - - ShowVersion = flag.Bool("v", false, "show version and exit") + IconTheme = flag.String("i", "unicode", "icon theme (currently supported: default, unicode, nerd)") + ShowVersion = flag.Bool("v", false, "show version and exit") + RecursiveDirDepth = flag.Int("d", 1, "depth for recursively printing files of directories") ) // FIXME sometimes sorting not applied after removing items @@ -83,7 +83,7 @@ func main() { showCurrentDir := true for { if showCurrentDir { - fmt.Println(Current.StringRecursive(1)) + fmt.Println(Current.StringRecursive(*RecursiveDirDepth)) } fmt.Print("> ")