1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-08-03 13:42:06 -07:00
Files
.cargo
.github
benchsuite
ci
crates
cli
core
flags
complete
bash.rs
encodings.sh
fish.rs
mod.rs
powershell.rs
rg.zsh
zsh.rs
doc
config.rs
defs.rs
hiargs.rs
lowargs.rs
mod.rs
parse.rs
README.md
haystack.rs
logger.rs
main.rs
messages.rs
search.rs
globset
grep
ignore
matcher
pcre2
printer
regex
searcher
pkg
scripts
tests
.gitignore
.ignore
CHANGELOG.md
COPYING
Cargo.lock
Cargo.toml
FAQ.md
GUIDE.md
LICENSE-MIT
README.md
RELEASE-CHECKLIST.md
UNLICENSE
build.rs
rustfmt.toml
ripgrep/crates/core/flags/complete
Jan Verbeek e0a85678e1 complete/fish: improve shell completions for fish
- Stop using `-n __fish_use_subcommand`. This had the effect of
ignoring options if a positional argument has already been given, but
that's not how ripgrep works.

- Only suggest negation options if the option they're negating is
passed (e.g., only complete `--no-pcre2` if `--pcre2` is present). The
zsh completions already do this.

- Take into account whether an option takes an argument. If an option
is not a switch then it won't suggest further options until the
argument is given, e.g. `-C<tab>` won't suggest options but `-i<tab>`
will.

- Suggest correct arguments for options. We already completed a fixed
set of choices where available, but now we go further:

  - Filenames are only suggested for options that take filenames.

  - `--pre` and `--hostname-bin` suggest binaries from `$PATH`.

  - `-t`/`--type`/&c use `--type-list` for suggestions, like in zsh,
  with a preview of the glob patterns.

  - `--encoding` uses a hardcoded list extracted from the zsh
  completions. This has been refactored into a separate file, and the
  range globs (`{1..5}`) replaced by comma globs (`{1,2,3,4,5}`) since
  those work in both shells. I verified that this produces the same
  list as before in zsh, and the same list in fish (albeit in a
  different order).

PR 
2024-01-06 10:39:35 -05:00
..