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 #1239

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,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**: don't list Git status (always overrides --git)
- **--time-style**: how to format timestamps
- **--no-permissions**: suppress the permissions field
- **--octal-permissions**: list each file's permission in octal format
Expand Down
1 change: 1 addition & 0 deletions completions/fish/exa.fish
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,5 @@ complete -c exa -l 'no-time' -d "Suppress the time field"

# Optional extras
complete -c exa -l 'git' -d "List each file's Git status, if tracked"
complete -c exa -l 'no-git' -d "Don't list Git status"
complete -c exa -s '@' -l 'extended' -d "List each file's extended attributes and sizes"
1 change: 1 addition & 0 deletions completions/zsh/_exa
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ __exa() {
{-u,--accessed}"[Use the accessed timestamp field]" \
{-U,--created}"[Use the created timestamp field]" \
--git"[List each file's Git status, if tracked]" \
--no-git"[Don't list Git status]" \
{-@,--extended}"[List each file's extended attributes and sizes]" \
'*:filename:_files'
}
Expand Down
3 changes: 3 additions & 0 deletions man/exa.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,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` [if exa was built with git support]
: Don't list Git status. (Always overrides --git)


ENVIRONMENT VARIABLES
=====================
Expand Down
3 changes: 2 additions & 1 deletion src/options/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,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 EXTENDED: Arg = Arg { short: Some(b'@'), long: "extended", takes_value: TakesValue::Forbidden };
pub static OCTAL: Arg = Arg { short: None, long: "octal-permissions", takes_value: TakesValue::Forbidden };

Expand All @@ -80,5 +81,5 @@ pub static ALL_ARGS: Args = Args(&[
&BLOCKS, &TIME, &ACCESSED, &CREATED, &TIME_STYLE,
&NO_PERMISSIONS, &NO_FILESIZE, &NO_USER, &NO_TIME, &NO_ICONS,

&GIT, &EXTENDED, &OCTAL
&GIT, &NO_GIT, &EXTENDED, &OCTAL
]);
8 changes: 5 additions & 3 deletions src/options/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ LONG VIEW OPTIONS
--no-user suppress the user field
--no-time suppress the time field";

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";
static EXTENDED_HELP: &str = " -@, --extended list each file's extended attributes and sizes";
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";
static NO_GIT_VIEW_HELP: &str = " --no-git don't list Git status (always overrides --git)";
static EXTENDED_HELP: &str = " -@, --extended list each file's extended attributes and sizes";


/// All the information needed to display the help text, which depends
Expand Down Expand Up @@ -106,6 +107,7 @@ impl fmt::Display for HelpString {

if cfg!(feature = "git") {
write!(f, "\n{}", GIT_VIEW_HELP)?;
write!(f, "\n{}", NO_GIT_VIEW_HELP)?;
}

if xattr::ENABLED {
Expand Down
6 changes: 3 additions & 3 deletions src/options/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ impl TableOptions {
impl Columns {
fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
let time_types = TimeTypes::deduce(matches)?;
let git = matches.has(&flags::GIT)?;
let git = matches.has(&flags::GIT)? && !matches.has(&flags::NO_GIT)?;

let blocks = matches.has(&flags::BLOCKS)?;
let group = matches.has(&flags::GROUP)?;
Expand Down Expand Up @@ -357,8 +357,8 @@ mod test {

static TEST_ARGS: &[&Arg] = &[ &flags::BINARY, &flags::BYTES, &flags::TIME_STYLE,
&flags::TIME, &flags::MODIFIED, &flags::CHANGED,
&flags::CREATED, &flags::ACCESSED,
&flags::HEADER, &flags::GROUP, &flags::INODE, &flags::GIT,
&flags::CREATED, &flags::ACCESSED, &flags::HEADER,
&flags::GROUP, &flags::INODE, &flags::GIT, &flags::NO_GIT,
&flags::LINKS, &flags::BLOCKS, &flags::LONG, &flags::LEVEL,
&flags::GRID, &flags::ACROSS, &flags::ONE_LINE, &flags::TREE,
&flags::NUMERIC ];
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 don't list Git status (always overrides --git)
-@, --extended list each file's extended attributes and sizes