From 7bdd23bd328b1e3666622e7bb94ea55629145953 Mon Sep 17 00:00:00 2001 From: Alex Hamilton <1622250+Aehmlo@users.noreply.github.com> Date: Sat, 26 Aug 2023 19:44:27 -0400 Subject: [PATCH 1/6] feat: `--no-git` option This option overrides --git in all cases and disables showing the Git status of files in long view (--long/-l). --- README.md | 1 + completions/fish/eza.fish | 1 + completions/zsh/_eza | 1 + man/eza.1.md | 3 +++ src/options/flags.rs | 4 +++- src/options/help.rs | 1 + src/options/view.rs | 4 ++-- xtests/outputs/help.ansitxt | 1 + 8 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 054f75a2..e36cba55 100644 --- a/README.md +++ b/README.md @@ -179,6 +179,7 @@ These options are available when running with `--long` (`-l`): - **-@**, **--extended**: list each file’s extended attributes and sizes - **--changed**: use the changed timestamp field - **--git**: list each file’s Git status, if tracked or ignored +- **--no-git**: suppress Git status (always overrides `--git`) - **--time-style**: how to format timestamps - **--no-permissions**: suppress the permissions field - **-o**, **--octal-permissions**: list each file's permission in octal format diff --git a/completions/fish/eza.fish b/completions/fish/eza.fish index ecfd4701..7ae6880c 100755 --- a/completions/fish/eza.fish +++ b/completions/fish/eza.fish @@ -92,6 +92,7 @@ complete -c eza -l no-time -d "Suppress the time field" # Optional extras complete -c eza -l git -d "List each file's Git status, if tracked" +complete -c eza -l no-git -d "Suppress Git status" complete -c eza -l git-repos -d "List each git-repos status and branch name" complete -c eza -l git-repos-no-status -d "List each git-repos branch name (much faster)" complete -c eza -s '@' -l extended -d "List each file's extended attributes and sizes" diff --git a/completions/zsh/_eza b/completions/zsh/_eza index 6f633455..3724dbfb 100644 --- a/completions/zsh/_eza +++ b/completions/zsh/_eza @@ -55,6 +55,7 @@ __eza() { {-U,--created}"[Use the created timestamp field]" \ {-X,--dereference}"[dereference symlinks for file information]" \ --git"[List each file's Git status, if tracked]" \ + --no-git"[Suppress Git status]" \ --git-repos"[List each git-repos status and branch name]" \ --git-repos-no-status"[List each git-repos branch name (much faster)]" \ {-@,--extended}"[List each file's extended attributes and sizes]" \ diff --git a/man/eza.1.md b/man/eza.1.md index 974ce3f4..edba0b7b 100644 --- a/man/eza.1.md +++ b/man/eza.1.md @@ -199,6 +199,9 @@ This adds a two-character column indicating the staged and unstaged statuses res Directories will be shown to have the status of their contents, which is how ‘deleted’ is possible: if a directory contains a file that has a certain status, it will be shown to have that status. +`--no-git` +: Don't show Git status (always overrides `--git`) + ENVIRONMENT VARIABLES ===================== diff --git a/src/options/flags.rs b/src/options/flags.rs index be35b8fa..cbc672e2 100644 --- a/src/options/flags.rs +++ b/src/options/flags.rs @@ -67,6 +67,7 @@ pub static NO_ICONS: Arg = Arg { short: None, long: "no-icons", takes_value: Tak // optional feature options pub static GIT: Arg = Arg { short: None, long: "git", takes_value: TakesValue::Forbidden }; +pub static NO_GIT: Arg = Arg { short: None, long: "no-git", takes_value: TakesValue::Forbidden }; pub static GIT_REPOS: Arg = Arg { short: None, long: "git-repos", takes_value: TakesValue::Forbidden }; pub static GIT_REPOS_NO_STAT: Arg = Arg { short: None, long: "git-repos-no-status", takes_value: TakesValue::Forbidden }; pub static EXTENDED: Arg = Arg { short: Some(b'@'), long: "extended", takes_value: TakesValue::Forbidden }; @@ -87,5 +88,6 @@ pub static ALL_ARGS: Args = Args(&[ &BLOCKSIZE, &TIME, &ACCESSED, &CREATED, &TIME_STYLE, &HYPERLINK, &NO_PERMISSIONS, &NO_FILESIZE, &NO_USER, &NO_TIME, &NO_ICONS, - &GIT, &GIT_REPOS, &GIT_REPOS_NO_STAT, &EXTENDED, &OCTAL, &SECURITY_CONTEXT + &GIT, &NO_GIT, &GIT_REPOS, &GIT_REPOS_NO_STAT, + &EXTENDED, &OCTAL, &SECURITY_CONTEXT ]); diff --git a/src/options/help.rs b/src/options/help.rs index bc2409f3..b09fea9b 100644 --- a/src/options/help.rs +++ b/src/options/help.rs @@ -67,6 +67,7 @@ static GIT_FILTER_HELP: &str = " \ --git-ignore ignore files mentioned in '.gitignore'"; static GIT_VIEW_HELP: &str = " \ --git list each file's Git status, if tracked or ignored + --no-git suppress Git status (always overrides --git) --git-repos list root of git-tree status"; static EXTENDED_HELP: &str = " \ -@, --extended list each file's extended attributes and sizes"; diff --git a/src/options/view.rs b/src/options/view.rs index 0e1569b6..95d287ad 100644 --- a/src/options/view.rs +++ b/src/options/view.rs @@ -88,7 +88,7 @@ impl Mode { } } - if matches.has(&flags::GIT)? { + if matches.has(&flags::GIT)? && !matches.has(&flags::NO_GIT)? { return Err(OptionsError::Useless(&flags::GIT, false, &flags::LONG)); } else if matches.has(&flags::LEVEL)? && ! matches.has(&flags::RECURSE)? && ! matches.has(&flags::TREE)? { @@ -219,7 +219,7 @@ impl Columns { fn deduce(matches: &MatchedFlags<'_>) -> Result { let time_types = TimeTypes::deduce(matches)?; - let git = matches.has(&flags::GIT)?; + let git = matches.has(&flags::GIT)? && !matches.has(&flags::NO_GIT)?; let subdir_git_repos = matches.has(&flags::GIT_REPOS)?; let subdir_git_repos_no_stat = !subdir_git_repos && matches.has(&flags::GIT_REPOS_NO_STAT)?; diff --git a/xtests/outputs/help.ansitxt b/xtests/outputs/help.ansitxt index b5a4959f..3c20f8b9 100644 --- a/xtests/outputs/help.ansitxt +++ b/xtests/outputs/help.ansitxt @@ -53,4 +53,5 @@ LONG VIEW OPTIONS --no-user suppress the user field --no-time suppress the time field --git list each file's Git status, if tracked or ignored + --no-git suppress Git status (always overrides --git) -@, --extended list each file's extended attributes and sizes From 984ba42273448faf27aa8f3f9a2e15d5fe91fe44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Sun, 27 Aug 2023 19:05:38 +0200 Subject: [PATCH 2/6] fix(no-git): respect git-repos flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christina Sørensen --- src/options/view.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/options/view.rs b/src/options/view.rs index 95d287ad..eba0fb7b 100644 --- a/src/options/view.rs +++ b/src/options/view.rs @@ -220,8 +220,8 @@ impl Columns { let time_types = TimeTypes::deduce(matches)?; let git = matches.has(&flags::GIT)? && !matches.has(&flags::NO_GIT)?; - let subdir_git_repos = matches.has(&flags::GIT_REPOS)?; - let subdir_git_repos_no_stat = !subdir_git_repos && matches.has(&flags::GIT_REPOS_NO_STAT)?; + let subdir_git_repos = matches.has(&flags::GIT_REPOS)? && !matches.has(&flags::NO_GIT)?; + let subdir_git_repos_no_stat = !subdir_git_repos && matches.has(&flags::GIT_REPOS_NO_STAT)? && !matches.has(&flags::NO_GIT)?; let blocksize = matches.has(&flags::BLOCKSIZE)?; let group = matches.has(&flags::GROUP)?; From 32f0fab50635dda6336a1108f45ae6995caffe1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Mon, 28 Aug 2023 10:07:46 +0200 Subject: [PATCH 3/6] docs(no-git): add ignored flags to readme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christina Sørensen --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e36cba55..765ff552 100644 --- a/README.md +++ b/README.md @@ -179,7 +179,7 @@ These options are available when running with `--long` (`-l`): - **-@**, **--extended**: list each file’s extended attributes and sizes - **--changed**: use the changed timestamp field - **--git**: list each file’s Git status, if tracked or ignored -- **--no-git**: suppress Git status (always overrides `--git`) +- **--no-git**: suppress Git status (always overrides `--git`, `--git-repos`, `--git-repos-no-status`) - **--time-style**: how to format timestamps - **--no-permissions**: suppress the permissions field - **-o**, **--octal-permissions**: list each file's permission in octal format From 288447683d3c427e334abf88ce1cccf667a41a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Mon, 28 Aug 2023 10:09:00 +0200 Subject: [PATCH 4/6] docs(no-git): add ignored flags to manual MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christina Sørensen --- man/eza.1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/eza.1.md b/man/eza.1.md index edba0b7b..f67d3dd1 100644 --- a/man/eza.1.md +++ b/man/eza.1.md @@ -200,7 +200,7 @@ This adds a two-character column indicating the staged and unstaged statuses res Directories will be shown to have the status of their contents, which is how ‘deleted’ is possible: if a directory contains a file that has a certain status, it will be shown to have that status. `--no-git` -: Don't show Git status (always overrides `--git`) +: Don't show Git status (always overrides `--git`, `--git-repos`, `--git-repos-no-status`) ENVIRONMENT VARIABLES From 53c293d76206b11390c2ff9f39d5995bc5994fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Mon, 28 Aug 2023 10:11:10 +0200 Subject: [PATCH 5/6] docs(no-git): add ignored flags to help MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christina Sørensen --- src/options/help.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/options/help.rs b/src/options/help.rs index b09fea9b..f8380f25 100644 --- a/src/options/help.rs +++ b/src/options/help.rs @@ -67,7 +67,7 @@ static GIT_FILTER_HELP: &str = " \ --git-ignore ignore files mentioned in '.gitignore'"; static GIT_VIEW_HELP: &str = " \ --git list each file's Git status, if tracked or ignored - --no-git suppress Git status (always overrides --git) + --no-git suppress Git status (always overrides --git, --git-repos, --git-repos-no-status) --git-repos list root of git-tree status"; static EXTENDED_HELP: &str = " \ -@, --extended list each file's extended attributes and sizes"; From 9ecbfa0c8ef743b6b82fb443f1552749d890321a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Mon, 28 Aug 2023 10:11:51 +0200 Subject: [PATCH 6/6] docs(no-git): add ignored flags to xtest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christina Sørensen --- xtests/outputs/help.ansitxt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xtests/outputs/help.ansitxt b/xtests/outputs/help.ansitxt index 3c20f8b9..2d3835ec 100644 --- a/xtests/outputs/help.ansitxt +++ b/xtests/outputs/help.ansitxt @@ -53,5 +53,5 @@ LONG VIEW OPTIONS --no-user suppress the user field --no-time suppress the time field --git list each file's Git status, if tracked or ignored - --no-git suppress Git status (always overrides --git) + --no-git suppress Git status (always overrides --git, --git-repos, --git-repos-no-status) -@, --extended list each file's extended attributes and sizes