diff --git a/README.md b/README.md index 054f75a28..765ff5524 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`, `--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 diff --git a/completions/fish/eza.fish b/completions/fish/eza.fish index ecfd47011..7ae6880ca 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 6f6334551..3724dbfbc 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 974ce3f40..f67d3dd16 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`, `--git-repos`, `--git-repos-no-status`) + ENVIRONMENT VARIABLES ===================== diff --git a/src/options/flags.rs b/src/options/flags.rs index be35b8faa..cbc672e2e 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 bc2409f3b..f8380f256 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, --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"; diff --git a/src/options/view.rs b/src/options/view.rs index 0e1569b61..eba0fb7b5 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,9 +219,9 @@ impl Columns { fn deduce(matches: &MatchedFlags<'_>) -> Result { let time_types = TimeTypes::deduce(matches)?; - let git = matches.has(&flags::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 git = matches.has(&flags::GIT)? && !matches.has(&flags::NO_GIT)?; + 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)?; diff --git a/xtests/outputs/help.ansitxt b/xtests/outputs/help.ansitxt index b5a4959f5..2d3835ec7 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, --git-repos, --git-repos-no-status) -@, --extended list each file's extended attributes and sizes