Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --no-git option #168

Merged
merged 6 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Aehmlo marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions completions/fish/eza.fish
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions completions/zsh/_eza
Original file line number Diff line number Diff line change
Expand Up @@ -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]" \
Expand Down
3 changes: 3 additions & 0 deletions man/eza.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
=====================
Expand Down
4 changes: 3 additions & 1 deletion src/options/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand All @@ -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
]);
1 change: 1 addition & 0 deletions src/options/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
8 changes: 4 additions & 4 deletions src/options/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)? {
Expand Down Expand Up @@ -219,9 +219,9 @@ impl Columns {
fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
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)?;
Expand Down
1 change: 1 addition & 0 deletions xtests/outputs/help.ansitxt
Original file line number Diff line number Diff line change
Expand Up @@ -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