mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-12 20:21:15 -03:00
Compare commits
205 Commits
curly-unde
...
faster-git
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
00e987df15 | ||
|
|
a6ee9be72a | ||
|
|
ad28e17b50 | ||
|
|
a7d9f2293e | ||
|
|
df92c93332 | ||
|
|
aebae23533 | ||
|
|
69b5ad110a | ||
|
|
17446ad20f | ||
|
|
8c5de9acfb | ||
|
|
7a79728df3 | ||
|
|
4cbd1b83f1 | ||
|
|
3ab6fcf21c | ||
|
|
08c8afcb12 | ||
|
|
3951a858dd | ||
|
|
c7a19a00ab | ||
|
|
e5fdd77b09 | ||
|
|
3fcdbe1a19 | ||
|
|
2071df126c | ||
|
|
4b5650ee4f | ||
|
|
5657f093e7 | ||
|
|
a7c04890c9 | ||
|
|
52f23b9752 | ||
|
|
6737872fb7 | ||
|
|
f88f7e8dd6 | ||
|
|
b3dbdb90c2 | ||
|
|
dc129add9e | ||
|
|
19c3bebdd9 | ||
|
|
093b468ac1 | ||
|
|
88bbf5f3ac | ||
|
|
ec8fa7485c | ||
|
|
c2e2237e7c | ||
|
|
98df97d317 | ||
|
|
7ca57894cc | ||
|
|
c7391d1026 | ||
|
|
1963b0830d | ||
|
|
74ce965f32 | ||
|
|
27420aaf8b | ||
|
|
52cdb7fd62 | ||
|
|
18c4debbc0 | ||
|
|
8617964d4d | ||
|
|
0d99859add | ||
|
|
0b8e0b8835 | ||
|
|
3867163193 | ||
|
|
4d84e68dd4 | ||
|
|
285a810814 | ||
|
|
541a069a91 | ||
|
|
e8864ef441 | ||
|
|
2f708a7c0b | ||
|
|
b7a73710e2 | ||
|
|
7a54ed66fb | ||
|
|
99f4c09ed3 | ||
|
|
e26b585ce5 | ||
|
|
7c2c7f5874 | ||
|
|
7b3a2900e9 | ||
|
|
7a79366f91 | ||
|
|
223b98f2ff | ||
|
|
01560bf195 | ||
|
|
7fe34ea401 | ||
|
|
36f035b52c | ||
|
|
0e8edab872 | ||
|
|
448d630d0c | ||
|
|
38fb2cfd6d | ||
|
|
d68f8bdd3b | ||
|
|
80bafd5a22 | ||
|
|
ae8c5eaab7 | ||
|
|
329d190fbf | ||
|
|
e5fa047412 | ||
|
|
cb31887941 | ||
|
|
04fd697ac9 | ||
|
|
2558d13361 | ||
|
|
02ccf25443 | ||
|
|
a88acb9715 | ||
|
|
8d3ad0c3c3 | ||
|
|
660f52ee4f | ||
|
|
594b8730d8 | ||
|
|
107e4d11de | ||
|
|
50500ec5b9 | ||
|
|
3ccce609f0 | ||
|
|
bd26d4b61b | ||
|
|
7f4998ad9b | ||
|
|
122f39de66 | ||
|
|
1df8fbff67 | ||
|
|
ff5ff50183 | ||
|
|
c0d93e4740 | ||
|
|
55752729d6 | ||
|
|
41dfb5147f | ||
|
|
156fa8081c | ||
|
|
3081d0157b | ||
|
|
13e4736113 | ||
|
|
80e30ac756 | ||
|
|
a86a4dfabf | ||
|
|
22bc8e12c9 | ||
|
|
6c23c6f29b | ||
|
|
39fd959eea | ||
|
|
cc2ca60baa | ||
|
|
83f74f9332 | ||
|
|
58af4fa34c | ||
|
|
f23501dbdc | ||
|
|
035cd369c2 | ||
|
|
3bef4863cf | ||
|
|
2d58cfe4cb | ||
|
|
df591a2e0f | ||
|
|
ecefce2ea8 | ||
|
|
786239d280 | ||
|
|
7a668fb17e | ||
|
|
bf2f7ee6c0 | ||
|
|
2f762e2da1 | ||
|
|
11d8b83838 | ||
|
|
c2eaef7273 | ||
|
|
2f278f4bfa | ||
|
|
1e61e6492d | ||
|
|
c993fd022c | ||
|
|
fe10f65587 | ||
|
|
b98c5ee897 | ||
|
|
9ccff5ad5d | ||
|
|
55f70cbb6d | ||
|
|
b7005e8378 | ||
|
|
1f79d48a48 | ||
|
|
e9036774cb | ||
|
|
2cd185a4f1 | ||
|
|
bb92d82c3b | ||
|
|
f9ba834788 | ||
|
|
d23b8af60d | ||
|
|
82eacb6d50 | ||
|
|
c62b09d5d1 | ||
|
|
ccfe949514 | ||
|
|
ccc75d08f3 | ||
|
|
dfac66082a | ||
|
|
9ae01ae00d | ||
|
|
51784b090d | ||
|
|
8115982485 | ||
|
|
d88a656e9e | ||
|
|
d6ee4ec698 | ||
|
|
dbae271fe7 | ||
|
|
a4ec30f298 | ||
|
|
ee9cf33689 | ||
|
|
11b6bf31c0 | ||
|
|
4f0e11383e | ||
|
|
bf78309f79 | ||
|
|
01bd854f25 | ||
|
|
0348389195 | ||
|
|
e05ecd6c7d | ||
|
|
325232bec1 | ||
|
|
b78d168050 | ||
|
|
31edcf029b | ||
|
|
27dc4b3c8a | ||
|
|
77a4f38a13 | ||
|
|
e9d396615b | ||
|
|
79ec558d08 | ||
|
|
719a5d2909 | ||
|
|
93962c82df | ||
|
|
111922b60f | ||
|
|
cb92a5530f | ||
|
|
dd4c04e2ff | ||
|
|
6fec5ab320 | ||
|
|
ada9aff63e | ||
|
|
1d63c1f188 | ||
|
|
a12298152f | ||
|
|
83b10c3919 | ||
|
|
4a3fc5211f | ||
|
|
9f80e1f225 | ||
|
|
9a8d578142 | ||
|
|
09eae92888 | ||
|
|
af6c3eb69f | ||
|
|
dd5864ce13 | ||
|
|
d31dc9ffd8 | ||
|
|
d5e80d43d9 | ||
|
|
0d59e89374 | ||
|
|
8b1f72c54b | ||
|
|
54a5ade57d | ||
|
|
7c25d6a1ba | ||
|
|
a5a5dc46e4 | ||
|
|
1687b3fe7a | ||
|
|
f3ddf793a3 | ||
|
|
647ae7da8c | ||
|
|
0950cd1598 | ||
|
|
a1b1bff97b | ||
|
|
a95be351fb | ||
|
|
91b9bbf651 | ||
|
|
c14e8c1939 | ||
|
|
7e4c3b9fa7 | ||
|
|
8048e38ea4 | ||
|
|
8a5a547d88 | ||
|
|
48704dc612 | ||
|
|
8abab0e2cc | ||
|
|
bd178c8ba8 | ||
|
|
cb719cd418 | ||
|
|
1ff8f983c4 | ||
|
|
e3517f69b3 | ||
|
|
f7bde1354d | ||
|
|
1d69226c58 | ||
|
|
d5e71bc46e | ||
|
|
0d5ab2514c | ||
|
|
bf0a30b9a8 | ||
|
|
b54042e512 | ||
|
|
b7b1753716 | ||
|
|
c0f5fcb089 | ||
|
|
b9f2275349 | ||
|
|
0b97fa7114 | ||
|
|
1a2958d42b | ||
|
|
3e8308f6eb | ||
|
|
ff987f5f76 | ||
|
|
a6fdb41940 | ||
|
|
54971621de | ||
|
|
b6c5f3dc38 |
20
.github/workflows/main.yml
vendored
20
.github/workflows/main.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
- uses: dtolnay/rust-toolchain@1.70
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo apt install gettext libpcre2-dev python3-pexpect tmux
|
||||
sudo apt install gettext libpcre2-dev python3-pexpect python3-sphinx tmux
|
||||
# Generate a locale that uses a comma as decimal separator.
|
||||
sudo locale-gen fr_FR.UTF-8
|
||||
- name: cmake
|
||||
@@ -32,6 +32,17 @@ jobs:
|
||||
- name: make fish_run_tests
|
||||
run: |
|
||||
make -C build VERBOSE=1 fish_run_tests
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- name: translation updates
|
||||
run: |
|
||||
# Required for our custom xgettext implementation.
|
||||
cargo install --locked --version 1.0.106 cargo-expand
|
||||
# Generate PO files. This should not result it a change in the repo if all translations are
|
||||
# up to date.
|
||||
# Ensure that fish is available as an executable.
|
||||
PATH="$PWD/build:$PATH" build_tools/update_translations.fish --no-mo
|
||||
# Show diff output. Fail if there is any.
|
||||
git --no-pager diff --exit-code || { echo 'There are uncommitted changes after regenerating the gettext PO files. Make sure to update them via `build_tools/update_translations.fish --no-mo` after changing source files.'; exit 1; }
|
||||
|
||||
ubuntu-32bit-static-pcre2:
|
||||
|
||||
@@ -82,13 +93,14 @@ jobs:
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo apt install gettext libpcre2-dev python3-pexpect tmux
|
||||
sudo apt install llvm # for llvm-symbolizer
|
||||
- name: cmake
|
||||
env:
|
||||
CC: clang
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
# Rust's ASAN requires the build system to explicitly pass a --target triple. We read that
|
||||
# value from CMake variable Rust_CARGO_TARGET (shared with corrosion).
|
||||
# value from CMake variable Rust_CARGO_TARGET.
|
||||
cmake .. -DASAN=1 -DRust_CARGO_TARGET=x86_64-unknown-linux-gnu -DCMAKE_BUILD_TYPE=Debug
|
||||
- name: make
|
||||
run: |
|
||||
@@ -104,8 +116,8 @@ jobs:
|
||||
# UPDATE: this can cause spurious leak reports for __cxa_thread_atexit_impl() under glibc.
|
||||
LSAN_OPTIONS: verbosity=0:log_threads=0:use_tls=1:print_suppressions=0
|
||||
run: |
|
||||
llvm_version=$(clang --version | awk 'NR==1 { split($NF, version, "."); print version[1] }')
|
||||
export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer-$llvm_version
|
||||
set -x
|
||||
export ASAN_SYMBOLIZER_PATH=$(command -v /usr/bin/llvm-symbolizer* | sort -n | head -1)
|
||||
export LSAN_OPTIONS="$LSAN_OPTIONS:suppressions=$PWD/build_tools/lsan_suppressions.txt"
|
||||
make -C build VERBOSE=1 fish_run_tests
|
||||
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -38,7 +38,8 @@ Desktop.ini
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
messages.pot
|
||||
po/template.po
|
||||
*.mo
|
||||
.directory
|
||||
.fuse_hidden*
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
fish 4.1.0 (released ???)
|
||||
=========================
|
||||
|
||||
.. ignore for 4.1: 10929 10940 10948 10955 10965 10975 10989 10990 10998 11028 11052 11055 11069 11071 11079 11092 11098 11104 11106 11110 11140 11146 11148 11150 11214 11218 11259 11288 11299 11328 11350 11373 11395 11417 11419
|
||||
|
||||
Notable improvements and fixes
|
||||
------------------------------
|
||||
- Compound commands (``begin; echo 1; echo 2; end``) can now be now be abbreviated using braces (``{ echo1; echo 2 }``), like in other shells.
|
||||
@@ -19,7 +21,7 @@ Notable improvements and fixes
|
||||
|
||||
Deprecations and removed features
|
||||
---------------------------------
|
||||
- Tokens like ``{ echo, echo }`` in command position are no longer interpreted as brace expansion but as compound command.
|
||||
- Tokens like ``{echo,echo}`` or ``{ echo, echo }`` in command position are no longer interpreted as brace expansion but as compound command.
|
||||
- Terminfo-style key names (``bind -k``) are no longer supported. They had been superseded by the native notation since 4.0,
|
||||
and currently they would map back to information from terminfo, which does not match what terminals would send with the kitty keyboard protocol (:issue:`11342`).
|
||||
- fish no longer reads the terminfo database, so its behavior is no longer affected by the :envvar:`TERM` environment variable (:issue:`11344`).
|
||||
@@ -64,17 +66,14 @@ New or improved bindings
|
||||
|
||||
Completions
|
||||
^^^^^^^^^^^
|
||||
- ``git`` completions now show the remote url as a description when completing remotes.
|
||||
- ``systemctl`` completions no longer print escape codes if ``SYSTEMD_COLORS`` is set (:issue:`11465`).
|
||||
|
||||
Improved terminal support
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
- Support for curly underlines in `fish_color_*` variables and :doc:`set_color <cmds/set_color>` (:issue:`10957`).
|
||||
- Support for double, curly, dotted and dashed underlines in `fish_color_*` variables and :doc:`set_color <cmds/set_color>` (:issue:`10957`).
|
||||
- Underlines can now be colored independent of text (:issue:`7619`).
|
||||
- Errors are now highlighted with curly underlines in the default themes.
|
||||
For compatibility with terminals that interpret the curly-underline escape sequence in an unexpected way,
|
||||
the default themes enable this only if the terminal advertises support for the ``Su`` capability via XTGETTCAP.
|
||||
- New documentation page `Terminal Compatibility <terminal-compatibility.html>`_ (also accessible via ``man fish-terminal-compatibility``) lists required and optional terminal control sequences used by fish.
|
||||
- :doc:`status <cmds/status>` learned the ``xtgettcap`` subcommand, to query terminfo capabilities via XTGETTCAP commands.
|
||||
- :doc:`status <cmds/status>` learned the ``xtversion`` subcommand, to show the terminal's name and version (as reported by via the XTVERSION command).
|
||||
|
||||
Other improvements
|
||||
------------------
|
||||
|
||||
@@ -286,37 +286,68 @@ Contributing Translations
|
||||
Fish uses the GNU gettext library to translate messages from English to
|
||||
other languages.
|
||||
|
||||
Creating and updating translations requires the Gettext tools, including
|
||||
``xgettext``, ``msgfmt`` and ``msgmerge``. Translation sources are
|
||||
Translation sources are
|
||||
stored in the ``po`` directory, named ``LANG.po``, where ``LANG`` is the
|
||||
two letter ISO 639-1 language code of the target language (eg ``de`` for
|
||||
German).
|
||||
two letter ISO 639-1 language code of the target language (e.g. ``de`` for
|
||||
German). A region specifier can also be used (e.g. ``pt_BR`` for Brazilian Portuguese).
|
||||
|
||||
To create a new translation:
|
||||
Adding translations for a new language
|
||||
--------------------------------------
|
||||
|
||||
* generate a ``messages.pot`` file by running ``build_tools/fish_xgettext.fish`` from
|
||||
the source tree
|
||||
* copy ``messages.pot`` to ``po/LANG.po``
|
||||
Creating new translations requires the Gettext tools.
|
||||
More specifically, you will need ``msguniq`` and ``msgmerge`` for creating translations for a new
|
||||
language.
|
||||
In addition, the ``cargo-expand`` tool is required.
|
||||
If you have ``cargo`` installed, run::
|
||||
|
||||
To update a translation:
|
||||
cargo install --locked --version 1.0.106 cargo-expand
|
||||
|
||||
* generate a ``messages.pot`` file by running
|
||||
``build_tools/fish_xgettext.fish`` from the source tree
|
||||
to install ``cargo-expand`` (Note that other versions might not work correctly with our scripts).
|
||||
To create a new translation, run::
|
||||
|
||||
* update the existing translation by running
|
||||
``msgmerge --update --no-fuzzy-matching po/LANG.po messages.pot``
|
||||
build_tools/update_translations.fish po/LANG.po
|
||||
|
||||
The ``--no-fuzzy-matching`` is important as we have had terrible experiences with gettext's "fuzzy" translations in the past.
|
||||
By default, this also creates ``mo`` files, which contain the information from the ``po`` files in a
|
||||
binary format.
|
||||
Fish uses these files for translating at runtime.
|
||||
They are not tracked in version control, but they can help translators check if their translations
|
||||
show up correctly.
|
||||
If you build fish locally (``cargo build``), and then run the resulting binary,
|
||||
it will make use of the ``mo`` files generated by the script.
|
||||
Use the ``LANG`` environment variable to tell fish which language to use, e.g.::
|
||||
|
||||
LANG=pt_BR.utf8 target/debug/fish
|
||||
|
||||
If you do not care about the ``mo`` files you can pass the ``--no-mo`` flag to the
|
||||
``update_translations.fish`` script.
|
||||
|
||||
Modifying existing translations
|
||||
-------------------------------
|
||||
|
||||
If you want to work on translations for a language which already has a corresponding ``po`` file, it
|
||||
is sufficient to edit this file. No other changes are necessary.
|
||||
|
||||
To see your translations in action you can run::
|
||||
|
||||
build_tools/update_translations.fish --only-mo po/LANG.po
|
||||
|
||||
to update the binary ``mo`` used by fish. Check the information for adding new languages for a
|
||||
description on how you can get fish to use these files.
|
||||
Running this script requires a fish executable and the gettext ``msgfmt`` tool.
|
||||
|
||||
Editing PO files
|
||||
----------------
|
||||
|
||||
Many tools are available for editing translation files, including
|
||||
command-line and graphical user interface programs. For simple use, you can just use your text editor.
|
||||
command-line and graphical user interface programs. For simple use, you can use your text editor.
|
||||
|
||||
Open up the po file, for example ``po/sv.po``, and you'll see something like::
|
||||
|
||||
msgid "%ls: No suitable job\n"
|
||||
msgstr ""
|
||||
msgstr ""
|
||||
|
||||
The ``msgid`` here is the "name" of the string to translate, typically the english string to translate. The second line (``msgstr``) is where your translation goes.
|
||||
The ``msgid`` here is the "name" of the string to translate, typically the English string to translate.
|
||||
The second line (``msgstr``) is where your translation goes.
|
||||
|
||||
For example::
|
||||
|
||||
@@ -329,11 +360,17 @@ Also any escaped characters, like that ``\n`` newline at the end, should be kept
|
||||
|
||||
Our tests run ``msgfmt --check-format /path/to/file``, so they would catch mismatched placeholders - otherwise fish would crash at runtime when the string is about to be used.
|
||||
|
||||
Be cautious about blindly updating an existing translation file. Trivial
|
||||
changes to an existing message (eg changing the punctuation) will cause
|
||||
existing translations to be removed, since the tools do literal string
|
||||
matching. Therefore, in general, you need to carefully review any
|
||||
recommended deletions.
|
||||
Be cautious about blindly updating an existing translation file.
|
||||
``msgid`` strings should never be updated manually, only by running the appropriate script.
|
||||
|
||||
Modifications to strings in source files
|
||||
----------------------------------------
|
||||
|
||||
If a string changes in the sources, the old translations will no longer work.
|
||||
They will be preserved in the ``po`` files, but commented-out (starting with ``#~``).
|
||||
If you add/remove/change a translatable strings in a source file,
|
||||
run ``build_tools/update_translations.fish`` to propagate this to all translation files (``po/*.po``).
|
||||
This is only relevant for developers modifying the source files of fish or fish scripts.
|
||||
|
||||
Setting Code Up For Translations
|
||||
--------------------------------
|
||||
|
||||
26
Cargo.lock
generated
26
Cargo.lock
generated
@@ -89,9 +89,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.10"
|
||||
version = "0.3.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
||||
checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys",
|
||||
@@ -126,6 +126,8 @@ name = "fish-printf"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
"widestring",
|
||||
]
|
||||
|
||||
@@ -173,9 +175,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.169"
|
||||
version = "0.2.172"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
|
||||
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
@@ -216,9 +218,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.29.0"
|
||||
version = "0.30.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
|
||||
checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
@@ -546,6 +548,18 @@ version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd"
|
||||
|
||||
[[package]]
|
||||
name = "unix_path"
|
||||
version = "1.0.1"
|
||||
|
||||
@@ -40,7 +40,7 @@ libc = "0.2"
|
||||
# disabling default features uses the stdlib instead, but it doubles the time to rewrite the history
|
||||
# files as of 22 April 2024.
|
||||
lru = "0.13.0"
|
||||
nix = { version = "0.29.0", default-features = false, features = [
|
||||
nix = { version = "0.30.1", default-features = false, features = [
|
||||
"event",
|
||||
"inotify",
|
||||
"resource",
|
||||
@@ -99,7 +99,7 @@ embed-data = ["dep:rust-embed"]
|
||||
asan = []
|
||||
tsan = []
|
||||
|
||||
[lints]
|
||||
[workspace.lints]
|
||||
rust.non_camel_case_types = "allow"
|
||||
rust.non_upper_case_globals = "allow"
|
||||
rust.unknown_lints = "allow"
|
||||
@@ -113,3 +113,6 @@ clippy.needless_lifetimes = "allow"
|
||||
# In the future, they might change to flag other methods of printing.
|
||||
clippy.print_stdout = "deny"
|
||||
clippy.print_stderr = "deny"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
35
SECURITY.md
Normal file
35
SECURITY.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Security Reporting
|
||||
|
||||
If you wish to report a security vulnerability privately, we appreciate your diligence. Please follow the guidelines below to submit your report.
|
||||
|
||||
## Reporting
|
||||
|
||||
To report a security vulnerability, please provide the following information:
|
||||
|
||||
1. **PROJECT**
|
||||
|
||||
- Include the URL of the project repository - Example: <https://github.com/fish-shell/fish-shell>
|
||||
|
||||
2. **PUBLIC**
|
||||
|
||||
- Indicate whether this vulnerability has already been publicly discussed or disclosed.
|
||||
- If so, provide relevant links.
|
||||
|
||||
3. **DESCRIPTION**
|
||||
- Provide a detailed description of the security vulnerability.
|
||||
- Include as much information as possible to help us understand and address the issue.
|
||||
|
||||
Send this information, along with any additional relevant details, to <rf@fishshell.com>.
|
||||
|
||||
## Confidentiality
|
||||
|
||||
We kindly ask you to keep the report confidential until a public announcement is made.
|
||||
|
||||
## Notes
|
||||
|
||||
- Vulnerabilities will be handled on a best-effort basis.
|
||||
- You may request an advance copy of the patched release, but we cannot guarantee early access before the public release.
|
||||
- You will be notified via email simultaneously with the public announcement.
|
||||
- We will respond within a few weeks to confirm whether your report has been accepted or rejected.
|
||||
|
||||
Thank you for helping to improve the security of our project!
|
||||
4
build.rs
4
build.rs
@@ -143,9 +143,9 @@ fn detect_apple(_: &Target) -> Result<bool, Box<dyn Error>> {
|
||||
Ok(cfg!(any(target_os = "ios", target_os = "macos")))
|
||||
}
|
||||
|
||||
#[allow(unexpected_cfgs)]
|
||||
fn detect_cygwin(_: &Target) -> Result<bool, Box<dyn Error>> {
|
||||
Ok(cfg!(target_os = "cygwin"))
|
||||
// Cygwin target is usually cross-compiled.
|
||||
Ok(std::env::var("CARGO_CFG_TARGET_OS").unwrap() == "cygwin")
|
||||
}
|
||||
|
||||
/// Detect if we're being compiled for a BSD-derived OS, allowing targeting code conditionally with
|
||||
|
||||
14
build_tools/diff_profiles.fish
Normal file → Executable file
14
build_tools/diff_profiles.fish
Normal file → Executable file
@@ -5,6 +5,12 @@
|
||||
#
|
||||
# Usage: ./diff_profiles.fish profile1.log profile2.log > profile_diff.log
|
||||
|
||||
if test (count $argv) -ne 2;
|
||||
echo "Incorrect number of arguments."
|
||||
echo "Usage: "(status filename)" profile1.log profile2.log"
|
||||
exit 1
|
||||
end
|
||||
|
||||
set -l profile1 (cat $argv[1])
|
||||
set -l profile2 (cat $argv[2])
|
||||
|
||||
@@ -15,13 +21,13 @@ while set -l next_line_no (math $line_no + 1) && set -q profile1[$next_line_no]
|
||||
set -l line1 $profile1[$line_no]
|
||||
set -l line2 $profile2[$line_no]
|
||||
|
||||
if not string match -qr '^\d+\t\d+' $line1
|
||||
if not string match -qr '^\s*\d+\s+\d+' $line1
|
||||
echo $line1
|
||||
continue
|
||||
end
|
||||
|
||||
set -l results1 (string match -r '^(\d+)\t(\d+)\s+(.*)' $line1)
|
||||
set -l results2 (string match -r '^(\d+)\t(\d+)\s+(.*)' $line2)
|
||||
set -l results1 (string match -r '^\s*(\d+)\s+(\d+)\s+(.*)' $line1)
|
||||
set -l results2 (string match -r '^\s*(\d+)\s+(\d+)\s+(.*)' $line2)
|
||||
|
||||
# times from both files
|
||||
set -l time1 $results1[2..3]
|
||||
@@ -42,5 +48,5 @@ while set -l next_line_no (math $line_no + 1) && set -q profile1[$next_line_no]
|
||||
set diff[1] (math $time1[1] - $time2[1])
|
||||
set diff[2] (math $time1[2] - $time2[2])
|
||||
|
||||
echo $diff[1] $diff[2] $remainder1
|
||||
printf '%10d %10d %s\n' $diff[1] $diff[2] $remainder1
|
||||
end
|
||||
|
||||
@@ -1,68 +1,101 @@
|
||||
#!/usr/bin/env fish
|
||||
#
|
||||
# Tool to generate messages.pot
|
||||
# Tool to generate gettext messages template file.
|
||||
# Writes to stdout.
|
||||
|
||||
# Create temporary directory for these operations. OS X `mktemp` is somewhat restricted, so this block
|
||||
# works around that - based on share/functions/funced.fish.
|
||||
set -q TMPDIR
|
||||
or set -l TMPDIR /tmp
|
||||
set -l tmpdir (mktemp -d $TMPDIR/fish.XXXXXX)
|
||||
or exit 1
|
||||
begin
|
||||
# Write header. This is required by msguniq.
|
||||
# Note that this results in the file being overwritten.
|
||||
# This is desired behavior, to get rid of the results of prior invocations
|
||||
# of this script.
|
||||
begin
|
||||
echo 'msgid ""'
|
||||
echo 'msgstr ""'
|
||||
echo '"Content-Type: text/plain; charset=UTF-8\n"'
|
||||
echo ""
|
||||
end
|
||||
|
||||
# This is a gigantic crime.
|
||||
# xgettext still does not support rust *at all*, so we use cargo-expand to get all our wgettext invocations.
|
||||
set -l expanded (cargo expand --lib; for f in fish{,_indent,_key_reader}; cargo expand --bin $f; end)
|
||||
set -l cargo_expanded_file (mktemp)
|
||||
# This is a gigantic crime.
|
||||
# We use cargo-expand to get all our wgettext invocations.
|
||||
# This might be replaced once we have a tool which properly handles macro expansions.
|
||||
begin
|
||||
cargo expand --lib
|
||||
for f in fish fish_indent fish_key_reader
|
||||
cargo expand --bin $f
|
||||
end
|
||||
end >$cargo_expanded_file
|
||||
|
||||
# Extract any gettext call
|
||||
set -l strs (printf '%s\n' $expanded | grep -A1 wgettext_static_str |
|
||||
grep 'widestring::internals::core::primitive::str =' |
|
||||
string match -rg '"(.*)"' | string match -rv '^%ls$|^$' |
|
||||
# escaping difference between gettext and cargo-expand: single-quotes
|
||||
string replace -a "\'" "'" | sort -u)
|
||||
set -l rust_string_file (mktemp)
|
||||
|
||||
# Extract any constants
|
||||
set -a strs (string match -rv 'BUILD_VERSION:|PACKAGE_NAME' -- $expanded |
|
||||
string match -rg 'const [A-Z_]*: &str = "(.*)"' | string replace -a "\'" "'")
|
||||
# Extract any gettext call
|
||||
grep -A1 wgettext_static_str <$cargo_expanded_file |
|
||||
grep 'widestring::internals::core::primitive::str =' |
|
||||
string match -rg '"(.*)"' |
|
||||
string match -rv '^%ls$|^$' |
|
||||
# escaping difference between gettext and cargo-expand: single-quotes
|
||||
string replace -a "\'" "'" >$rust_string_file
|
||||
|
||||
# We construct messages.pot ourselves instead of forcing this into msgmerge or whatever.
|
||||
# The escaping so far works out okay.
|
||||
for str in $strs
|
||||
# grep -P needed for string escape to be compatible (PCRE-style),
|
||||
# -H gives the filename, -n the line number.
|
||||
# If you want to run this on non-GNU grep: Don't.
|
||||
echo "#:" (grep -PHn -r -- (string escape --style=regex -- $str) src/ |
|
||||
head -n1 | string replace -r ':\s.*' '')
|
||||
echo "msgid \"$str\""
|
||||
echo 'msgstr ""'
|
||||
end >messages.pot
|
||||
# Extract any constants
|
||||
grep -Ev 'BUILD_VERSION:|PACKAGE_NAME' <$cargo_expanded_file |
|
||||
grep -E 'const [A-Z_]*: &str = "(.*)"' |
|
||||
sed -E -e 's/^.*const [A-Z_]*: &str = "(.*)".*$/\1/' -e "s_\\\'_'_g" >>$rust_string_file
|
||||
|
||||
# This regex handles descriptions for `complete` and `function` statements. These messages are not
|
||||
# particularly important to translate. Hence the "implicit" label.
|
||||
set -l implicit_regex '(?:^| +)(?:complete|function).*? (?:-d|--description) (([\'"]).+?(?<!\\\\)\\2).*'
|
||||
rm $cargo_expanded_file
|
||||
|
||||
# This regex handles explicit requests to translate a message. These are more important to translate
|
||||
# than messages which should be implicitly translated.
|
||||
set -l explicit_regex '.*\( *_ (([\'"]).+?(?<!\\\\)\\2) *\).*'
|
||||
# Sort the extracted strings and remove duplicates.
|
||||
# Then, transform them into the po format.
|
||||
# If a string contains a '%' it is considered a format string and marked with a '#, c-format'.
|
||||
# This allows msgfmt to identify issues with translations whose format string does not match the
|
||||
# original.
|
||||
sort -u $rust_string_file |
|
||||
sed -E -e '/%/ i\
|
||||
#, c-format
|
||||
' -e 's/^(.*)$/msgid "\1"\nmsgstr ""\n/'
|
||||
|
||||
mkdir -p $tmpdir/implicit/share/completions $tmpdir/implicit/share/functions
|
||||
mkdir -p $tmpdir/explicit/share/completions $tmpdir/explicit/share/functions
|
||||
rm $rust_string_file
|
||||
|
||||
for f in share/config.fish share/completions/*.fish share/functions/*.fish
|
||||
# Extract explicit attempts to translate a message. That is, those that are of the form
|
||||
# `(_ "message")`.
|
||||
string replace --filter --regex $explicit_regex '$1' <$f | string unescape \
|
||||
| string replace --all '"' '\\"' | string replace -r '(.*)' 'N_ "$1"' >$tmpdir/explicit/$f
|
||||
function extract_fish_script_messages --argument-names regex
|
||||
|
||||
# Handle `complete` / `function` description messages. The `| fish` is subtle. It basically
|
||||
# avoids the need to use `source` with a command substitution that could affect the current
|
||||
# shell.
|
||||
string replace --filter --regex $implicit_regex '$1' <$f | string unescape \
|
||||
| string replace --all '"' '\\"' | string replace -r '(.*)' 'N_ "$1"' >$tmpdir/implicit/$f
|
||||
end
|
||||
# Using xgettext causes more trouble than it helps.
|
||||
# This is due to handling of escaping in fish differing from formats xgettext understands
|
||||
# (e.g. POSIX shell strings).
|
||||
# We work around this issue by manually writing the file content.
|
||||
|
||||
xgettext -j -k -kN_ -LShell --from-code=UTF-8 -cDescription --no-wrap -o messages.pot $tmpdir/{ex,im}plicit/share/*/*.fish
|
||||
# Steps:
|
||||
# 1. We extract strings to be translated from the relevant files and drop the rest. This step
|
||||
# depends on the regex matching the entire line, and the first capture group matching the
|
||||
# string.
|
||||
# 2. We unescape. This gets rid of some escaping necessary in fish strings.
|
||||
# 3. The resulting strings are sorted alphabetically. This step is optional. Not sorting would
|
||||
# result in strings from the same file appearing together. Removing duplicates is also
|
||||
# optional, since msguniq takes care of that later on as well.
|
||||
# 4. Single backslashes are replaced by double backslashes. This results in the backslashes
|
||||
# being interpreted as literal backslashes by gettext tooling.
|
||||
# 5. Double quotes are escaped, such that they are not interpreted as the start or end of
|
||||
# a msgid.
|
||||
# 6. We transform the string into the format expected in a PO file.
|
||||
cat share/config.fish share/completions/*.fish share/functions/*.fish |
|
||||
string replace --filter --regex $regex '$1' |
|
||||
string unescape |
|
||||
sort -u |
|
||||
sed -E -e 's_\\\\_\\\\\\\\_g' -e 's_"_\\\\"_g' -e 's_^(.*)$_msgid "\1"\nmsgstr ""\n_'
|
||||
end
|
||||
|
||||
# Remove the tmpdir from the location to avoid churn
|
||||
sed -i 's_^#: /.*/share/_#: share/_' messages.pot
|
||||
# This regex handles explicit requests to translate a message. These are more important to translate
|
||||
# than messages which should be implicitly translated.
|
||||
set -l explicit_regex '.*\( *_ (([\'"]).+?(?<!\\\\)\\2) *\).*'
|
||||
extract_fish_script_messages $explicit_regex
|
||||
|
||||
rm -r $tmpdir
|
||||
# This regex handles descriptions for `complete` and `function` statements. These messages are not
|
||||
# particularly important to translate. Hence the "implicit" label.
|
||||
set -l implicit_regex '^(?:\s|and |or )*(?:complete|function).*? (?:-d|--description) (([\'"]).+?(?<!\\\\)\\2).*'
|
||||
extract_fish_script_messages $implicit_regex
|
||||
end |
|
||||
# At this point, all extracted strings have been written to stdout,
|
||||
# starting with the ones taken from the Rust sources,
|
||||
# followed by strings explicitly marked for translation in fish scripts,
|
||||
# and finally the strings from fish scripts which get translated implicitly.
|
||||
# Because we do not eliminate duplicates across these categories,
|
||||
# we do it here, since other gettext tools expect no duplicates.
|
||||
msguniq --no-wrap
|
||||
|
||||
88
build_tools/update_translations.fish
Executable file
88
build_tools/update_translations.fish
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
# Updates the files used for gettext translations.
|
||||
# By default, the whole xgettext, msgmerge, msgfmt pipeline runs,
|
||||
# which extracts the messages from the source files into $template_file,
|
||||
# updates the PO files for each language from that
|
||||
# (changed line numbers, added messages, removed messages),
|
||||
# and finally generates a machine-readable MO file for each language,
|
||||
# which is stored in share/locale/$LANG/LC_MESSAGES/fish.mo (relative to the repo root).
|
||||
#
|
||||
# Use cases:
|
||||
# For developers:
|
||||
# - Run with args `--no-mo` to update all PO files after making changes to Rust/fish
|
||||
# sources.
|
||||
# For translators:
|
||||
# - Run with `--no-mo` first, to ensure that the strings you are translating are up to date.
|
||||
# - Specify the language you want to work on as an argument, which must be a file in the po/
|
||||
# directory. You can specify a language which does not have translations yet by specifying the
|
||||
# name of a file which does not yet exist. Make sure to follow the naming convention.
|
||||
|
||||
# The sort utility is locale-sensitive.
|
||||
# Ensure that sorting output is consistent by setting LC_ALL here.
|
||||
set -gx LC_ALL C.UTF-8
|
||||
|
||||
set -l build_tools (status dirname)
|
||||
set -l template_file $build_tools/../po/template.po
|
||||
set -l po_dir $build_tools/../po
|
||||
|
||||
set -l extract
|
||||
set -l po
|
||||
set -l mo
|
||||
|
||||
argparse --exclusive 'no-mo,only-mo' 'no-mo' 'only-mo' -- $argv
|
||||
or exit $status
|
||||
|
||||
if test -z $argv[1]
|
||||
# Update everything if not specified otherwise.
|
||||
set -g po_files $po_dir/*.po
|
||||
else
|
||||
set -l po_dir_id (stat --format='%d:%i' -- $po_dir)
|
||||
for arg in $argv
|
||||
set -l arg_dir_id (stat --format='%d:%i' -- (dirname $arg))
|
||||
if test $po_dir_id != $arg_dir_id
|
||||
echo "Argument $arg is not a file in the directory $(realpath $po_dir)."
|
||||
echo "Non-option arguments must specify paths to files in this directory."
|
||||
echo ""
|
||||
echo "If you want to add a new language to the translations not the following:"
|
||||
echo "The filename must identify a language, with a two letter ISO 639-1 language code of the target language (e.g. 'pt' for Portuguese), and use the file extension '.po'."
|
||||
echo "Optionally, you can specify a regional variant (e.g. 'pt_BR')."
|
||||
echo "So valid filenames are of the shape 'll.po' or 'll_CC.po'."
|
||||
exit 1
|
||||
end
|
||||
if not basename $arg | grep -qE '^[a-z]{2}(_[A-Z]{2})?\.po$'
|
||||
echo "Filename does not match the expected format ('ll.po' or 'll_CC.po')."
|
||||
exit 1
|
||||
end
|
||||
end
|
||||
set -g po_files $argv
|
||||
end
|
||||
|
||||
if set -l --query _flag_no_mo
|
||||
set -l --erase mo
|
||||
end
|
||||
if set -l --query _flag_only_mo
|
||||
set -l --erase extract
|
||||
set -l --erase po
|
||||
end
|
||||
|
||||
if set -l --query extract
|
||||
$build_tools/fish_xgettext.fish >$template_file
|
||||
or exit 1
|
||||
end
|
||||
|
||||
for po_file in $po_files
|
||||
if set -l --query po
|
||||
if test -e $po_file
|
||||
msgmerge --update --no-fuzzy-matching --no-wrap --backup=none $po_file $template_file
|
||||
else
|
||||
cp $template_file $po_file
|
||||
end
|
||||
end
|
||||
if set -l --query mo
|
||||
set -l locale_dir $build_tools/../share/locale
|
||||
set -l out_dir $locale_dir/(basename $po_file .po)/LC_MESSAGES
|
||||
mkdir -p $out_dir
|
||||
msgfmt --check-format --output-file=$out_dir/fish.mo $po_file
|
||||
end
|
||||
end
|
||||
1
debian/control
vendored
1
debian/control
vendored
@@ -27,7 +27,6 @@ Depends: bsdextrautils | bsdmainutils,
|
||||
gettext-base,
|
||||
# for nroff and preconv
|
||||
groff-base,
|
||||
man-db,
|
||||
# for terminal definitions
|
||||
ncurses-base,
|
||||
# for kill
|
||||
|
||||
@@ -425,6 +425,24 @@ Launch ``git diff`` and repaint the commandline afterwards when :kbd:`ctrl-g` is
|
||||
|
||||
bind ctrl-g 'git diff' repaint
|
||||
|
||||
Swap :kbd:`tab` and :kbd:`shift-tab`, making tab focus the search field.
|
||||
But if the search field is already active, keep the behavior (:kbd:`tab` cycles forward, :kbd:`shift-tab` backward).::
|
||||
|
||||
bind tab '
|
||||
if commandline --search-field >/dev/null
|
||||
commandline -f complete
|
||||
else
|
||||
commandline -f complete-and-search
|
||||
end
|
||||
'
|
||||
bind shift-tab '
|
||||
if commandline --search-field >/dev/null
|
||||
commandline -f complete-and-search
|
||||
else
|
||||
commandline -f complete
|
||||
end
|
||||
'
|
||||
|
||||
.. _cmd-bind-termlimits:
|
||||
|
||||
Terminal Limitations
|
||||
|
||||
@@ -74,6 +74,9 @@ The following options change what part of the commandline is printed or updated:
|
||||
**--search-field**
|
||||
Use the pager search field instead of the command line. Returns false if the search field is not shown.
|
||||
|
||||
**--input=INPUT**
|
||||
Operate on this string instead of the commandline. Useful for using options like **--tokens-expanded**.
|
||||
|
||||
The following options change the way ``commandline`` prints the current commandline buffer:
|
||||
|
||||
**-c** or **--cut-at-cursor**
|
||||
@@ -87,10 +90,7 @@ The following options change the way ``commandline`` prints the current commandl
|
||||
Perform argument expansion on the selection and print one argument per line.
|
||||
Command substitutions are not expanded but forwarded as-is.
|
||||
|
||||
**--tokens-raw**
|
||||
Print arguments in the selection as they appear on the command line, one per line.
|
||||
|
||||
**-o** or **tokenize**
|
||||
**-o**, **tokenize**, **--tokens-raw**
|
||||
Deprecated; do not use.
|
||||
|
||||
If ``commandline`` is called during a call to complete a given string using ``complete -C STRING``, ``commandline`` will consider the specified string to be the current contents of the command line.
|
||||
|
||||
@@ -10,7 +10,7 @@ Synopsis
|
||||
|
||||
fish_config [browse]
|
||||
fish_config prompt (choose | list | save | show)
|
||||
fish_config theme (choose | demo | dump | list | save | show | update)
|
||||
fish_config theme (choose | demo | dump | list | save | show)
|
||||
|
||||
Description
|
||||
-----------
|
||||
@@ -40,9 +40,6 @@ Available subcommands for the ``theme`` command:
|
||||
- ``list`` lists the names of the available sample themes.
|
||||
- ``save`` saves the given theme to :ref:`universal variables <variables-universal>`.
|
||||
- ``show`` shows what the given sample theme (or all) would look like.
|
||||
- ``update`` updates any ``fish_color_*`` and ``fish_pager_color_*`` variables whose value contains
|
||||
"--track=THEME". They are set to the latest version of that theme, and the tracking
|
||||
option is preserved. Note that ``fish_config theme update`` is run at fish startup.
|
||||
|
||||
The **-h** or **--help** option displays help about using this command.
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ Description
|
||||
|
||||
The ``fish_mode_prompt`` function outputs the mode indicator for use in vi mode.
|
||||
|
||||
The default ``fish_mode_prompt`` function will output indicators about the current vi editor mode displayed to the left of the regular prompt. Define your own function to customize the appearance of the mode indicator. The ``$fish_bind_mode variable`` can be used to determine the current mode. It will be one of ``default``, ``insert``, ``replace_one``, or ``visual``.
|
||||
The default ``fish_mode_prompt`` function will output indicators about the current vi editor mode displayed to the left of the regular prompt. Define your own function to customize the appearance of the mode indicator. The ``$fish_bind_mode variable`` can be used to determine the current mode. It will be one of ``default``, ``insert``, ``replace_one``, ``replace``, or ``visual``.
|
||||
|
||||
You can also define an empty ``fish_mode_prompt`` function to remove the vi mode indicators::
|
||||
|
||||
@@ -51,6 +51,9 @@ Example
|
||||
case replace_one
|
||||
set_color --bold green
|
||||
echo 'R'
|
||||
case replace
|
||||
set_color --bold bryellow
|
||||
echo 'R'
|
||||
case visual
|
||||
set_color --bold brmagenta
|
||||
echo 'V'
|
||||
|
||||
@@ -57,13 +57,7 @@ The following options are available:
|
||||
Sets reverse mode.
|
||||
|
||||
**-u** or **--underline**, or **-uSTYLE** or **--underline=STYLE**
|
||||
Set the underline mode; supported styles are **single** (default) and **curly**.
|
||||
|
||||
**--track=THEME**
|
||||
Ignored. Included by default in universally-scoped color variables to tell fish to update
|
||||
them as the associated theme changes.
|
||||
This flag can be set for all variables when loading a theme with the `--track`` option, that is
|
||||
:doc:`fish_config theme save THEME --track <fish_config>`.
|
||||
Set the underline mode; supported styles are **single** (default), **double**, **curly**, **dotted** and **dashed**.
|
||||
|
||||
**-h** or **--help**
|
||||
Displays help about using this command.
|
||||
|
||||
@@ -33,8 +33,6 @@ Synopsis
|
||||
status buildinfo
|
||||
status get-file FILE
|
||||
status list-files [PATH]
|
||||
status xtgettcap TERMINFO-CAPABILITY
|
||||
status xtversion
|
||||
|
||||
Description
|
||||
-----------
|
||||
@@ -119,13 +117,6 @@ The following operations (subcommands) are available:
|
||||
This lists the files embedded in the fish binary at compile time. Only files where the path starts with the optional *FILE* argument are shown.
|
||||
Returns 0 if something was printed, 1 otherwise.
|
||||
|
||||
**xtgettcap** *TERMINFO-CAPABILITY*
|
||||
Query the terminal for a terminfo capability via XTGETTCAP.
|
||||
Returns 0 if the capability is present and 1 otherwise.
|
||||
|
||||
**xtversion**
|
||||
Show the terminal name and version (XTVERSION).
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ Synopsis
|
||||
|
||||
.. synopsis::
|
||||
|
||||
string join [-q | --quiet] SEP [STRING ...]
|
||||
string join0 [-q | --quiet] [STRING ...]
|
||||
string join [-q | --quiet] [-n | --no-empty] [--] SEP [STRING ...]
|
||||
string join0 [-q | --quiet] [-n | --no-empty] [--] [STRING ...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
@@ -18,11 +18,28 @@ Description
|
||||
|
||||
.. BEGIN DESCRIPTION
|
||||
|
||||
``string join`` joins its *STRING* arguments into a single string separated by *SEP*, which can be an empty string. Exit status: 0 if at least one join was performed, or 1 otherwise. If ``-n`` or ``--no-empty`` is specified, empty strings are excluded from consideration (e.g. ``string join -n + a b "" c`` would expand to ``a+b+c`` not ``a+b++c``).
|
||||
Joins its *STRING* arguments into a single string separated by *SEP* (for ``string join``) or by the
|
||||
zero byte (NUL) (for ``string join0``).
|
||||
Exit status: 0 if at least one join was performed, or 1 otherwise.
|
||||
|
||||
``string join0`` joins its *STRING* arguments into a single string separated by the zero byte (NUL), and adds a trailing NUL. This is most useful in conjunction with tools that accept NUL-delimited input, such as ``sort -z``. Exit status: 0 if at least one join was performed, or 1 otherwise.
|
||||
**-n**, **--no-empty**
|
||||
Exclude empty strings from consideration (e.g. ``string join -n + a b "" c`` would expand to ``a+b+c`` not ``a+b++c``).
|
||||
|
||||
Because Unix uses NUL as the string terminator, passing the output of ``string join0`` as an *argument* to a command (via a :ref:`command substitution <expand-command-substitution>`) won't actually work. Fish will pass the correct bytes along, but the command won't be able to tell where the argument ends. This is a limitation of Unix' argument passing.
|
||||
**-q**, **--quiet**
|
||||
Do not print the strings, only set the exit status as described above.
|
||||
|
||||
**WARNING**:
|
||||
Insert a ``--`` before positional arguments to prevent them from being interpreted as flags.
|
||||
Otherwise, any strings starting with ``-`` will be treated as flag arguments, meaning they will most likely result in the command failing.
|
||||
This is also true if you specify a variable which expands to such a string instead of a literal string.
|
||||
If you don't need to append flag arguments at the end of the command,
|
||||
just always use ``--`` to avoid unwelcome surprises.
|
||||
|
||||
``string join0`` adds a trailing NUL. This is most useful in conjunction with tools that accept NUL-delimited input, such as ``sort -z``.
|
||||
|
||||
Because Unix uses NUL as the string terminator, passing the output of ``string join0`` as an *argument* to a command (via a :ref:`command substitution <expand-command-substitution>`) won't actually work.
|
||||
Fish will pass the correct bytes along, but the command won't be able to tell where the argument ends.
|
||||
This is a limitation of Unix' argument passing.
|
||||
|
||||
.. END DESCRIPTION
|
||||
|
||||
@@ -43,4 +60,14 @@ Examples
|
||||
>_ string join '' a b c
|
||||
abc
|
||||
|
||||
>_ set -l markdown_list '- first' '- second' '- third'
|
||||
# Strings with leading hyphens (also in variable expansions) are interpreted as flag arguments by default.
|
||||
>_ string join \n $markdown_list
|
||||
string join: - first: unknown option
|
||||
# Use '--' to prevent this.
|
||||
>_ string join -- \n $markdown_list
|
||||
- first
|
||||
- second
|
||||
- third
|
||||
|
||||
.. END EXAMPLES
|
||||
|
||||
@@ -11,7 +11,7 @@ Synopsis
|
||||
string collect [-a | --allow-empty] [-N | --no-trim-newlines] [STRING ...]
|
||||
string escape [-n | --no-quoted] [--style=] [STRING ...]
|
||||
string join [-q | --quiet] [-n | --no-empty] SEP [STRING ...]
|
||||
string join0 [-q | --quiet] [STRING ...]
|
||||
string join0 [-q | --quiet] [-n | --no-empty] [STRING ...]
|
||||
string length [-q | --quiet] [STRING ...]
|
||||
string lower [-q | --quiet] [STRING ...]
|
||||
string match [-a | --all] [-e | --entire] [-i | --ignore-case]
|
||||
@@ -27,7 +27,7 @@ Synopsis
|
||||
[-r | --regex] [-q | --quiet] PATTERN REPLACE [STRING ...]
|
||||
string shorten [(-c | --char) CHARS] [(-m | --max) INTEGER]
|
||||
[-N | --no-newline] [-l | --left] [-q | --quiet] [STRING ...]
|
||||
string split [(-f | --fields) FIELDS] [(-m | --max) MAX] [-n | --no-empty]
|
||||
string split [(-f | --fields) FIELDS] [(-m | --max) MAX] [-n | --no-empty]
|
||||
[-q | --quiet] [-r | --right] SEP [STRING ...]
|
||||
string split0 [(-f | --fields) FIELDS] [(-m | --max) MAX] [-n | --no-empty]
|
||||
[-q | --quiet] [-r | --right] [STRING ...]
|
||||
|
||||
@@ -354,7 +354,7 @@ Some bindings are common across Emacs and vi mode, because they aren't text edit
|
||||
|
||||
- :kbd:`alt-o` opens the file at the cursor in a pager. If the cursor is in command position and the command is a script, it will instead open that script in your editor. The editor is chosen from the first available of the ``$VISUAL`` or ``$EDITOR`` variables.
|
||||
|
||||
- :kbd:`alt-p` adds the string ``&| less;`` to the end of the job under the cursor. The result is that the output of the command will be paged.
|
||||
- :kbd:`alt-p` adds the string ``&| less;`` to the end of the job under the cursor. The result is that the output of the command will be paged. If you set the ``PAGER`` variable, its value is used instead of ``less``.
|
||||
|
||||
- :kbd:`alt-w` prints a short description of the command under the cursor.
|
||||
|
||||
|
||||
@@ -917,6 +917,12 @@ If there is nothing between a brace and a comma or two commas, it's interpreted
|
||||
|
||||
To use a "," as an element, :ref:`quote <quotes>` or :ref:`escape <escapes>` it.
|
||||
|
||||
The very first character of a command token is never interpreted as expanding brace, because it's the beginning of a :ref:`compound statement <cmd-begin>`::
|
||||
|
||||
> {echo hello, && echo world}
|
||||
hello,
|
||||
world
|
||||
|
||||
.. _cartesian-product:
|
||||
|
||||
Combining lists
|
||||
|
||||
@@ -120,10 +120,22 @@ Optional Commands
|
||||
- smul
|
||||
- Enter underline mode.
|
||||
-
|
||||
* - ``\e[4:2m``
|
||||
- Su
|
||||
- Enter double underline mode.
|
||||
- kitty
|
||||
* - ``\e[4:3m``
|
||||
- Su
|
||||
- Enter curly underline mode.
|
||||
- kitty
|
||||
* - ``\e[4:4m``
|
||||
- Su
|
||||
- Enter dotted underline mode.
|
||||
- kitty
|
||||
* - ``\e[4:5m``
|
||||
- Su
|
||||
- Enter dashed underline mode.
|
||||
- kitty
|
||||
* - ``\e[7m``
|
||||
- rev
|
||||
- Enter reverse video mode (swap foreground and background colors).
|
||||
@@ -177,9 +189,7 @@ Optional Commands
|
||||
- Su
|
||||
- Reset underline color to the default (follow the foreground color).
|
||||
- kitty
|
||||
* - .. _indn:
|
||||
|
||||
``\e[ Ps S``
|
||||
* - ``\e[ Ps S``
|
||||
- indn
|
||||
- Scroll forward Ps lines.
|
||||
-
|
||||
@@ -271,12 +281,6 @@ Optional Commands
|
||||
- FinalTerm
|
||||
* - ``\eP+q Pt \e\\``
|
||||
-
|
||||
- Request terminfo capability (XTGETTCAP).
|
||||
The parameter is the capability's hex-encoded terminfo code.
|
||||
To advertise a capability, the response must of the form
|
||||
``\eP1+q Pt \e\\`` or ``\eP1+q Pt = Pt \e\\``.
|
||||
In either variant the first parameter must be the hex-encoded terminfo code.
|
||||
In the second variant, fish ignores the part after the equals sign.
|
||||
|
||||
At startup, fish checks for the presence of the `indn <#indn>`_ string capability.
|
||||
- XTerm, kitty, foot, wezterm, contour
|
||||
- Request terminfo capability (XTGETTCAP). The parameter is the capability's hex-encoded terminfo code.
|
||||
Specifically, fish asks for the ``indn`` string capability. At the time of writing string capabilities are supported by kitty and foot.
|
||||
- XTerm, kitty, foot
|
||||
|
||||
@@ -115,7 +115,7 @@ These colors, and many more, can be changed by running ``fish_config``, or by mo
|
||||
|
||||
For example, if you want to disable (almost) all coloring::
|
||||
|
||||
fish_config theme choose none
|
||||
fish_config theme choose None
|
||||
|
||||
This picks the "none" theme. To see all themes::
|
||||
|
||||
@@ -631,12 +631,12 @@ You can define your own prompt from the command line:
|
||||
|
||||
Then, if you are happy with it, you can save it to disk by typing ``funcsave fish_prompt``. This saves the prompt in ``~/.config/fish/functions/fish_prompt.fish``. (Or, if you want, you can create that file manually from the start.)
|
||||
|
||||
Multiple lines are OK. Colors can be set via :doc:`set_color <cmds/set_color>`, passing it named ANSI colors, or hex RGB values::
|
||||
Multiple lines are OK. Colors can be set via :doc:`set_color <cmds/set_color>` by passing it named ANSI colors, or hex RGB values::
|
||||
|
||||
function fish_prompt
|
||||
set_color purple
|
||||
date "+%m/%d/%y"
|
||||
set_color F00
|
||||
set_color FF0000
|
||||
echo (pwd) '>' (set_color normal)
|
||||
end
|
||||
|
||||
|
||||
@@ -31,13 +31,12 @@ BuildRequires: glibc-langpack-en
|
||||
BuildRequires: python3 procps
|
||||
|
||||
%if 0%{?suse_version}
|
||||
Requires: terminfo-base
|
||||
Requires: terminfo-base groff
|
||||
%else
|
||||
Requires: ncurses-base
|
||||
Requires: ncurses-base groff-base
|
||||
%endif
|
||||
Requires: file
|
||||
Requires: python3
|
||||
Requires: man
|
||||
Requires: procps
|
||||
|
||||
# Although the build scripts mangle the version number to be RPM compatible
|
||||
|
||||
180882
po/pt_BR.po
180882
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
185464
po/zh_CN.po
185464
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
[package]
|
||||
name = "fish-printf"
|
||||
edition = "2021"
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
version = "0.2.1"
|
||||
repository = "https://github.com/fish-shell/fish-shell"
|
||||
description = "printf implementation, based on musl"
|
||||
@@ -9,3 +10,8 @@ license = "MIT"
|
||||
[dependencies]
|
||||
libc = "0.2.155"
|
||||
widestring = { version = "1.0.2", optional = true }
|
||||
unicode-segmentation = "1.12.0"
|
||||
unicode-width = "0.2.0"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
1
printf/clippy.toml
Normal file
1
printf/clippy.toml
Normal file
@@ -0,0 +1 @@
|
||||
allow-print-in-tests = true
|
||||
@@ -71,7 +71,7 @@ macro_rules! sprintf {
|
||||
/// - `args`: Iterator over the arguments to format.
|
||||
///
|
||||
/// # Returns
|
||||
/// A `Result` which is `Ok` containing the number of characters written on success, or an `Error`.
|
||||
/// A `Result` which is `Ok` containing the width of the string written on success, or an `Error`.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
use std::fmt::{self, Write};
|
||||
use std::mem;
|
||||
use std::result::Result;
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
#[cfg(feature = "widestring")]
|
||||
use widestring::Utf32Str as wstr;
|
||||
@@ -382,7 +384,7 @@ pub fn sprintf_locale(
|
||||
}
|
||||
|
||||
// Read field width. We do not support $.
|
||||
let width = if s.at(0) == Some('*') {
|
||||
let desired_width = if s.at(0) == Some('*') {
|
||||
let arg_width = args.next().ok_or(Error::MissingArg)?.as_sint()?;
|
||||
s.advance_by(1);
|
||||
if arg_width < 0 {
|
||||
@@ -397,7 +399,7 @@ pub fn sprintf_locale(
|
||||
};
|
||||
|
||||
// Optionally read precision. We do not support $.
|
||||
let mut prec: Option<usize> = if s.at(0) == Some('.') && s.at(1) == Some('*') {
|
||||
let mut desired_precision: Option<usize> = if s.at(0) == Some('.') && s.at(1) == Some('*') {
|
||||
// "A negative precision is treated as though it were missing."
|
||||
// Here we assume the precision is always signed.
|
||||
s.advance_by(2);
|
||||
@@ -410,7 +412,7 @@ pub fn sprintf_locale(
|
||||
None
|
||||
};
|
||||
// Disallow precisions larger than i32::MAX, in keeping with C.
|
||||
if prec.unwrap_or(0) > i32::MAX as usize {
|
||||
if desired_precision.unwrap_or(0) > i32::MAX as usize {
|
||||
return Err(Error::Overflow);
|
||||
}
|
||||
|
||||
@@ -429,7 +431,7 @@ pub fn sprintf_locale(
|
||||
// "If a precision is given with a numeric conversion (d, i, o, u, i, x, and X),
|
||||
// the 0 flag is ignored." p is included here.
|
||||
let spec_is_numeric = matches!(conv_spec, CS::d | CS::u | CS::o | CS::p | CS::x | CS::X);
|
||||
if spec_is_numeric && prec.is_some() {
|
||||
if spec_is_numeric && desired_precision.is_some() {
|
||||
flags.zero_pad = false;
|
||||
}
|
||||
|
||||
@@ -443,13 +445,22 @@ pub fn sprintf_locale(
|
||||
CS::e | CS::f | CS::g | CS::a | CS::E | CS::F | CS::G | CS::A => {
|
||||
// Floating point types handle output on their own.
|
||||
let float = arg.as_float()?;
|
||||
let len = format_float(f, float, width, prec, flags, locale, conv_spec, buf)?;
|
||||
let len = format_float(
|
||||
f,
|
||||
float,
|
||||
desired_width,
|
||||
desired_precision,
|
||||
flags,
|
||||
locale,
|
||||
conv_spec,
|
||||
buf,
|
||||
)?;
|
||||
out_len = out_len.checked_add(len).ok_or(Error::Overflow)?;
|
||||
continue 'main;
|
||||
}
|
||||
CS::p => {
|
||||
const PTR_HEX_DIGITS: usize = 2 * mem::size_of::<*const u8>();
|
||||
prec = prec.map(|p| p.max(PTR_HEX_DIGITS));
|
||||
desired_precision = desired_precision.map(|p| p.max(PTR_HEX_DIGITS));
|
||||
let uint = arg.as_uint()?;
|
||||
if uint != 0 {
|
||||
prefix = "0x";
|
||||
@@ -479,8 +490,8 @@ pub fn sprintf_locale(
|
||||
if uint != 0 {
|
||||
write!(buf, "{:o}", uint)?;
|
||||
}
|
||||
if flags.alt_form && prec.unwrap_or(0) <= buf.len() + 1 {
|
||||
prec = Some(buf.len() + 1);
|
||||
if flags.alt_form && desired_precision.unwrap_or(0) <= buf.len() + 1 {
|
||||
desired_precision = Some(buf.len() + 1);
|
||||
}
|
||||
buf
|
||||
}
|
||||
@@ -514,10 +525,38 @@ pub fn sprintf_locale(
|
||||
CS::s => {
|
||||
// also 'S'
|
||||
let s = arg.as_str(buf)?;
|
||||
let p = prec.unwrap_or(s.len()).min(s.len());
|
||||
prec = Some(p);
|
||||
flags.zero_pad = false;
|
||||
&s[..p]
|
||||
match desired_precision {
|
||||
Some(precision) => {
|
||||
// from man printf(3)
|
||||
// "the maximum number of characters to be printed from a string"
|
||||
// We interpret this to mean the maximum width when printed, as defined by
|
||||
// Unicode grapheme cluster width.
|
||||
let mut byte_len = 0;
|
||||
let mut width = 0;
|
||||
let mut graphemes = s.graphemes(true);
|
||||
// Iteratively add single grapheme clusters as long as the fit within the
|
||||
// width limited by precision.
|
||||
while width < precision {
|
||||
match graphemes.next() {
|
||||
Some(grapheme) => {
|
||||
let grapheme_width = grapheme.width();
|
||||
if width + grapheme_width <= precision {
|
||||
byte_len += grapheme.len();
|
||||
width += grapheme_width;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
let p = precision.min(width);
|
||||
desired_precision = Some(p);
|
||||
&s[..byte_len]
|
||||
}
|
||||
None => s,
|
||||
}
|
||||
}
|
||||
};
|
||||
// Numeric output should be empty iff the value is 0.
|
||||
@@ -528,23 +567,26 @@ pub fn sprintf_locale(
|
||||
// Decide if we want to apply thousands grouping to the body, and compute its size.
|
||||
// Note we have already errored out if grouped is set and this is non-numeric.
|
||||
let wants_grouping = flags.grouped && locale.thousands_sep.is_some();
|
||||
let body_len = match wants_grouping {
|
||||
let body_width = match wants_grouping {
|
||||
// We assume that text representing numbers is ASCII, so len == width.
|
||||
true => body.len() + locale.separator_count(body.len()),
|
||||
false => body.len(),
|
||||
false => body.width(),
|
||||
};
|
||||
|
||||
// Resolve the precision.
|
||||
// In the case of a non-numeric conversion, update the precision to at least the
|
||||
// length of the string.
|
||||
let prec = if !spec_is_numeric {
|
||||
prec.unwrap_or(body_len)
|
||||
let desired_precision = if !spec_is_numeric {
|
||||
desired_precision.unwrap_or(body_width)
|
||||
} else {
|
||||
prec.unwrap_or(1).max(body_len)
|
||||
desired_precision.unwrap_or(1).max(body_width)
|
||||
};
|
||||
|
||||
let prefix_len = prefix.len();
|
||||
let unpadded_width = prefix_len.checked_add(prec).ok_or(Error::Overflow)?;
|
||||
let width = width.max(unpadded_width);
|
||||
let prefix_width = prefix.width();
|
||||
let unpadded_width = prefix_width
|
||||
.checked_add(desired_precision)
|
||||
.ok_or(Error::Overflow)?;
|
||||
let width = desired_width.max(unpadded_width);
|
||||
|
||||
// Pad on the left with spaces to the desired width?
|
||||
if !flags.left_adj && !flags.zero_pad {
|
||||
@@ -560,7 +602,8 @@ pub fn sprintf_locale(
|
||||
}
|
||||
|
||||
// Pad on the left to the given precision?
|
||||
pad(f, '0', prec, body_len)?;
|
||||
// TODO: why pad with 0 here?
|
||||
pad(f, '0', desired_precision, body_width)?;
|
||||
|
||||
// Output the actual value, perhaps with grouping.
|
||||
if wants_grouping {
|
||||
|
||||
@@ -13,6 +13,7 @@ macro_rules! sprintf_check {
|
||||
$(,)? // optional trailing comma
|
||||
) => {
|
||||
{
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
let mut target = String::new();
|
||||
let mut args = [$($arg.to_arg()),*];
|
||||
let len = $crate::printf_c_locale(
|
||||
@@ -20,7 +21,7 @@ macro_rules! sprintf_check {
|
||||
$fmt.as_ref() as &str,
|
||||
&mut args,
|
||||
).expect("printf failed");
|
||||
assert!(len == target.len(), "Wrong length returned: {} vs {}", len, target.len());
|
||||
assert_eq!(len, target.width(), "Wrong length returned");
|
||||
target
|
||||
}
|
||||
};
|
||||
@@ -735,6 +736,18 @@ fn test_huge_precision_g() {
|
||||
sprintf_err!("%.2147483648g", f => Error::Overflow);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_non_ascii() {
|
||||
assert_fmt!("%3s", "ö" => " ö");
|
||||
assert_fmt!("%3s", "🇺🇳" => " 🇺🇳");
|
||||
assert_fmt!("%.3s", "🇺🇳🇺🇳" => "🇺🇳");
|
||||
assert_fmt!("%.3s", "a🇺🇳" => "a🇺🇳");
|
||||
assert_fmt!("%.3s", "aa🇺🇳" => "aa");
|
||||
assert_fmt!("%3.3s", "aa🇺🇳" => " aa");
|
||||
assert_fmt!("%.1s", "𒈙a" => "𒈙");
|
||||
assert_fmt!("%3.3s", "👨👨👧👧" => " 👨👨👧👧");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_errors() {
|
||||
use Error::*;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
function __fish_apt_no_subcommand -d 'Test if apt has yet to be given the subcommand'
|
||||
for i in (commandline -xpc)
|
||||
if contains -- $i update upgrade dselect-upgrade dist-upgrade install remove purge source build-dep check clean autoclean changelog
|
||||
if contains -- $i update upgrade dselect-upgrade dist-upgrade install remove purge autoremove autopurge source build-dep check clean autoclean changelog
|
||||
return 1
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@ end
|
||||
|
||||
function __fish_apt_use_package -d 'Test if apt command should have packages as potential completion'
|
||||
for i in (commandline -xpc)
|
||||
if contains -- $i contains install remove purge build-dep changelog
|
||||
if contains -- $i contains install remove purge autoremove autopurge build-dep changelog
|
||||
return 0
|
||||
end
|
||||
end
|
||||
@@ -34,7 +34,8 @@ complete -f -n __fish_apt_no_subcommand -c apt-get -a build-dep -d 'Install/remo
|
||||
complete -f -n __fish_apt_no_subcommand -c apt-get -a check -d 'Update cache and check dependencies'
|
||||
complete -f -n __fish_apt_no_subcommand -c apt-get -a clean -d 'Clean local caches and packages'
|
||||
complete -f -n __fish_apt_no_subcommand -c apt-get -a autoclean -d 'Clean packages no longer be downloaded'
|
||||
complete -f -n __fish_apt_no_subcommand -c apt-get -a autoremove -d 'Remove automatically installed packages'
|
||||
complete -f -n __fish_apt_no_subcommand -c apt-get -a autoremove -d 'Remove packages no longer needed as dependencies'
|
||||
complete -f -n __fish_apt_no_subcommand -c apt-get -a autopurge -d 'Remove packages no longer needed as dependencies and delete their config files'
|
||||
complete -c apt-get -l no-install-recommends -d 'Do not install recommended packages'
|
||||
complete -c apt-get -l no-install-suggests -d 'Do not install suggested packages'
|
||||
complete -c apt-get -s d -l download-only -d 'Download Only'
|
||||
|
||||
@@ -6,8 +6,8 @@ if [ "$(uname -s)" = Darwin -a "$(command -s apt)" = /usr/bin/apt ]
|
||||
exit 1
|
||||
end
|
||||
|
||||
set -l all_subcmds update upgrade full-upgrade search list install show remove edit-sources purge changelog autoremove depends rdepends
|
||||
set -l pkg_subcmds install upgrade full-upgrade show search purge changelog policy depends rdepends autoremove
|
||||
set -l all_subcmds update upgrade full-upgrade search list install show remove edit-sources purge changelog autoremove autopurge depends rdepends
|
||||
set -l pkg_subcmds install upgrade full-upgrade show search purge changelog policy depends rdepends autoremove autopurge
|
||||
set -l installed_pkg_subcmds remove
|
||||
set -l handle_file_pkg_subcmds install
|
||||
|
||||
@@ -114,7 +114,7 @@ __fish_apt_subcommand changelog -r -d 'Download and display package changelog'
|
||||
# Autoremove
|
||||
__fish_apt_subcommand autoremove -d 'Remove packages no longer needed as dependencies'
|
||||
|
||||
# Autoremove
|
||||
# Autopurge
|
||||
__fish_apt_subcommand autopurge -d 'Remove packages no longer needed as dependencies and delete their config files'
|
||||
|
||||
# Clean
|
||||
|
||||
@@ -11,7 +11,7 @@ end
|
||||
|
||||
function __fish_apt_use_package -d 'Test if aptitude command should have packages as potential completion'
|
||||
for i in (commandline -xpc)
|
||||
if contains -- $i changelog full-upgrade download forbid-version hold install keep-all markauto purge reinstall remove show unhold unmarkauto
|
||||
if contains -- $i changelog full-upgrade download forbid-version hold install keep-all markauto purge reinstall remove show showrc unhold unmarkauto why why-not versions
|
||||
return 0
|
||||
end
|
||||
end
|
||||
@@ -38,15 +38,19 @@ complete -f -n __fish_apt_no_subcommand -c aptitude -a markauto -d 'Mark package
|
||||
complete -f -n __fish_apt_no_subcommand -c aptitude -a purge -d 'Remove and delete all associated configuration and data files'
|
||||
complete -f -n __fish_apt_no_subcommand -c aptitude -a reinstall -d 'Reinstall the packages'
|
||||
complete -f -n __fish_apt_no_subcommand -c aptitude -a remove -d 'Remove the packages'
|
||||
complete -f -n __fish_apt_no_subcommand -c aptitude -a showsrc -d 'Display detailed information about the source packages (apt wrapper)'
|
||||
complete -f -n __fish_apt_no_subcommand -c aptitude -a show -d 'Display detailed information about the packages'
|
||||
complete -f -n __fish_apt_no_subcommand -c aptitude -a unhold -d 'Consider the packages by future upgrade commands'
|
||||
complete -f -n __fish_apt_no_subcommand -c aptitude -a unmarkauto -d 'Mark packages as manually installed'
|
||||
complete -f -n __fish_apt_no_subcommand -c aptitude -a search -d 'Search for packages matching one of the patterns'
|
||||
complete -f -n __fish_apt_no_subcommand -c aptitude -a help -d 'Display brief summary of the available commands and options'
|
||||
complete -f -n __fish_apt_no_subcommand -c aptitude -a why -d 'Explain why a particular package should be installed'
|
||||
complete -f -n __fish_apt_no_subcommand -c aptitude -a why-not -d 'Explain why a particular package cannot be installed'
|
||||
complete -f -n __fish_apt_no_subcommand -c aptitude -a versions -d 'Displays the versions of specified packages'
|
||||
|
||||
complete -c aptitude -s D -l show-deps -d 'Show explanations of automatic installations and removals'
|
||||
complete -c aptitude -s d -l download-only -d 'Download Only'
|
||||
complete -c aptitude -s f -l fix-broken -d 'Correct broken dependencies'
|
||||
complete -c aptitude -s d -l download-only -d 'Download only'
|
||||
complete -c aptitude -s f -l fix-broken -d 'Aggressively try to fix broken packages'
|
||||
complete -c aptitude -l purge-unused -d 'Purge packages that are not required by any installed package'
|
||||
complete -c aptitude -s P -l prompt -d 'Always display a prompt'
|
||||
complete -c aptitude -s R -l without-recommends -d 'Do not treat recommendations as dependencies'
|
||||
@@ -60,6 +64,7 @@ complete -c aptitude -l version -d 'Display the version of aptitude and compile
|
||||
complete -c aptitude -l visual-preview -d 'Start up the visual interface and display its preview screen'
|
||||
complete -c aptitude -s y -l assume-yes -d 'Assume the answer yes for all question prompts'
|
||||
complete -c aptitude -s Z -d 'Show how much disk space will be used or freed'
|
||||
complete -c aptitude -s u -d 'Download new package lists on startup (terminal interface only)'
|
||||
complete -r -c aptitude -s F -l display-format -d 'Specify the format to be used by the search command'
|
||||
complete -r -c aptitude -s t -l target-release -d 'Set the release from which packages should be installed'
|
||||
complete -r -c aptitude -s O -l sort -d 'Specify the order for the output from the search command'
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
# Tab completion for cargo (https://github.com/rust-lang/cargo).
|
||||
|
||||
## --- WRITTEN MANUALLY ---
|
||||
set -l __fish_cargo_subcommands (cargo --list 2>&1 | string replace -rf '^\s+([^\s]+)\s*(.*)' '$1\t$2' | string escape)
|
||||
|
||||
function __fish_cargo
|
||||
cargo --color=never $argv
|
||||
end
|
||||
|
||||
set -l __fish_cargo_subcommands (__fish_cargo --list 2>&1 | string replace -rf '^\s+([^\s]+)\s*(.*)' '$1\t$2' | string escape)
|
||||
|
||||
complete -c cargo -f -c cargo -n __fish_use_subcommand -a "$__fish_cargo_subcommands"
|
||||
complete -c cargo -x -c cargo -n '__fish_seen_subcommand_from help' -a "$__fish_cargo_subcommands"
|
||||
|
||||
for x in bench b build c check rustc t test
|
||||
complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l bench -a "(cargo bench --bench 2>&1 | string replace -rf '^\s+' '')"
|
||||
complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l bench -a "(__fish_cargo bench --bench 2>&1 | string replace -rf '^\s+' '')"
|
||||
complete -c cargo -n "__fish_seen_subcommand_from $x" -l lib -d 'Only this package\'s library'
|
||||
complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l test -a "(cargo test --test 2>&1 | string replace -rf '^\s+' '')"
|
||||
complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l test -a "(__fish_cargo test --test 2>&1 | string replace -rf '^\s+' '')"
|
||||
end
|
||||
|
||||
for x in bench b build c check r run rustc t test
|
||||
complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l bin -a "(cargo run --bin 2>&1 | string replace -rf '^\s+' '')"
|
||||
complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l example -a "(cargo run --example 2>&1 | string replace -rf '^\s+' '')"
|
||||
complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l bin -a "(__fish_cargo run --bin 2>&1 | string replace -rf '^\s+' '')"
|
||||
complete -c cargo -x -n "__fish_seen_subcommand_from $x" -l example -a "(__fish_cargo run --example 2>&1 | string replace -rf '^\s+' '')"
|
||||
end
|
||||
|
||||
# If using rustup, get the list of installed targets from there. Otherwise print all targets.
|
||||
@@ -38,18 +43,18 @@ end
|
||||
|
||||
function __fish_cargo_features
|
||||
if command -q jq
|
||||
cargo read-manifest | jq -r '.features | keys | .[]' | __fish_concat_completions
|
||||
__fish_cargo read-manifest | jq -r '.features | keys | .[]' | __fish_concat_completions
|
||||
else if set -l python (__fish_anypython)
|
||||
cargo read-manifest | command $python -Sc "import sys, json"\n"print(*json.load(sys.stdin)['features'].keys(), sep='\n')" | __fish_concat_completions
|
||||
__fish_cargo read-manifest | command $python -Sc "import sys, json"\n"print(*json.load(sys.stdin)['features'].keys(), sep='\n')" | __fish_concat_completions
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_cargo_packages
|
||||
if command -q jq
|
||||
cargo metadata --no-deps --format-version 1 | jq -r '.packages | .[] | .name' | __fish_concat_completions
|
||||
__fish_cargo metadata --no-deps --format-version 1 | jq -r '.packages | .[] | .name' | __fish_concat_completions
|
||||
else if set -l python (__fish_anypython)
|
||||
cargo metadata --no-deps --format-version 1 |
|
||||
command $python -Sc "import sys, json"\n"print(*[x['name'] for x in json.load(sys.stdin)['packages']], sep='\n')"
|
||||
__fish_cargo metadata --no-deps --format-version 1 |
|
||||
command $python -Sc "import sys, json"\n"print(*[x['name'] for x in json.load(sys.stdin)['packages']], sep='\n')"
|
||||
end
|
||||
end
|
||||
complete -c cargo -n '__fish_seen_subcommand_from run test build debug check clippy' -s p -l package \
|
||||
@@ -60,7 +65,7 @@ complete -c cargo -n '__fish_seen_subcommand_from run test build debug check cli
|
||||
complete -c cargo -n __fish_use_subcommand -l explain -d 'Run `rustc --explain CODE`'
|
||||
complete -c cargo -n __fish_use_subcommand -l color -d 'Coloring: auto, always, never'
|
||||
complete -c cargo -n __fish_use_subcommand -l config -d 'Override a configuration value (unstable)'
|
||||
complete -c cargo -n __fish_use_subcommand -s Z -d 'Unstable (nightly-only) flags to Cargo, see \'cargo -Z help\' for details' -xa '(cargo -Z help | string replace -rf \'^\s*-Z (\S+)\s+(.*)\' \'$1\t$2\')'
|
||||
complete -c cargo -n __fish_use_subcommand -s Z -d 'Unstable (nightly-only) flags to Cargo, see \'cargo -Z help\' for details' -xa '(__fish_cargo -Z help | string replace -rf \'^\s*-Z (\S+)\s+(.*)\' \'$1\t$2\')'
|
||||
complete -c cargo -n __fish_use_subcommand -s V -l version -d 'Print version info and exit'
|
||||
complete -c cargo -n __fish_use_subcommand -l list -d 'List installed commands'
|
||||
complete -c cargo -n __fish_use_subcommand -s v -l verbose -d 'Use verbose output (-vv very verbose/build.rs output)'
|
||||
@@ -718,7 +723,7 @@ complete -c cargo -n "__fish_seen_subcommand_from tree" -s v -l verbose -d 'Use
|
||||
complete -c cargo -n "__fish_seen_subcommand_from tree" -l frozen -d 'Require Cargo.lock and cache are up to date'
|
||||
complete -c cargo -n "__fish_seen_subcommand_from tree" -l locked -d 'Require Cargo.lock is up to date'
|
||||
complete -c cargo -n "__fish_seen_subcommand_from tree" -l offline -d 'Run without accessing the network'
|
||||
complete -c cargo -n "__fish_seen_subcommand_from uninstall" -fa '(cargo install --list | string replace -rf "(\S+) (.*):" \'$1\t$2\')'
|
||||
complete -c cargo -n "__fish_seen_subcommand_from uninstall" -fa '(__fish_cargo install --list | string replace -rf "(\S+) (.*):" \'$1\t$2\')'
|
||||
complete -c cargo -n "__fish_seen_subcommand_from uninstall" -s p -l package -d 'Package to uninstall'
|
||||
complete -c cargo -n "__fish_seen_subcommand_from uninstall" -l bin -d 'Only uninstall the binary NAME'
|
||||
complete -c cargo -n "__fish_seen_subcommand_from uninstall" -l root -d 'Directory to uninstall packages from'
|
||||
@@ -841,8 +846,8 @@ if command -q cargo-asm
|
||||
# Warning: this will build the project and can take time! We make sure to only call it if it's not a switch so completions
|
||||
# for --foo will always be fast.
|
||||
if command -q timeout
|
||||
complete -c cargo -n "__fish_seen_subcommand_from asm; and not __fish_is_switch" -xa "(timeout 1 cargo asm)"
|
||||
complete -c cargo -n "__fish_seen_subcommand_from asm; and not __fish_is_switch" -xa "(timeout 1 __fish_cargo asm)"
|
||||
else
|
||||
complete -c cargo -n "__fish_seen_subcommand_from asm; and not __fish_is_switch" -xa "(cargo asm)"
|
||||
complete -c cargo -n "__fish_seen_subcommand_from asm; and not __fish_is_switch" -xa "(__fish_cargo asm)"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,7 +13,6 @@ complete -c commandline -s b -l current-buffer -d "Select entire command line (d
|
||||
complete -c commandline -s c -l cut-at-cursor -d "Only return that part of the command line before the cursor"
|
||||
complete -c commandline -s f -l function -d "Inject readline functions to reader"
|
||||
complete -c commandline -s x -l tokens-expanded -d "Print a list of expanded tokens"
|
||||
complete -c commandline -l tokens-raw -d "Print a list of raw tokens"
|
||||
|
||||
complete -c commandline -s I -l input -d "Specify command to operate on"
|
||||
complete -c commandline -s C -l cursor -d "Set/get cursor position, not buffer contents"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
complete fish_config -f
|
||||
set -l prompt_commands choose save show list
|
||||
set -l theme_commands choose demo dump save show list update
|
||||
set -l theme_commands choose demo dump save show list
|
||||
complete fish_config -n __fish_use_subcommand -a prompt -d 'View and pick from the sample prompts'
|
||||
complete fish_config -n "__fish_seen_subcommand_from prompt; and not __fish_seen_subcommand_from $prompt_commands" \
|
||||
-a choose -d 'View and pick from the sample prompts'
|
||||
@@ -16,7 +16,6 @@ complete fish_config -n __fish_use_subcommand -a browse -d 'Open the web-based U
|
||||
|
||||
complete fish_config -n __fish_use_subcommand -a theme -d 'View and pick from the sample themes'
|
||||
complete fish_config -n '__fish_seen_subcommand_from theme; and __fish_seen_subcommand_from choose save show' -a '(fish_config theme list)'
|
||||
complete fish_config -n '__fish_seen_subcommand_from theme; and __fish_seen_subcommand_from save' -l track -d 'Add --track to color variables to apply future theme updates'
|
||||
complete fish_config -n "__fish_seen_subcommand_from theme; and not __fish_seen_subcommand_from $theme_commands" \
|
||||
-a choose -d 'View and pick from the sample themes'
|
||||
complete fish_config -n "__fish_seen_subcommand_from theme; and not __fish_seen_subcommand_from $theme_commands" \
|
||||
@@ -29,5 +28,3 @@ complete fish_config -n "__fish_seen_subcommand_from theme; and not __fish_seen_
|
||||
-a demo -d 'Show example in the current theme'
|
||||
complete fish_config -n "__fish_seen_subcommand_from theme; and not __fish_seen_subcommand_from $theme_commands" \
|
||||
-a dump -d 'Print the current theme in .theme format'
|
||||
complete fish_config -n "__fish_seen_subcommand_from theme; and not __fish_seen_subcommand_from $theme_commands" \
|
||||
-a update -d "Update universal colors that have the tracking flag set"
|
||||
|
||||
@@ -16,7 +16,8 @@ function __fish_git
|
||||
end
|
||||
end
|
||||
# Using 'command git' to avoid interactions for aliases from git to (e.g.) hub
|
||||
command git $global_args $saved_args 2>/dev/null
|
||||
set -l git $__fish_git_timeout git
|
||||
command $git $global_args $saved_args 2>/dev/null
|
||||
end
|
||||
|
||||
# Print an optspec for argparse to handle git's options that are independent of any subcommand.
|
||||
@@ -52,8 +53,8 @@ end
|
||||
function __fish_git_branches
|
||||
# This is much faster than using `git branch` and avoids dealing with localized "detached HEAD" messages.
|
||||
# We intentionally only sort local branches by recency. See discussion in #9248.
|
||||
__fish_git for-each-ref --format='%(refname:strip=2)%09Local Branch' --sort=-committerdate refs/heads/ 2>/dev/null
|
||||
__fish_git for-each-ref --format='%(refname:strip=2)%09Remote Branch' refs/remotes/ 2>/dev/null
|
||||
__fish_git_local_branches
|
||||
__fish_git_remote_branches
|
||||
end
|
||||
|
||||
function __fish_git_submodules
|
||||
@@ -65,14 +66,18 @@ function __fish_git_local_branches
|
||||
__fish_git for-each-ref --format='%(refname:strip=2)%09Local Branch' --sort=-committerdate refs/heads/ 2>/dev/null
|
||||
end
|
||||
|
||||
function __fish_git_remote_branches
|
||||
__fish_git_timeout=(string split ' ' -- (command -v timeout)' 0.200') __fish_git for-each-ref --format='%(refname:strip=2)%09Remote Branch' refs/remotes/ 2>/dev/null
|
||||
end
|
||||
|
||||
function __fish_git_unique_remote_branches
|
||||
# `git checkout` accepts remote branches without the remote part
|
||||
# if they are unambiguous.
|
||||
# E.g. if only alice has a "frobulate" branch
|
||||
# `git checkout frobulate` is equivalent to `git checkout -b frobulate --track alice/frobulate`.
|
||||
__fish_git for-each-ref --format="%(refname:strip=3)" \
|
||||
__fish_git_timeout=(string split ' ' -- (command -v timeout)' 0.200') __fish_git for-each-ref --format="%(refname:strip=3)" \
|
||||
--sort="refname:strip=3" \
|
||||
"refs/remotes/*/$match*" "refs/remotes/*/*/**" 2>/dev/null | uniq -u
|
||||
refs/remotes/ 2>/dev/null | uniq -u
|
||||
end
|
||||
|
||||
function __fish_git_tags
|
||||
@@ -82,7 +87,8 @@ end
|
||||
function __fish_git_heads
|
||||
set -l gitdir (__fish_git rev-parse --git-dir 2>/dev/null)
|
||||
or return # No git dir, no need to even test.
|
||||
for head in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD
|
||||
for head in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD REVERT_HEAD \
|
||||
CHERRY_PICK_HEAD BISECT_HEAD AUTO_MERGE
|
||||
if test -f $gitdir/$head
|
||||
echo $head
|
||||
end
|
||||
@@ -96,7 +102,35 @@ function __fish_git_refs
|
||||
end
|
||||
|
||||
function __fish_git_remotes
|
||||
__fish_git remote 2>/dev/null
|
||||
# Example of output parsed:
|
||||
# "remote.upstream.url git@github.com:fish-shell/fish-shell.git" -> "upstream\tgit@github.com:fish-shell/fish-shell.git"
|
||||
__fish_git config --get-regexp 'remote\.[a-z]+\.url' | string replace -rf 'remote\.(.*)\.url (.*)' '$1\t$2'
|
||||
end
|
||||
|
||||
set -g __fish_git_extra_recent_commits false
|
||||
set -g __fish_git_unqualified_unique_remote_branches false
|
||||
set -g __fish_git_filter_non_pushable 'string join \n'
|
||||
|
||||
function __fish_git_add_revision_completion
|
||||
set -l c complete -f -c git $argv -n 'not contains -- -- (commandline -xpc)' -ka
|
||||
# The following dynamic, order-preserved (-k) completions will be shown in reverse order (see #9221)
|
||||
$c "(__fish_git_recent_commits \$(
|
||||
if $__fish_git_extra_recent_commits
|
||||
begin
|
||||
echo HEAD
|
||||
git for-each-ref --sort=-committerdate --format='%(refname)' 2>/dev/null \
|
||||
refs/tags refs/heads
|
||||
end | string join ' '
|
||||
end
|
||||
) | $__fish_git_filter_non_pushable)"
|
||||
$c "(__fish_git_tags)" -d Tag
|
||||
$c "(__fish_git_heads | $__fish_git_filter_non_pushable)" -d Head
|
||||
$c "(__fish_git_remotes | $__fish_git_filter_non_pushable)" -d 'Remote alias'
|
||||
$c "(__fish_git_remote_branches | $__fish_git_filter_non_pushable)"
|
||||
if $__fish_git_unqualified_unique_remote_branches
|
||||
$c "(__fish_git_unique_remote_branches | $__fish_git_filter_non_pushable)" -d 'Unique Remote Branch'
|
||||
end
|
||||
$c "(__fish_git_local_branches)" -d 'Local Branch'
|
||||
end
|
||||
|
||||
function __fish_git_files
|
||||
@@ -647,6 +681,7 @@ function __fish_git_aliased_command
|
||||
end
|
||||
end
|
||||
|
||||
set -g __fish_git_aliases
|
||||
git config -z --get-regexp 'alias\..*' | while read -lz alias cmdline
|
||||
set -l command (__fish_git_aliased_command $cmdline)
|
||||
string match -q --regex '\w+' -- $command; or continue
|
||||
@@ -784,7 +819,7 @@ end
|
||||
|
||||
# Suggest branches for the specified remote - returns 1 if no known remote is specified
|
||||
function __fish_git_branch_for_remote
|
||||
set -l remotes (__fish_git_remotes)
|
||||
set -l remotes (__fish_git remote 2>/dev/null)
|
||||
set -l remote
|
||||
set -l cmd (commandline -xpc)
|
||||
for r in $remotes
|
||||
@@ -1034,7 +1069,7 @@ complete -f -c git -n '__fish_git_using_command fetch' -l shallow-since -d 'Deep
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -l shallow-exclude -d 'Deepen history of shallow clone, excluding rev'
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -l unshallow -d 'Convert to a complete repository'
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -l refetch -d 'Re-fetch without negotiating common commits'
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -l negotiation-tip -d 'Only report commits reachable from these tips' -kxa '(__fish_git_commits; __fish_git_branches)'
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command fetch' -l negotiation-tip -d 'Only report commits reachable from these tips' -x
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -l negotiate-only -d "Don't fetch, only show commits in common with the server"
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -l filter -ra '(__fish_git_filters)' -d 'Request a subset of objects from server'
|
||||
|
||||
@@ -1087,10 +1122,8 @@ complete -f -c git -n "__fish_git_using_command remote" -n "__fish_seen_subcomma
|
||||
|
||||
### show
|
||||
complete -f -c git -n __fish_git_needs_command -a show -d 'Show the last commit of a branch'
|
||||
complete -f -c git -n '__fish_git_using_command show' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_branches)'
|
||||
complete -f -c git -n '__fish_git_using_command show' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_tags)' -d Tag
|
||||
complete -f -c git -n '__fish_git_using_command show' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_commits)'
|
||||
complete -f -c git -n '__fish_git_using_command show' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_complete_stashes)'
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command show'
|
||||
complete -f -c git -n __fish_git_needs_rev_files -n 'not contains -- -- (commandline -xpc)' -xa '(__fish_git_complete_rev_files)'
|
||||
complete -F -c git -n '__fish_git_using_command show' -n 'contains -- -- (commandline -xpc)'
|
||||
complete -f -c git -n '__fish_git_using_command show' -l format -d 'Pretty-print the contents of the commit logs in a given format' -a '(__fish_git_show_opt format)'
|
||||
@@ -1179,13 +1212,12 @@ complete -c git -n '__fish_git_using_command am' -l show-current-patch -a 'diff
|
||||
### checkout
|
||||
complete -F -c git -n '__fish_git_using_command checkout' -n 'contains -- -- (commandline -xpc)'
|
||||
complete -f -c git -n __fish_git_needs_command -a checkout -d 'Checkout and switch to a branch'
|
||||
begin
|
||||
set -lx __fish_git_extra_recent_commits true
|
||||
set -lx __fish_git_unqualified_unique_remote_branches true
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command checkout'
|
||||
end
|
||||
|
||||
# The following dynamic, order-preserved (-k) completions will be shown in reverse order (see #9221)
|
||||
complete -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_recent_commits --all)'
|
||||
complete -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_tags)' -d Tag
|
||||
complete -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_heads)' -d Head
|
||||
complete -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_unique_remote_branches)' -d 'Unique Remote Branch'
|
||||
complete -f -c git -n '__fish_git_using_command checkout' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_branches)'
|
||||
# In the presence of changed files, `git checkout ...` assumes highest likelihood is intent to restore so this comes last (aka shown first).
|
||||
complete -f -c git -n '__fish_git_using_command checkout' -ka '(__fish_git_files modified deleted modified-staged-deleted)'
|
||||
|
||||
@@ -1422,9 +1454,7 @@ complete -x -c git -n '__fish_git_using_command daemon' -l access-hook -d 'Hook
|
||||
|
||||
### describe
|
||||
complete -c git -n __fish_git_needs_command -a describe -d 'Give an object a human readable name'
|
||||
complete -f -c git -n '__fish_git_using_command describe' -ka '(__fish_git_tags)' -d Tag
|
||||
complete -f -c git -n '__fish_git_using_command describe' -ka '(__fish_git_branches)'
|
||||
complete -f -c git -n '__fish_git_using_command describe' -ka '(__fish_git_heads)' -d Head
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command describe'
|
||||
complete -f -c git -n '__fish_git_using_command describe' -l dirty -d 'Describe the state of the working tree, append dirty if there are local changes'
|
||||
complete -f -c git -n '__fish_git_using_command describe' -l broken -d 'Describe the state of the working tree, append -broken instead of erroring'
|
||||
complete -f -c git -n '__fish_git_using_command describe' -l all -d 'Use all tags, not just annotated'
|
||||
@@ -1444,7 +1474,10 @@ complete -f -c git -n '__fish_git_using_command describe' -l first-parent -d 'Fo
|
||||
complete -c git -n __fish_git_needs_command -a diff -d 'Show changes between commits and working tree'
|
||||
complete -c git -n '__fish_git_using_command diff' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_ranges)'
|
||||
complete -c git -n '__fish_git_using_command diff' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_complete_stashes)'
|
||||
complete -c git -n '__fish_git_using_command diff' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_recent_commits --all)'
|
||||
begin
|
||||
set -lx __fish_git_extra_recent_commits true
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command diff'
|
||||
end
|
||||
complete -c git -n '__fish_git_using_command diff' -l cached -d 'Show diff of changes in the index'
|
||||
complete -c git -n '__fish_git_using_command diff' -l staged -d 'Show diff of changes in the index'
|
||||
complete -c git -n '__fish_git_using_command diff' -l no-index -d 'Compare two paths on the filesystem'
|
||||
@@ -1775,7 +1808,7 @@ complete -f -c git -n '__fish_git_using_command maintenance' -l schedule -d 'Run
|
||||
|
||||
### merge
|
||||
complete -f -c git -n __fish_git_needs_command -a merge -d 'Join multiple development histories'
|
||||
complete -f -c git -n '__fish_git_using_command merge' -ka '(__fish_git_branches)'
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command merge'
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l commit -d "Autocommit the merge"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l no-commit -d "Don't autocommit the merge"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -s e -l edit -d 'Edit auto-generated merge message'
|
||||
@@ -1811,7 +1844,7 @@ complete -f -c git -n '__fish_git_using_command merge' -l no-autostash -d 'Do no
|
||||
|
||||
### merge-base
|
||||
complete -f -c git -n __fish_git_needs_command -a merge-base -d 'Find a common ancestor for a merge'
|
||||
complete -f -c git -n '__fish_git_using_command merge-base' -ka '(__fish_git_branches)'
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command merge-base'
|
||||
complete -f -c git -n '__fish_git_using_command merge-base' -s a -l all -d 'Output all merge bases for the commits, instead of just one'
|
||||
complete -f -c git -n '__fish_git_using_command merge-base' -l octopus -d 'Compute the best common ancestors of all supplied commits'
|
||||
complete -f -c git -n '__fish_git_using_command merge-base' -l independent -d 'Print a minimal subset of the supplied commits with the same ancestors'
|
||||
@@ -1929,9 +1962,11 @@ complete -f -c git -n '__fish_git_using_command range-diff' -l no-dual-color -d
|
||||
### push
|
||||
complete -f -c git -n __fish_git_needs_command -a push -d 'Push changes elsewhere'
|
||||
complete -f -c git -n '__fish_git_using_command push' -n 'not __fish_git_branch_for_remote' -a '(__fish_git_remotes)' -d 'Remote alias'
|
||||
complete -f -c git -n '__fish_git_using_command push' -n __fish_git_branch_for_remote -ka '(__fish_git_tags)' -d Tag
|
||||
complete -f -c git -n '__fish_git_using_command push' -n __fish_git_branch_for_remote -ka '(__fish_git_branches)'
|
||||
complete -f -c git -n '__fish_git_using_command push' -n __fish_git_branch_for_remote -ka '(__fish_git_heads)'
|
||||
begin
|
||||
# TODO
|
||||
set -lx __fish_git_filter_non_pushable 'string replace -r "(\t.*)?\$" ":\$1"'
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command push' -n __fish_git_branch_for_remote
|
||||
end
|
||||
# The "refspec" here is an optional "+" to signify a force-push
|
||||
complete -f -c git -n '__fish_git_using_command push' -n __fish_git_branch_for_remote -n 'string match -q "+*" -- (commandline -ct)' -ka '+(__fish_git_branches | string replace -r \t".*" "")' -d 'Force-push branch'
|
||||
# git push REMOTE :BRANCH deletes BRANCH on remote REMOTE
|
||||
@@ -1958,11 +1993,7 @@ complete -f -c git -n '__fish_git_using_command push' -l progress -d 'Force prog
|
||||
|
||||
### rebase
|
||||
complete -f -c git -n __fish_git_needs_command -a rebase -d 'Reapply commit sequence on a new base'
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_remotes)' -d 'Remote alias'
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -ka '(__fish_git_branches)'
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_heads)' -d Head
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -ka '(__fish_git_tags)' -d Tag -k
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_recent_commits)' -k
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command rebase'
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l continue -d 'Restart the rebasing process'
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l abort -d 'Abort the rebase operation'
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -n __fish_git_is_rebasing -l edit-todo -d 'Edit the todo list'
|
||||
@@ -1987,7 +2018,7 @@ complete -f -c git -n '__fish_git_using_command rebase' -l no-autosquash -d 'No
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -l autostash -d 'Before starting rebase, stash local changes, and apply stash when done'
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -l no-autostash -d 'Do not stash local changes before starting rebase'
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -l no-ff -d 'No fast-forward'
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -l onto -d 'Rebase current branch onto given upstream or newbase' -ka '(__fish_git_branches)'
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command rebase' -l onto -d 'Rebase current branch onto given upstream or newbase' -r
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -l update-refs -d 'Update any branches that point to commits being rebased'
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -l no-update-refs -d 'Don\'t update any branches that point to commits being rebased'
|
||||
# This actually takes script for $SHELL, but completing that is... complicated.
|
||||
@@ -2006,7 +2037,7 @@ complete -c git -n __fish_git_needs_command -a reset -d 'Reset current HEAD to t
|
||||
complete -f -c git -n '__fish_git_using_command reset' -l hard -d 'Reset the index and the working tree'
|
||||
complete -f -c git -n '__fish_git_using_command reset' -l soft -d 'Reset head without touching the index or the working tree'
|
||||
complete -f -c git -n '__fish_git_using_command reset' -l mixed -d 'The default: reset the index but not the working tree'
|
||||
complete -c git -n '__fish_git_using_command reset' -n 'not contains -- -- (commandline -xpc)' -ka '(__fish_git_branches)'
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command reset'
|
||||
# reset can either undo changes to versioned modified files,
|
||||
# or remove files from the staging area.
|
||||
# Deleted files seem to need a "--" separator.
|
||||
@@ -2038,7 +2069,10 @@ complete -f -c git -n '__fish_git_using_command switch' -ka '(__fish_git_unique_
|
||||
complete -f -c git -n '__fish_git_using_command switch' -ka '(__fish_git_branches)'
|
||||
complete -f -c git -n '__fish_git_using_command switch' -s c -l create -d 'Create a new branch'
|
||||
complete -f -c git -n '__fish_git_using_command switch' -s C -l force-create -d 'Force create a new branch'
|
||||
complete -f -c git -n '__fish_git_using_command switch' -s d -l detach -rka '(__fish_git_recent_commits --all)'
|
||||
begin
|
||||
set -lx __fish_git_extra_recent_commits true
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command switch' -s d -l detach -r
|
||||
end
|
||||
complete -f -c git -n '__fish_git_using_command switch' -s d -l detach -d 'Switch to a commit for inspection and discardable experiment' -rka '(__fish_git_refs)'
|
||||
complete -f -c git -n '__fish_git_using_command switch' -l guess -d 'Guess branch name from remote branch (default)'
|
||||
complete -f -c git -n '__fish_git_using_command switch' -l no-guess -d 'Do not guess branch name from remote branch'
|
||||
@@ -2063,9 +2097,7 @@ complete -f -c git -n __fish_git_needs_command -a rev-list -d 'List commits in c
|
||||
|
||||
### rev-parse
|
||||
complete -f -c git -n __fish_git_needs_command -a rev-parse -d 'Parse revision names or give repo information'
|
||||
complete -f -c git -n '__fish_git_using_command rev-parse' -ka '(__fish_git_branches)'
|
||||
complete -f -c git -n '__fish_git_using_command rev-parse' -a '(__fish_git_heads)' -d Head
|
||||
complete -c git -n '__fish_git_using_command rev-parse' -ka '(__fish_git_tags)' -d Tag
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command rev-parse'
|
||||
complete -c git -n '__fish_git_using_command rev-parse' -l abbrev-ref -d 'Output non-ambiguous short object names'
|
||||
|
||||
### revert
|
||||
@@ -2115,7 +2147,7 @@ complete -f -c git -n '__fish_git_using_command stripspace' -s c -l comment-line
|
||||
|
||||
### tag
|
||||
complete -f -c git -n __fish_git_needs_command -a tag -d 'Create, list, delete or verify a tag object signed with GPG'
|
||||
complete -f -c git -n '__fish_git_using_command tag' -n '__fish_not_contain_opt -s d' -n '__fish_not_contain_opt -s v' -n 'test (count (commandline -xpc | string match -r -v \'^-\')) -eq 3' -ka '(__fish_git_branches)'
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command tag' -n '__fish_not_contain_opt -s d' -n '__fish_not_contain_opt -s v' -n 'test (count (commandline -xpc | string match -r -v \'^-\')) -eq 3'
|
||||
complete -f -c git -n '__fish_git_using_command tag' -s a -l annotate -d 'Make an unsigned, annotated tag object'
|
||||
complete -f -c git -n '__fish_git_using_command tag' -s s -l sign -d 'Make a GPG-signed tag'
|
||||
complete -f -c git -n '__fish_git_using_command tag' -s d -l delete -d 'Remove a tag'
|
||||
@@ -2176,11 +2208,10 @@ complete -f -c git -n "__fish_git_using_command worktree" -n "not __fish_seen_su
|
||||
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add move remove' -s f -l force -d 'Override safeguards'
|
||||
|
||||
complete -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add'
|
||||
complete -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -ka '(__fish_git_branches)'
|
||||
complete -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -ka '(__fish_git_heads)' -d Head
|
||||
complete -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -ka '(__fish_git_tags)' -d Tag
|
||||
complete -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -ka '(__fish_git_unique_remote_branches)' -d 'Unique Remote Branch'
|
||||
complete -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -ka '(__fish_git_local_branches)'
|
||||
begin
|
||||
set -lx __fish_git_unqualified_unique_remote_branches true
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add'
|
||||
end
|
||||
complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -s b -d 'Create a new branch'
|
||||
complete -x -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -s B -d 'Create a new branch even if it already exists'
|
||||
complete -f -c git -n '__fish_git_using_command worktree' -n '__fish_seen_subcommand_from add' -l detach -d 'Detach HEAD in the new working tree'
|
||||
@@ -2216,11 +2247,7 @@ complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_u
|
||||
complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a branch -d 'Create a new branch from a stash'
|
||||
complete -f -c git -n '__fish_git_using_command stash' -n __fish_git_stash_not_using_subcommand -a push -d 'Create a new stash with given files'
|
||||
|
||||
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command apply' -ka '(__fish_git_complete_stashes)'
|
||||
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command branch' -ka '(__fish_git_complete_stashes)'
|
||||
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command drop' -ka '(__fish_git_complete_stashes)'
|
||||
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command pop' -ka '(__fish_git_complete_stashes)'
|
||||
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command show' -ka '(__fish_git_complete_stashes)'
|
||||
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command apply branch drop pop show' -ka '(__fish_git_complete_stashes)'
|
||||
|
||||
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command push' -a '(__fish_git_files modified deleted modified-staged-deleted)'
|
||||
complete -f -c git -n '__fish_git_using_command stash' -n '__fish_git_stash_using_command push' -s a -l all -d 'Stash ignored and untracked files'
|
||||
@@ -2237,7 +2264,7 @@ complete -f -c git -n __fish_git_needs_command -a config -d 'Set and read git co
|
||||
|
||||
### format-patch
|
||||
complete -f -c git -n __fish_git_needs_command -a format-patch -d 'Generate patch series to send upstream'
|
||||
complete -f -c git -n '__fish_git_using_command format-patch' -ka '(__fish_git_branches)'
|
||||
__fish_git_add_revision_completion -n '__fish_git_using_command format-patch'
|
||||
complete -c git -n '__fish_git_using_command format-patch' -s o -l output-directory -xa '(__fish_complete_directories)'
|
||||
complete -f -c git -n '__fish_git_using_command format-patch' -s p -l no-stat -d "Generate plain patches without diffstat"
|
||||
complete -f -c git -n '__fish_git_using_command format-patch' -s s -l no-patch -d "Suppress diff output"
|
||||
@@ -2599,3 +2626,8 @@ for file in (path filter -xZ $PATH/git-* | path basename)
|
||||
complete -c git -f -n "__fish_git_using_command $cmd" -a "(__fish_git_complete_custom_command $cmd)"
|
||||
set -a __fish_git_custom_commands_completion $file
|
||||
end
|
||||
|
||||
functions --erase __fish_git_add_revision_completion
|
||||
set -eg __fish_git_extra_recent_commits
|
||||
set -eg __fish_git_unqualified_unique_remote_branches
|
||||
set -eg __fish_git_filter_non_pushable
|
||||
|
||||
@@ -260,10 +260,12 @@ function __fish_complete_ip
|
||||
case address
|
||||
# We're still _on_ the second word, which is the subcommand
|
||||
if not set -q cmd[3]
|
||||
printf '%s\t%s\n' add "Add new protocol address" \
|
||||
printf '%s\t%s\n' \
|
||||
add "Add new protocol address" \
|
||||
delete "Delete protocol address" \
|
||||
show "Look at protocol addresses" \
|
||||
flush "Flush protocol addresses"
|
||||
flush "Flush protocol addresses" \
|
||||
help "Display help"
|
||||
else
|
||||
switch $cmd[2]
|
||||
# Change and replace are undocumented (apart from mentions in the BNF)
|
||||
@@ -339,7 +341,8 @@ function __fish_complete_ip
|
||||
end
|
||||
case link
|
||||
if not set -q cmd[3]
|
||||
printf '%s\t%s\n' add "Add virtual link" \
|
||||
printf '%s\t%s\n' \
|
||||
add "Add virtual link" \
|
||||
delete "Delete virtual link" \
|
||||
set "Change device attributes" \
|
||||
show "Display device attributes" \
|
||||
@@ -430,18 +433,20 @@ function __fish_complete_ip
|
||||
end
|
||||
case show
|
||||
case help
|
||||
__fish_ip_types
|
||||
end
|
||||
end
|
||||
case neighbour
|
||||
if not set -q cmd[3]
|
||||
printf '%s\t%s\n' help "Show help" \
|
||||
printf '%s\t%s\n' \
|
||||
add "Add new neighbour entry" \
|
||||
delete "Delete neighbour entry" \
|
||||
change "Change neighbour entry" \
|
||||
replace "Add or change neighbour entry" \
|
||||
show "List neighbour entries" \
|
||||
flush "Flush neighbour entries" \
|
||||
get "Lookup neighbour entry"
|
||||
get "Lookup neighbour entry" \
|
||||
help "Display help"
|
||||
else
|
||||
switch $cmd[2]
|
||||
case add del delete change replace
|
||||
@@ -505,7 +510,8 @@ function __fish_complete_ip
|
||||
get "Get a single route" \
|
||||
save "Save routing table to stdout" \
|
||||
showdump "Show saved routing table from stdin" \
|
||||
restore "Restore routing table from stdin"
|
||||
restore "Restore routing table from stdin" \
|
||||
help "Display help"
|
||||
else
|
||||
# TODO: switch on $cmd[2] and complete subcommand specific arguments
|
||||
# for now just complete most useful arguments for the last token
|
||||
@@ -524,7 +530,8 @@ function __fish_complete_ip
|
||||
flush "Flush rules" \
|
||||
show "List rules" \
|
||||
save "Save rules to stdout" \
|
||||
restore "Restore rules from stdin"
|
||||
restore "Restore rules from stdin" \
|
||||
help "Display help"
|
||||
else
|
||||
# TODO: switch on $cmd[2] and complete subcommand specific arguments
|
||||
# for now just complete most useful arguments for the last token
|
||||
@@ -579,6 +586,27 @@ function __fish_complete_ip
|
||||
end
|
||||
end
|
||||
end
|
||||
case tuntap
|
||||
if not set -q cmd[3]
|
||||
printf '%s\t%s\n' \
|
||||
add "Add a new tun or tap device" \
|
||||
del "Delete a tun or tap device" \
|
||||
show "Show tun and tap devices" \
|
||||
help "Display help"
|
||||
else
|
||||
switch $cmd[-2]
|
||||
case dev
|
||||
__fish_ip_device
|
||||
case mode
|
||||
printf '%s\n' tun tap
|
||||
case user
|
||||
__fish_complete_users
|
||||
case group
|
||||
__fish_complete_groups
|
||||
case '*'
|
||||
printf '%s\n' dev mode user group one_queue pi vnet_hdr multi_queue name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Keybase 5.6.1
|
||||
# Keybase 6.4.0
|
||||
|
||||
function __fish_keybase_line_ends_with
|
||||
set -l line (commandline -pxc | string match -v -r '^-')
|
||||
@@ -9,123 +9,132 @@ function __fish_keybase_line_ends_with
|
||||
end
|
||||
end
|
||||
|
||||
#variables
|
||||
# variables
|
||||
set -l ends __fish_keybase_line_ends_with
|
||||
set -l seen __fish_seen_subcommand_from
|
||||
#L1
|
||||
set -l keybase account blocks bot chat config ctl currency decrypt deprovision device encrypt follow fs git h help id kvstore list-followers list-following log login logout oneshot paperkey passphrase pgp ping prove rekey selfprovision service sign signup sigs status team track unfollow untrack update verify version wallet whoami
|
||||
#L2
|
||||
set -l keybase_account contact-settings delete email h help lockdown recover-username upload-avatar
|
||||
set -l keybase_blocks h help list-users list-teams
|
||||
# 1
|
||||
set -l keybase account apicall audit base62 blocks bot btc ca chat config ctl currency db decrypt deprovision device dir dismiss dismiss-category dump-keyfamily dump-push-notifications encrypt fnmr follow fs git h help home id interesting-people kvstore list-followers list-following log login logout network-stats oneshot paperkey passphrase pgp ping pprof prove push rekey riit script selfprovision service sign signup sigs status team track unfollow unlock untrack upak update upload-avatar verify version wallet web-auth-token whoami wot
|
||||
# 2
|
||||
set -l keybase_account contact-settings delete email h help lockdown phonenumber recover-username reset-cancel upload-avatar
|
||||
set -l keybase_audit box h help
|
||||
set -l keybase_base62 decode encode h help
|
||||
set -l keybase_blocks h help list-teams list-users
|
||||
set -l keybase_bot h help signup token
|
||||
set -l keybase_chat add-bot-member add-to-channel api api-listen bot-member-settings clear-commands conv-info create-channel default-channels delete-channel delete-history download edit-bot-member featured-bots h help hide join-channel leave-channel list list-channels list-members list-unread ls lsur min-writer-role mute notification-settings read readd-member remove-bot-member rename-channel report retention-policy search search-bots search-regexp send upload
|
||||
set -l keybase_chat add-bot-member add-to-channel api api-listen archive archive-delete archive-list archive-pause archive-resume bot-member-settings clear-commands conv-info create-channel default-channels delete-channel delete-history download edit-bot-member emoji-add emoji-addalias emoji-list emoji-remove featured-bots forward-message h help hide join-channel leave-channel list list-channels list-members list-unread ls lsur mark-as-read min-writer-role mute notification-settings read readd-member remove-bot-member remove-from-channel rename-channel report retention-policy search search-bots search-regexp send upload
|
||||
set -l keybase_config get h help info set
|
||||
set -l keybase_ctl app-exit autostart h help init log-rotate redirector reload restart start stop wait watchdog watchdog2
|
||||
set -l keybase_ctl app-exit autostart h help init log-rotate redirector reload restart start stop wait wants-systemd watchdog watchdog2
|
||||
set -l keybase_currency add h help
|
||||
set -l keybase_db clean delete get h help keys-with-prefix nuke put
|
||||
set -l keybase_device add h help list remove
|
||||
set -l keybase_fs clear-conflicts cp debug finish-resolving-conflicts get-status h help history kill ln ls mkdir mv ps quota read recover reset rm set-debug-level stat sync uploads write
|
||||
set -l keybase_git create delete gc h help lfs-config list settings
|
||||
set -l keybase_fs archive cancel-uploads clear-conflicts cp debug finish-resolving-conflicts get-status h help history index-progress kill ln ls mkdir mv ps quota read recover reset reset-index rm search set-debug-level stat sync uploads write
|
||||
set -l keybase_git archive create delete gc h help lfs-config list settings
|
||||
set -l keybase_help advanced gpg keyring tor
|
||||
set -l keybase_kvstore api h help
|
||||
set -l keybase_log h help send
|
||||
set -l keybase_log h help profile send
|
||||
set -l keybase_passphrase change check h help recover remember set
|
||||
set -l keybase_pgp decrypt drop encrypt export gen h help import list pull pull-private purge push-private select sign update verify
|
||||
set -l keybase_pprof cpu h heap help trace
|
||||
set -l keybase_rekey h help paper status
|
||||
set -l keybase_sigs h help list revoke
|
||||
set -l keybase_team accept-invite add-member add-members-bulk api bot-settings create delete edit-member h help ignore-request leave list-members list-memberships list-requests remove-member rename request-access search settings show-tree
|
||||
set -l keybase_team accept-invite add-member add-members-bulk api bot-settings create delete edit-member ftl generate-invite-token generate-invitelink h help ignore-request leave list-members list-memberships list-requests profile-load remove-member rename request-access search settings show-tree
|
||||
set -l keybase_update check check-in-use notify
|
||||
set -l keybase_wallet accounts add-trustline api asset-search balances cancel cancel-request change-trustline-limit delete-trustline detail details export get-inflation get-started h help history import list lookup merge popular-assets reclaim rename request send send-path-payment set-currency set-inflation set-primary sign
|
||||
#L3
|
||||
set -l keybase_wallet accounts balances detail details export h help list
|
||||
set -l keybase_wot accept h help list reject vouch
|
||||
# 3
|
||||
set -l keybase_account_email add delete edit h help list send-verification-email set-primary set-visibility
|
||||
set -l keybase_account_phonenumber add delete edit h help list set-visibility verify
|
||||
set -l keybase_bot_token create delete h help list
|
||||
set -l keybase_fs_archive cancel check check dismiss h help start status
|
||||
set -l keybase_fs_debug deobfuscate dump h help obfuscate
|
||||
set -l keybase_fs_sync disable enable h help show
|
||||
#...
|
||||
|
||||
#global options
|
||||
complete -c keybase -f -n "$ends keybase" -l api-dump-unsafe
|
||||
complete -c keybase -f -n "$ends keybase" -l api-timeout
|
||||
complete -c keybase -f -n "$ends keybase" -l api-uri-path-prefix
|
||||
complete -c keybase -f -n "$ends keybase" -l app-start-mode
|
||||
complete -c keybase -f -n "$ends keybase" -l auto-fork
|
||||
complete -c keybase -f -n "$ends keybase" -l bg-identifier-disabled
|
||||
complete -c keybase -f -n "$ends keybase" -l chat-db
|
||||
complete -c keybase -f -n "$ends keybase" -l code-signing-kids
|
||||
complete -c keybase -f -n "$ends keybase" -l config-file -s c
|
||||
complete -c keybase -f -n "$ends keybase" -l db
|
||||
complete -c keybase -f -n "$ends keybase" -l debug -s d
|
||||
complete -c keybase -f -n "$ends keybase" -l debug-journeycard
|
||||
complete -c keybase -f -n "$ends keybase" -l disable-bg-conv-loader
|
||||
complete -c keybase -f -n "$ends keybase" -l disable-cert-pinning
|
||||
complete -c keybase -f -n "$ends keybase" -l disable-merkle-auditor
|
||||
complete -c keybase -f -n "$ends keybase" -l disable-search-indexer
|
||||
complete -c keybase -f -n "$ends keybase" -l disable-team-auditor
|
||||
complete -c keybase -f -n "$ends keybase" -l disable-team-box-auditor
|
||||
complete -c keybase -f -n "$ends keybase" -l display-raw-untrusted-output
|
||||
complete -c keybase -f -n "$ends keybase" -l ek-log-file
|
||||
complete -c keybase -f -n "$ends keybase" -l enable-bot-lite-mode
|
||||
complete -c keybase -f -n "$ends keybase" -l extra-net-logging
|
||||
complete -c keybase -f -n "$ends keybase" -l features
|
||||
complete -c keybase -f -n "$ends keybase" -l force-linux-keyring
|
||||
complete -c keybase -f -n "$ends keybase" -l generate-bash-completion
|
||||
complete -c keybase -f -n "$ends keybase" -l gpg
|
||||
complete -c keybase -f -n "$ends keybase" -l gpg-options
|
||||
complete -c keybase -f -n "$ends keybase" -l gpgdir
|
||||
complete -c keybase -f -n "$ends keybase" -l gui-config-file
|
||||
complete -c keybase -f -n "$ends keybase" -l help -s h
|
||||
complete -c keybase -f -n "$ends keybase" -l home -s H
|
||||
complete -c keybase -f -n "$ends keybase" -l leveldb-num-files
|
||||
complete -c keybase -f -n "$ends keybase" -l local-rpc-debug-unsafe
|
||||
complete -c keybase -f -n "$ends keybase" -l log-file
|
||||
complete -c keybase -f -n "$ends keybase" -l log-format
|
||||
complete -c keybase -f -n "$ends keybase" -l log-prefix
|
||||
complete -c keybase -f -n "$ends keybase" -l merkle-kids
|
||||
complete -c keybase -f -n "$ends keybase" -l no-auto-fork -s F
|
||||
complete -c keybase -f -n "$ends keybase" -l no-debug
|
||||
complete -c keybase -f -n "$ends keybase" -l paramproof-kit
|
||||
complete -c keybase -f -n "$ends keybase" -l pgpdir
|
||||
complete -c keybase -f -n "$ends keybase" -l pid-file
|
||||
complete -c keybase -f -n "$ends keybase" -l pinentry
|
||||
complete -c keybase -f -n "$ends keybase" -l proof-cache-size
|
||||
complete -c keybase -f -n "$ends keybase" -l prove-bypass
|
||||
complete -c keybase -f -n "$ends keybase" -l proxy
|
||||
complete -c keybase -f -n "$ends keybase" -l proxy-type
|
||||
complete -c keybase -f -n "$ends keybase" -l push-disabled
|
||||
complete -c keybase -f -n "$ends keybase" -l push-save-interval
|
||||
complete -c keybase -f -n "$ends keybase" -l push-server-uri
|
||||
complete -c keybase -f -n "$ends keybase" -l pvl-kit
|
||||
complete -c keybase -f -n "$ends keybase" -l read-deleted-sigchain
|
||||
complete -c keybase -f -n "$ends keybase" -l remember-passphrase
|
||||
complete -c keybase -f -n "$ends keybase" -l run-mode
|
||||
complete -c keybase -f -n "$ends keybase" -l scraper-timeout
|
||||
complete -c keybase -f -n "$ends keybase" -l secret-keyring
|
||||
complete -c keybase -f -n "$ends keybase" -l server -s s
|
||||
complete -c keybase -f -n "$ends keybase" -l session-file
|
||||
complete -c keybase -f -n "$ends keybase" -l slow-gregor-conn
|
||||
complete -c keybase -f -n "$ends keybase" -l socket-file
|
||||
complete -c keybase -f -n "$ends keybase" -l standalone
|
||||
complete -c keybase -f -n "$ends keybase" -l timers
|
||||
complete -c keybase -f -n "$ends keybase" -l tor-hidden-address
|
||||
complete -c keybase -f -n "$ends keybase" -l tor-mode
|
||||
complete -c keybase -f -n "$ends keybase" -l tor-proxy
|
||||
complete -c keybase -f -n "$ends keybase" -l updater-config-file
|
||||
complete -c keybase -f -n "$ends keybase" -l use-default-log-file
|
||||
complete -c keybase -f -n "$ends keybase" -l use-root-config-file
|
||||
complete -c keybase -f -n "$ends keybase" -l user-cache-size
|
||||
complete -c keybase -f -n "$ends keybase" -l vdebug
|
||||
complete -c keybase -f -n "$ends keybase" -l version -s v
|
||||
# global options
|
||||
complete -c keybase -f -n "$ends keybase" -l api-dump-unsafe -d "Dump API call internals (may leak secrets)"
|
||||
complete -c keybase -f -n "$ends keybase" -l api-timeout -d "Set the HTTP timeout for API calls to the keybase API server"
|
||||
complete -c keybase -f -n "$ends keybase" -l api-uri-path-prefix -d "Specify an alternate API URI path prefix"
|
||||
complete -c keybase -f -n "$ends keybase" -l app-start-mode -d "Specify 'service' to auto-start UI app, or anything else to disable"
|
||||
complete -c keybase -f -n "$ends keybase" -l auto-fork -d "Enable auto-fork of background service"
|
||||
complete -c keybase -f -n "$ends keybase" -l bg-identifier-disabled -d "Supply to disable the BG identifier loop"
|
||||
complete -c keybase -f -n "$ends keybase" -l chat-db -d "Specify an alternate local Chat DB location"
|
||||
complete -c keybase -f -n "$ends keybase" -l code-signing-kids -d "Set of code signing key IDs (colon-separated)"
|
||||
complete -c keybase -f -n "$ends keybase" -l config-file -s c -d "Specify an (alternate) master config file"
|
||||
complete -c keybase -f -n "$ends keybase" -l db -d "Specify an alternate local DB location"
|
||||
complete -c keybase -f -n "$ends keybase" -l debug -s d -d "Enable debugging mode"
|
||||
complete -c keybase -f -n "$ends keybase" -l debug-journeycard -d "Enable experimental journey cards"
|
||||
complete -c keybase -f -n "$ends keybase" -l disable-bg-conv-loader -d "Disable background conversation loading"
|
||||
complete -c keybase -f -n "$ends keybase" -l disable-cert-pinning -d "WARNING: Do not use unless necessary!"
|
||||
complete -c keybase -f -n "$ends keybase" -l disable-merkle-auditor -d "Disable background probabilistic merkle audit"
|
||||
complete -c keybase -f -n "$ends keybase" -l disable-search-indexer -d "Disable chat search background indexer"
|
||||
complete -c keybase -f -n "$ends keybase" -l disable-team-auditor -d "Disable auditing of teams"
|
||||
complete -c keybase -f -n "$ends keybase" -l disable-team-box-auditor -d "Disable box auditing of teams"
|
||||
complete -c keybase -f -n "$ends keybase" -l display-raw-untrusted-output -d "Display output from users without escaping terminal codes"
|
||||
complete -c keybase -f -n "$ends keybase" -l ek-log-file -d "Specify a log file for the keybase ephemeral key log"
|
||||
complete -c keybase -f -n "$ends keybase" -l enable-bot-lite-mode -d "Enable bot lite mode. Disables non-critical background services"
|
||||
complete -c keybase -f -n "$ends keybase" -l extra-net-logging -d "Do additional debug logging during network requests"
|
||||
complete -c keybase -f -n "$ends keybase" -l features -d "Specify experimental feature flags"
|
||||
complete -c keybase -f -n "$ends keybase" -l force-linux-keyring -d "Require the use of the OS keyring"
|
||||
complete -c keybase -f -n "$ends keybase" -l generate-bash-completion -d ""
|
||||
complete -c keybase -f -n "$ends keybase" -l gpg -d "Path to GPG client (optional for exporting keys)"
|
||||
complete -c keybase -f -n "$ends keybase" -l gpg-options -d "Options to use when calling GPG"
|
||||
complete -c keybase -f -n "$ends keybase" -l gpgdir -d "Specify a PGP directory (default is ~/.gnupg)"
|
||||
complete -c keybase -f -n "$ends keybase" -l gui-config-file -d "Specify a path to the GUI config file"
|
||||
complete -c keybase -f -n "$ends keybase" -l help -s h -d "Show help"
|
||||
complete -c keybase -f -n "$ends keybase" -l home -s H -d "Specify an (alternate) home directory"
|
||||
complete -c keybase -f -n "$ends keybase" -l leveldb-num-files -d "Specify the max number of files LevelDB may open"
|
||||
complete -c keybase -f -n "$ends keybase" -l local-rpc-debug-unsafe -d "Use to debug local RPC (may leak secrets)"
|
||||
complete -c keybase -f -n "$ends keybase" -l log-file -d "Specify a log file for the keybase service"
|
||||
complete -c keybase -f -n "$ends keybase" -l log-format -d "Log format (default, plain, file, fancy)"
|
||||
complete -c keybase -f -n "$ends keybase" -l log-prefix -d "Specify a prefix for a unique log file name"
|
||||
complete -c keybase -f -n "$ends keybase" -l merkle-kids -d "Set of admissible Merkle Tree fingerprints (colon-separated)"
|
||||
complete -c keybase -f -n "$ends keybase" -l no-auto-fork -s F -d "Disable auto-fork of background service"
|
||||
complete -c keybase -f -n "$ends keybase" -l no-debug -d "Suppress debugging mode; takes precedence over --debug"
|
||||
complete -c keybase -f -n "$ends keybase" -l paramproof-kit -d "Specify an alternate local parameterized proof kit file location"
|
||||
complete -c keybase -f -n "$ends keybase" -l pgpdir -d "Specify a PGP directory (default is ~/.gnupg)"
|
||||
complete -c keybase -f -n "$ends keybase" -l pid-file -d "Location of the keybased pid-file (to ensure only one running daemon)"
|
||||
complete -c keybase -f -n "$ends keybase" -l pinentry -d "Specify a path to find a pinentry program"
|
||||
complete -c keybase -f -n "$ends keybase" -l proof-cache-size -d "Number of proof entries to cache"
|
||||
complete -c keybase -f -n "$ends keybase" -l prove-bypass -d "Prove even disabled proof services"
|
||||
complete -c keybase -f -n "$ends keybase" -l proxy -d "Specify a proxy to ship all Web requests over"
|
||||
complete -c keybase -f -n "$ends keybase" -l proxy-type -d "Set the proxy type; One of: socks,http_connect"
|
||||
complete -c keybase -f -n "$ends keybase" -l push-disabled -d "Disable push server connection (which is on by default)"
|
||||
complete -c keybase -f -n "$ends keybase" -l push-save-interval -d "Set the interval between saves of the push cache (in seconds)"
|
||||
complete -c keybase -f -n "$ends keybase" -l push-server-uri -d "Specify a URI for contacting the Keybase push server"
|
||||
complete -c keybase -f -n "$ends keybase" -l pvl-kit -d "Specify an alternate local PVL kit file location"
|
||||
complete -c keybase -f -n "$ends keybase" -l read-deleted-sigchain -d "Allow admins to read deleted sigchains for debugging"
|
||||
complete -c keybase -f -n "$ends keybase" -l remember-passphrase -d "Remember keybase passphrase"
|
||||
complete -c keybase -f -n "$ends keybase" -l run-mode -d "Run mode (devel, staging, prod)"
|
||||
complete -c keybase -f -n "$ends keybase" -l scraper-timeout -d "Set the HTTP timeout for external proof scrapers"
|
||||
complete -c keybase -f -n "$ends keybase" -l secret-keyring -d "Location of the Keybase secret-keyring (P3SKB-encoded)"
|
||||
complete -c keybase -f -n "$ends keybase" -l server -s s -d "Specify server API"
|
||||
complete -c keybase -f -n "$ends keybase" -l session-file -d "Specify an alternate session data file"
|
||||
complete -c keybase -f -n "$ends keybase" -l slow-gregor-conn -d "Slow responses from gregor for testing"
|
||||
complete -c keybase -f -n "$ends keybase" -l socket-file -d "Location of the keybased socket-file"
|
||||
complete -c keybase -f -n "$ends keybase" -l standalone -d "Use the client without any daemon support"
|
||||
complete -c keybase -f -n "$ends keybase" -l timers -d "Specify 'a' for API; 'r' for RPCs; and 'x' for eXternal API calls"
|
||||
complete -c keybase -f -n "$ends keybase" -l tor-hidden-address -d "Set TOR address of keybase server"
|
||||
complete -c keybase -f -n "$ends keybase" -l tor-mode -d "Set TOR mode to be 'leaky', 'none', or 'strict'"
|
||||
complete -c keybase -f -n "$ends keybase" -l tor-proxy -d "Set TOR proxy; when Tor mode is on; defaults to localhost:9050"
|
||||
complete -c keybase -f -n "$ends keybase" -l updater-config-file -d "Specify a path to the updater config file"
|
||||
complete -c keybase -f -n "$ends keybase" -l use-default-log-file -d "Log to the default log file in $XDG_CACHE_HOME, or ~/.cache if unset"
|
||||
complete -c keybase -f -n "$ends keybase" -l use-root-config-file -d "Use the default root config on Linux only"
|
||||
complete -c keybase -f -n "$ends keybase" -l user-cache-size -d "Number of User entries to cache"
|
||||
complete -c keybase -f -n "$ends keybase" -l vdebug -d "Verbose debugging; takes a comma-joined list of levels and tags"
|
||||
complete -c keybase -f -n "$ends keybase" -l version -s v -d "Print the version"
|
||||
|
||||
#commands
|
||||
#L1
|
||||
# commands
|
||||
# 1
|
||||
complete -c keybase -f -n "not $ends keybase"
|
||||
complete -c keybase -f -n "$ends keybase" -a "$keybase"
|
||||
#L2
|
||||
# 2
|
||||
complete -c keybase -f -n "$ends keybase account" -a "$keybase_account"
|
||||
complete -c keybase -f -n "$ends keybase audit" -a "$keybase_audit"
|
||||
complete -c keybase -f -n "$ends keybase base62" -a "$keybase_base62"
|
||||
complete -c keybase -f -n "$ends keybase blocks" -a "$keybase_blocks"
|
||||
complete -c keybase -f -n "$ends keybase bot" -a "$keybase_bot"
|
||||
complete -c keybase -f -n "$ends keybase chat" -a "$keybase_chat"
|
||||
complete -c keybase -f -n "$ends keybase config" -a "$keybase_config"
|
||||
complete -c keybase -f -n "$ends keybase ctl" -a "$keybase_ctl"
|
||||
complete -c keybase -f -n "$ends keybase currency" -a "$keybase_currency"
|
||||
complete -c keybase -f -n "$ends keybase db" -a "$keybase_db"
|
||||
complete -c keybase -f -n "$ends keybase device" -a "$keybase_device"
|
||||
complete -c keybase -f -n "$ends keybase fs" -a "$keybase_fs"
|
||||
complete -c keybase -f -n "$ends keybase git" -a "$keybase_git"
|
||||
@@ -135,19 +144,22 @@ complete -c keybase -f -n "$ends keybase kvstore" -a "$keybase_kvstore"
|
||||
complete -c keybase -f -n "$ends keybase log" -a "$keybase_log"
|
||||
complete -c keybase -f -n "$ends keybase passphrase" -a "$keybase_passphrase"
|
||||
complete -c keybase -f -n "$ends keybase pgp" -a "$keybase_pgp"
|
||||
complete -c keybase -f -n "$ends keybase pprof" -a "$keybase_pprof"
|
||||
complete -c keybase -f -n "$ends keybase rekey" -a "$keybase_rekey"
|
||||
complete -c keybase -f -n "$ends keybase sigs" -a "$keybase_sigs"
|
||||
complete -c keybase -f -n "$ends keybase team" -a "$keybase_team"
|
||||
complete -c keybase -f -n "$ends keybase update" -a "$keybase_update"
|
||||
complete -c keybase -f -n "$ends keybase wallet" -a "$keybase_wallet"
|
||||
#...
|
||||
#L3
|
||||
complete -c keybase -f -n "$ends keybase wot" -a "$keybase_wot"
|
||||
# 3
|
||||
complete -c keybase -f -n "$ends keybase account email" -a "$keybase_account_email"
|
||||
complete -c keybase -f -n "$ends keybase account phonenumber" -a "$keybase_account_phonenumber"
|
||||
complete -c keybase -f -n "$ends keybase bot token" -a "$keybase_bot_token"
|
||||
complete -c keybase -f -n "$ends keybase fs archive" -a "$keybase_fs_archive"
|
||||
complete -c keybase -f -n "$ends keybase fs debug" -a "$keybase_fs_debug"
|
||||
complete -c keybase -f -n "$ends keybase fs sync" -a "$keybase_fs_sync"
|
||||
#...
|
||||
|
||||
#command options
|
||||
# command options
|
||||
complete -c keybase -f -n "$ends keybase account upload-avatar" -l skip-chat-message -s s
|
||||
complete -c keybase -f -n "$ends keybase account upload-avatar" -l team
|
||||
#...
|
||||
# ...
|
||||
|
||||
@@ -133,7 +133,7 @@ complete -c set -n '__fish_set_is_color true false' -a --dim -x
|
||||
complete -c set -n '__fish_set_is_color true false' -a --italics -x
|
||||
complete -c set -n '__fish_set_is_color true true' -a --reverse -x
|
||||
complete -c set -n '__fish_set_is_color true false' -a --underline -x
|
||||
complete -c set -n '__fish_set_is_color true false' -a --underline=curly -x
|
||||
complete -c set -n '__fish_set_is_color true false' -a--underline={double,curly,dotted,dashed} -x
|
||||
|
||||
# Locale completions
|
||||
complete -c set -n '__fish_set_is_locale; and not __fish_seen_argument -s e -l erase' -x -a '(command -sq locale; and locale -a)' -d Locale
|
||||
|
||||
@@ -5,7 +5,6 @@ complete -c set_color -s o -l bold -d 'Make font bold'
|
||||
complete -c set_color -s i -l italics -d Italicise
|
||||
complete -c set_color -s d -l dim -d 'Dim text'
|
||||
complete -c set_color -s r -l reverse -d 'Reverse color text'
|
||||
complete -c set_color -s u -l underline -d 'Underline style' -a 'single curly'
|
||||
complete -c set_color -s u -l underline -d 'Underline style' -a 'single double curly dotted dashed'
|
||||
complete -c set_color -s h -l help -d 'Display help and exit'
|
||||
complete -c set_color -s c -l print-colors -d 'Print a list of all accepted color names'
|
||||
complete -c set_color -l track -xa '(fish_config theme list)' -d 'Ignored. Used in color variables to follow theme changes'
|
||||
|
||||
@@ -27,9 +27,7 @@ set -l __fish_status_all_commands \
|
||||
list-files \
|
||||
print-stack-trace \
|
||||
stack-trace \
|
||||
test-feature \
|
||||
xtgettcap \
|
||||
xtversion
|
||||
test-feature
|
||||
|
||||
# These are the recognized flags.
|
||||
complete -c status -s h -l help -d "Display help and exit"
|
||||
@@ -66,8 +64,6 @@ complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_com
|
||||
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a get-file -d "Print an embedded file from the fish binary"
|
||||
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a list-files -d "List embedded files contained in the fish binary"
|
||||
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a fish-path -d "Print the path to the current instance of fish"
|
||||
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a xtgettcap -d "Query the terminal for a terminfo capability"
|
||||
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a xtversion -d "Show terminal name and version"
|
||||
|
||||
# The job-control command changes fish state.
|
||||
complete -f -c status -n "not __fish_seen_subcommand_from $__fish_status_all_commands" -a job-control -d "Set which jobs are under job control"
|
||||
|
||||
@@ -1,61 +1,135 @@
|
||||
# completion for tmutil (macOS)
|
||||
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a addexclusion -d 'Add an exclusion not to back up a file'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from addexclusion' -s v -d 'Volume exclusion'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from addexclusion' -s p -d 'Path exclusion'
|
||||
complete -r -c tmutil -n __fish_use_subcommand -a associatedisk -d 'Bind a snapshot volume directory to the specified local disk'
|
||||
complete -r -c tmutil -n __fish_use_subcommand -a calculatedrift -d 'Determine the amount of change between snapshots'
|
||||
complete -r -c tmutil -n __fish_use_subcommand -a compare -d 'Perform a backup diff'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from compare' -s a -d 'Compare all supported metadata'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from compare' -s n -d 'No metadata comparison'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from compare' -s @ -d 'Compare extended attributes'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from compare' -s c -d 'Compare creation times'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from compare' -s d -d 'Compare file data forks'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from compare' -s e -d 'Compare ACLs'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from compare' -s f -d 'Compare file flags'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from compare' -s g -d 'Compare GIDs'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from compare' -s m -d 'Compare file modes'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from compare' -s s -d 'Compare sizes'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from compare' -s t -d 'Compare modification times'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from compare' -s u -d 'Compare UIDs'
|
||||
complete -r -c tmutil -n '__fish_seen_subcommand_from compare' -s D -d 'Limit traversal depth to depth levels from the beginning of iteration'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from compare' -s E -d 'Dont take exclusions into account'
|
||||
complete -r -c tmutil -n '__fish_seen_subcommand_from compare' -s I -d 'Ignore path'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from compare' -s U -d 'Ignore logical volume identity'
|
||||
complete -r -c tmutil -n __fish_use_subcommand -a delete -d 'Delete one or more snapshots'
|
||||
complete -r -c tmutil -n __fish_use_subcommand -a deletelocalsnapshots -d 'Delete all local Time Machine snapshots for the specified date (formatted YYYY-MM-DD-HHMMSS)'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a destinationinfo -d 'Print information about destinations'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a disable -d 'Turn off automatic backups'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a disablelocal -d 'Turn off local Time Machine snapshots'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a enable -d 'Turn on automatic backups'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a enablelocal -d 'Turn on local Time Machine snapshots'
|
||||
complete -r -c tmutil -n __fish_use_subcommand -a inheritbackup -d 'Claim a machine directory or sparsebundle for use by the current machine'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a isexcluded -d 'Determine if a file, directory, or volume are excluded from backups'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a latestbackup -d 'Print the path to the latest snapshot'
|
||||
complete -c tmutil -n __fish_use_subcommand -a listlocalsnapshotdates -d 'List the creation dates of all local Time Machine snapshots'
|
||||
complete -r -c tmutil -n __fish_use_subcommand -a listlocalsnapshots -d 'List local Time Machine snapshots of the specified volume'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a listbackups -d 'Print paths for all snapshots'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a localsnapshot -d 'Create new local Time Machine snapshot of APFS volume in TM backup'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a machinedirectory -d 'Print the path to the current machine directory'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a removedestination -d 'Removes a backup destination'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a removeexclusion -d 'Remove an exclusion'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from removeexclusion' -s v -d 'Volume exclusion'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from removeexclusion' -s p -d 'Path exclusion'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a restore -d 'Restore an item'
|
||||
complete -r -c tmutil -n '__fish_seen_subcommand_from restore' -s v
|
||||
complete -r -c tmutil -n __fish_use_subcommand -a setdestination -d 'Set a backup destination'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from setdestination' -s a -d 'Add to the list of destinations'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from setdestination' -s p -d 'Enter the password at a non-echoing interactive prompt'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a snapshot -d 'Create new local Time Machine snapshot'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a startbackup -d 'Begin a backup if one is not already running'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from startbackup' -s a -l auto -d 'Automatic mode'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from startbackup' -s b -l block -d 'Block until finished'
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from startbackup' -s r -l rotation -d 'Automatic rotation'
|
||||
complete -r -c tmutil -n '__fish_seen_subcommand_from startbackup' -s d -l destination -d 'Backup destination'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a stopbackup -d 'Cancel a backup currently in progress'
|
||||
complete -r -c tmutil -n __fish_use_subcommand -a thinlocalsnapshots -d 'Thin local Time Machine snapshots for the specified volume'
|
||||
complete -r -c tmutil -n __fish_use_subcommand -a uniquesize -d 'Analyze the specified path and determine its unique size'
|
||||
complete -r -c tmutil -n __fish_use_subcommand -a verifychecksums -d 'Verify snapshot'
|
||||
complete -f -c tmutil -n __fish_use_subcommand -a version -d 'Print version'
|
||||
function __fish_tmutil_destination_ids
|
||||
for line in $(tmutil destinationinfo)
|
||||
if string match -q '*===*' -- $line
|
||||
# New section so clear out variables
|
||||
set -f name ''
|
||||
set -f kind ''
|
||||
continue
|
||||
end
|
||||
|
||||
complete -f -c tmutil -n '__fish_seen_subcommand_from destinationinfo isexcluded compare' -s X -d 'Print as XML'
|
||||
if string match -q -r '^Name' -- $line
|
||||
# Got the destination name
|
||||
set -f name "$(string match -r -g '^Name\s+:\s+(.*)$' $line | string trim)"
|
||||
continue
|
||||
end
|
||||
|
||||
if string match -q -r '^Kind' -- $line
|
||||
# Got the destination name
|
||||
set -f kind "$(string match -r -g '^Kind\s+:\s+(\w+)' $line | string trim)"
|
||||
continue
|
||||
end
|
||||
|
||||
if string match -q -r '^ID' -- $line
|
||||
# Got the destination ID
|
||||
set -f ID "$(string match -r -g '^ID\s+:\s+(.*)$' $line | string trim)"
|
||||
echo $ID\t$name $kind
|
||||
continue
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
complete -c tmutil -n __fish_use_subcommand -a status -d 'Display Time Machine status'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from status'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a addexclusion -d 'Add an exclusion not to back up a file'
|
||||
complete -c tmutil -r -n '__fish_seen_subcommand_from addexclusion' -s v -d 'Volume exclusion'
|
||||
complete -c tmutil -r -n '__fish_seen_subcommand_from addexclusion' -s p -d 'Path exclusion'
|
||||
|
||||
complete -c tmutil -r -n __fish_use_subcommand -a associatedisk -d 'Bind a snapshot volume directory to the specified local disk'
|
||||
|
||||
complete -c tmutil -r -n __fish_use_subcommand -a calculatedrift -d 'Determine the amount of change between snapshots'
|
||||
|
||||
complete -c tmutil -r -n __fish_use_subcommand -a compare -d 'Perform a backup diff'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s a -d 'Compare all supported metadata'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s n -d 'No metadata comparison'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s @ -d 'Compare extended attributes'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s c -d 'Compare creation times'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s d -d 'Compare file data forks'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s e -d 'Compare ACLs'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s f -d 'Compare file flags'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s g -d 'Compare GIDs'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s m -d 'Compare file modes'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s s -d 'Compare sizes'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s t -d 'Compare modification times'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s u -d 'Compare UIDs'
|
||||
complete -c tmutil -r -n '__fish_seen_subcommand_from compare' -s D -d 'Limit traversal depth to depth levels from the beginning of iteration'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s E -d 'Dont take exclusions into account'
|
||||
complete -c tmutil -r -n '__fish_seen_subcommand_from compare' -s I -d 'Ignore path'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from compare' -s U -d 'Ignore logical volume identity'
|
||||
|
||||
complete -c tmutil -r -n __fish_use_subcommand -a delete -d 'Delete one or more snapshots'
|
||||
complete -c tmutil -r -n '__fish_seen_subcommand_from delete' -s d -d 'Backup mount point'
|
||||
complete -c tmutil -r -f -n '__fish_seen_subcommand_from delete' -s t -d Timestamp
|
||||
complete -c tmutil -r -n '__fish_seen_subcommand_from delete' -s p -d Path
|
||||
|
||||
complete -c tmutil -r -n __fish_use_subcommand -a deletelocalsnapshots -d 'Delete all local Time Machine snapshots for the specified date (formatted YYYY-MM-DD-HHMMSS)'
|
||||
|
||||
complete -c tmutil -r -n __fish_use_subcommand -a deleteinprogress -d 'Delete all in-progress backups for a machine directory'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a destinationinfo -d 'Print information about destinations'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a disable -d 'Turn off automatic backups'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a disablelocal -d 'Turn off local Time Machine snapshots'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a enable -d 'Turn on automatic backups'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a enablelocal -d 'Turn on local Time Machine snapshots'
|
||||
|
||||
complete -c tmutil -r -n __fish_use_subcommand -a inheritbackup -d 'Claim a machine directory or sparsebundle for use by the current machine'
|
||||
|
||||
complete -c tmutil -r -n __fish_use_subcommand -a isexcluded -d 'Determine if a file, directory, or volume are excluded from backups'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a latestbackup -d 'Print the path to the latest snapshot'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a listlocalsnapshotdates -d 'List the creation dates of all local Time Machine snapshots'
|
||||
|
||||
complete -c tmutil -r -n __fish_use_subcommand -a listlocalsnapshots -d 'List local Time Machine snapshots of the specified volume'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a listbackups -d 'Print paths for all snapshots'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a localsnapshot -d 'Create new local Time Machine snapshot of APFS volume in TM backup'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a machinedirectory -d 'Print the path to the current machine directory'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a removedestination -d 'Removes a backup destination'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from removedestination' -a '$(__fish_tmutil_destination_ids)'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a removeexclusion -d 'Remove an exclusion'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from removeexclusion' -s v -d 'Volume exclusion'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from removeexclusion' -s p -d 'Path exclusion'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a restore -d 'Restore an item'
|
||||
complete -c tmutil -r -n '__fish_seen_subcommand_from restore' -s v
|
||||
|
||||
complete -c tmutil -r -n __fish_use_subcommand -a setdestination -d 'Set a backup destination'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from setdestination' -s a -d 'Add to the list of destinations'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from setdestination' -s p -d 'Enter the password at a non-echoing interactive prompt'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a snapshot -f -d 'Create new local Time Machine snapshot'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a startbackup -d 'Begin a backup if one is not already running'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from startbackup' -s a -l auto -d 'Automatic mode'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from startbackup' -s b -l block -d 'Block until finished'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from startbackup' -s r -l rotation -d 'Automatic rotation'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from startbackup' -s d -l destination -r -a '$(__fish_tmutil_destination_ids)' -d 'Backup destination'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a stopbackup -d 'Cancel a backup currently in progress'
|
||||
|
||||
complete -c tmutil -r -n __fish_use_subcommand -a thinlocalsnapshots -d 'Thin local Time Machine snapshots for the specified volume'
|
||||
|
||||
complete -c tmutil -r -n __fish_use_subcommand -a uniquesize -d 'Analyze the specified path and determine its unique size'
|
||||
|
||||
complete -c tmutil -r -n __fish_use_subcommand -a verifychecksums -d 'Verify snapshot'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a version -d 'Print version'
|
||||
|
||||
complete -c tmutil -f -n __fish_use_subcommand -a setquota -d 'Set the quota for the destination in gigabytes'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from setquota' -r -a '$(__fish_tmutil_destination_ids)'
|
||||
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from destinationinfo isexcluded compare status' -s X -d 'Print as XML'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from latestbackup listbackups' -s m -d 'Destination volume to list backups from'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from latestbackup listbackups' -s t -d 'Attempt to mount the backups and list their mounted paths'
|
||||
complete -c tmutil -f -n '__fish_seen_subcommand_from latestbackup listbackups' -s d -d 'Backup mount point'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
# Returns 0 if the command has not had a subcommand yet
|
||||
# Does not currently account for -chdir
|
||||
function __fish_terraform_needs_command
|
||||
function __fish_tofu_needs_command
|
||||
set -l cmd (commandline -xpc)
|
||||
|
||||
if test (count $cmd) -eq 1
|
||||
@@ -10,19 +11,19 @@ function __fish_terraform_needs_command
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fish_terraform_workspaces
|
||||
function __fish_tofu_workspaces
|
||||
tofu workspace list | string replace -r "^[\s\*]*" ""
|
||||
end
|
||||
|
||||
# general options
|
||||
complete -f -c tofu -n "not __fish_terraform_needs_command" -o version -d "Print version information"
|
||||
complete -f -c tofu -n "not __fish_tofu_needs_command" -o version -d "Print version information"
|
||||
complete -f -c tofu -o help -d "Show help"
|
||||
|
||||
### apply/destroy
|
||||
set -l apply apply destroy
|
||||
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a apply -d "Build or change infrastructure"
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a destroy -d "Destroy infrastructure"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a apply -d "Build or change infrastructure"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a destroy -d "Destroy infrastructure"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from $apply" -o auto-approve -d "Skip interactive approval"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from $apply" -o backup -d "Path to backup the existing state file"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from $apply" -o compact-warnings -d "Show only error summaries"
|
||||
@@ -31,17 +32,17 @@ complete -f -c tofu -n "__fish_seen_subcommand_from $apply" -o lock-timeout -d "
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from $apply" -o input=true -d "Ask for input for variables if not directly set"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from $apply" -o no-color -d "If specified, output won't contain any color"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from $apply" -o parallelism -d "Limit the number of concurrent operations"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from $apply" -o state -d "Path to a Terraform state file"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from $apply" -o state -d "Path to a OpenTofu state file"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from $apply" -o state-out -d "Path to write state"
|
||||
|
||||
### console
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a console -d "Interactive console for Terraform interpolations"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from console" -o state -d "Path to a Terraform state file"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from console" -o var -d "Set a variable in the Terraform configuration"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a console -d "Interactive console for OpenTofu interpolations"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from console" -o state -d "Path to a OpenTofu state file"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from console" -o var -d "Set a variable in the OpenTofu configuration"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from console" -o var-file -d "Set variables from a file"
|
||||
|
||||
### fmt
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a fmt -d "Rewrite config files to canonical format"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a fmt -d "Rewrite config files to canonical format"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from fmt" -o list=false -d "Don't list files whose formatting differs"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from fmt" -o write=false -d "Don't write to source files"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from fmt" -o diff -d "Display diffs of formatting changes"
|
||||
@@ -50,21 +51,22 @@ complete -f -c tofu -n "__fish_seen_subcommand_from fmt" -o no-color -d "If spec
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from fmt" -o recursive -d "Also process files in subdirectories"
|
||||
|
||||
### get
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a get -d "Download and install modules for the configuration"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a get -d "Download and install modules for the configuration"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from get" -o update -d "Check modules for updates"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from get" -o no-color -d "If specified, output won't contain any color"
|
||||
|
||||
### graph
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a graph -d "Create a visual graph of Terraform resources"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a graph -d "Create a visual graph of OpenTofu resources"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from graph" -o plan -d "Use specified plan file instead of current directory"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from graph" -o draw-cycles -d "Highlight any cycles in the graph"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from graph" -o type=plan -d "Output plan graph"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from graph" -o type=plan-refresh-only -d "Output plan graph assuming refresh only"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from graph" -o type=plan-destroy -d "Output plan graph assuming destroy"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from graph" -o type=apply -d "Output apply graph"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from graph" -o consice -d "Shorten the plan output"
|
||||
|
||||
### import
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a import -d "Import existing infrastructure into Terraform"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a import -d "Import existing infrastructure into OpenTofu"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from import" -o backup -d "Path to backup the existing state file"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from import" -o config -d "Path to a directory of configuration files"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from import" -o allow-missing-config -d "Allow import without resource block"
|
||||
@@ -72,13 +74,13 @@ complete -f -c tofu -n "__fish_seen_subcommand_from import" -o input=false -d "D
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from import" -o lock=false -d "Don't hold a state lock"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from import" -o lock-timeout -d "Duration to retry a state lock"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from import" -o no-color -d "If specified, output won't contain any color"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from import" -o state -d "Path to a Terraform state file"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from import" -o state -d "Path to a OpenTofu state file"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from import" -o state-out -d "Path to write state"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from import" -o var -d "Set a variable in the Terraform configuration"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from import" -o var -d "Set a variable in the OpenTofu configuration"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from import" -o var-file -d "Set variables from a file"
|
||||
|
||||
### init
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a init -d "Initialize a new or existing Terraform configuration"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a init -d "Initialize a new or existing OpenTofu configuration"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from init" -o backend=false -d "Disable backend initialization"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from init" -o cloud=false -d "Disable backend initialization"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from init" -o backend-config -d "Backend configuration"
|
||||
@@ -95,24 +97,25 @@ complete -r -c tofu -n "__fish_seen_subcommand_from init" -o migrate-state -d "R
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from init" -o upgrade -d "Install latest dependencies, ignoring lockfile"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from init" -o lockfile=readonly -d "Set dependency lockfile mode to readonly"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from init" -o ignore-remote-version -d "Ignore local and remote backend compatibility check"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from init" -o json -d "Print output in JSON"
|
||||
|
||||
### login
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a login -d "Retrieves auth token for the given hostname"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a login -d "Retrieves auth token for the given hostname"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from login" -a "(__fish_print_hostnames)"
|
||||
|
||||
### logout
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a logout -d "Removes auth token for the given hostname"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a logout -d "Removes auth token for the given hostname"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from logout" -a "(__fish_print_hostnames)"
|
||||
|
||||
### output
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a output -d "Read an output from a state file"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a output -d "Read an output from a state file"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from output" -o state -d "Path to the state file to read"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from output" -o no-color -d "If specified, output won't contain any color"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from output" -o json -d "Print output in JSON format"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from output" -o raw -d "Print raw strings directly"
|
||||
|
||||
### plan
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a plan -d "Generate and show an execution plan"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a plan -d "Generate and show an execution plan"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from plan" -o compact-warnings -d "Show only error summaries"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from plan" -o detailed-exitcode -d "Return detailed exit codes"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from plan" -o input=true -d "Ask for input for variables if not directly set"
|
||||
@@ -121,7 +124,7 @@ complete -f -c tofu -n "__fish_seen_subcommand_from plan" -o lock-timeout -d "Du
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from plan" -o no-color -d "If specified, output won't contain any color"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from plan" -o out -d "Write a plan file to the given path"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from plan" -o parallelism -d "Limit the number of concurrent operations"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from plan" -o state -d "Path to a Terraform state file"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from plan" -o state -d "Path to a OpenTofu state file"
|
||||
|
||||
### plan customization options are reusable across apply, destroy, and plan
|
||||
set -l plan apply destroy plan
|
||||
@@ -131,82 +134,86 @@ complete -f -c tofu -n "__fish_seen_subcommand_from $plan" -o refresh-only -d "S
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from $plan" -o refresh=false -d "Skip checking for external changes"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from $plan" -o replace -d "Force replacement of resource using its address"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from $plan" -o target -d "Resource to target"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from $plan" -o var -d "Set a variable in the Terraform configuration"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from $plan" -o exclude -d "Resource to ignore during plan"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from $plan" -o var -d "Set a variable in the OpenTofu configuration"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from $plan" -o var-file -d "Set variables from a file"
|
||||
|
||||
### providers
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a providers -d "Print tree of modules with their provider requirements"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a providers -d "Print tree of modules with their provider requirements"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from providers" -a "lock mirror schema"
|
||||
|
||||
### refresh
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a refresh -d "Update local state file against real resources"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a refresh -d "Update local state file against real resources"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from $apply" -o compact-warnings -d "Show only error summaries"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from refresh" -o backup -d "Path to backup the existing state file"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from refresh" -o input=true -d "Ask for input for variables if not directly set"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from refresh" -o lock=false -d "Don't hold a state lock"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from refresh" -o lock-timeout -d "Duration to retry a state lock"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from refresh" -o no-color -d "If specified, output won't contain any color"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from refresh" -o state -d "Path to a Terraform state file"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from refresh" -o state -d "Path to a OpenTofu state file"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from refresh" -o state-out -d "Path to write state"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from refresh" -o target -d "Resource to target"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from refresh" -o var -d "Set a variable in the Terraform configuration"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from refresh" -o var -d "Set a variable in the OpenTofu configuration"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from refresh" -o var-file -d "Set variables from a file"
|
||||
|
||||
### show
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a show -d "Inspect Terraform state or plan"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a show -d "Inspect OpenTofu state or plan"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from show" -o no-color -d "If specified, output won't contain any color"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from validate" -o json -d "Produce output in JSON format"
|
||||
|
||||
### state
|
||||
complete -r -c tofu -n __fish_terraform_needs_command -a state -d "Advanced state management"
|
||||
complete -r -c tofu -n __fish_tofu_needs_command -a state -d "Advanced state management"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from state" -a list -d "List resources in state"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from state" -a ls -d "List resources in state"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from state" -a mv -d "Move an item in the state"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from state" -a move -d "Move an item in the state"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from state" -a pull -d "Pull current state and output to stdout"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from state" -a push -d "Update remote state from local state"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from state" -a replace-provider -d "Replace provider in the state"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from state" -a rm -d "Remove instance from the state"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from state" -a remove -d "Remove instance from the state"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from state" -a show -d "Show a resource in the state"
|
||||
|
||||
### taint
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a taint -d "Manually mark a resource for recreation"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a taint -d "Manually mark a resource for recreation"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from taint" -o allow-missing -d "Succeed even if resource is missing"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from taint" -o backup -d "Path to backup the existing state file"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from taint" -o lock=false -d "Don't hold a state lock"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from taint" -o lock-timeout -d "Duration to retry a state lock"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from taint" -o ignore-remote-version -d "Ignore local and remote backend compatibility check"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from taint" -o state -d "Path to a Terraform state file"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from taint" -o state -d "Path to a OpenTofu state file"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from taint" -o state-out -d "Path to write state"
|
||||
|
||||
### test
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a test -d "Runs automated test of shared modules"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a test -d "Runs automated test of shared modules"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from test" -o compact-warnings -d "Show only error summaries"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from test" -o junit-xml -d "Also write test results to provided JUnit XML file"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from test" -o no-color -d "If specified, output won't contain any color"
|
||||
|
||||
### untaint
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a untaint -d "Manually unmark a resource as tainted"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a untaint -d "Manually unmark a resource as tainted"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from untaint" -o allow-missing -d "Succeed even if resource is missing"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from untaint" -o backup -d "Path to backup the existing state file"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from untaint" -o lock=false -d "Don't hold a state lock"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from untaint" -o lock-timeout -d "Duration to retry a state lock"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from untaint" -o ignore-remote-version -d "Ignore local and remote backend compatibility check"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from untaint" -o state -d "Path to a Terraform state file"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from untaint" -o state -d "Path to a OpenTofu state file"
|
||||
complete -r -c tofu -n "__fish_seen_subcommand_from untaint" -o state-out -d "Path to write state"
|
||||
|
||||
### validate
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a validate -d "Validate the Terraform files"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a validate -d "Validate the OpenTofu files"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from validate" -o json -d "Produce output in JSON format"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from validate" -o no-color -d "If specified, output won't contain any color"
|
||||
|
||||
### version
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a version -d "Print the Terraform version"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a version -d "Print the OpenTofu version"
|
||||
|
||||
### workspace
|
||||
set -l workspace_commands list select new delete
|
||||
|
||||
complete -f -c tofu -n __fish_terraform_needs_command -a workspace -d "Workspace management"
|
||||
complete -f -c tofu -n __fish_tofu_needs_command -a workspace -d "Workspace management"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands" -a list -d "List workspaces"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands" -a select -d "Select an workspace"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands" -a new -d "Create a new workspace"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from workspace && not __fish_seen_subcommand_from $workspace_commands" -a delete -d "Delete an existing workspace"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from workspace && __fish_seen_subcommand_from select delete" -a "(__fish_terraform_workspaces)"
|
||||
complete -f -c tofu -n "__fish_seen_subcommand_from workspace && __fish_seen_subcommand_from select delete" -a "(__fish_tofu_workspaces)"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function __fish_winetricks__complete_verbs
|
||||
winetricks list-all |
|
||||
winetricks list-all 2>/dev/null |
|
||||
string match --invert --regex '^==' |
|
||||
string match --invert --regex '^(apps|dlls|fonts|games|settings)$' |
|
||||
string replace --regex '(\S+)\s+(.+)' '$1\t$2'
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
set -l commands status get-volume inspect set-default set-volume set-mute set-profile clear-default
|
||||
|
||||
if wpctl settings &>/dev/null
|
||||
set --append commands settings
|
||||
end
|
||||
|
||||
function __wpctl_get_nodes -a section -a type
|
||||
set -l havesection
|
||||
set -l havetype
|
||||
@@ -38,6 +42,19 @@ function __wpctl_command_shape
|
||||
end
|
||||
end
|
||||
|
||||
function __wpctl_get_settings
|
||||
set -l wpctl_settings (wpctl settings 2>/dev/null| string collect)
|
||||
or return
|
||||
|
||||
string match --regex --all --quiet '\- Name: (?<wpctl_settings_name>.*)\n Desc: (?<wpctl_settings_desc>.*)' $wpctl_settings
|
||||
|
||||
for i in (seq (count $wpctl_settings_name))
|
||||
set -l name $wpctl_settings_name[$i]
|
||||
set -l desc (string shorten --max 60 $wpctl_settings_desc[$i])
|
||||
echo $name\t$desc
|
||||
end
|
||||
end
|
||||
|
||||
complete -c wpctl -f
|
||||
|
||||
complete -c wpctl -s h -l help -d "Show help options"
|
||||
@@ -48,6 +65,9 @@ complete -c wpctl -n "__fish_seen_subcommand_from inspect" -s a -l associated -d
|
||||
complete -c wpctl -n "__fish_seen_subcommand_from set-volume" -s p -l pid -d "Selects all nodes associated to the given PID"
|
||||
complete -c wpctl -n "__fish_seen_subcommand_from set-volume" -s l -l limit -d "Limit volume to below this value"
|
||||
complete -c wpctl -n "__fish_seen_subcommand_from set-mute" -s p -l pid -d "Selects all nodes associated to the given PID"
|
||||
complete -c wpctl -n "__fish_seen_subcommand_from settings" -s d -l delete -d "Deletes the saved setting value"
|
||||
complete -c wpctl -n "__fish_seen_subcommand_from settings" -s s -l save -d "Saves the setting value"
|
||||
complete -c wpctl -n "__fish_seen_subcommand_from settings" -s r -l reset -d "Resets the saved setting to its default value"
|
||||
|
||||
complete -c wpctl -n __wpctl_command_shape -a "$commands"
|
||||
complete -c wpctl -n '__wpctl_command_shape "*"' -n "__fish_seen_subcommand_from get-volume inspect set-volume set-mute set-profile" -a "@DEFAULT_AUDIO_SOURCE@" -d "Default Microphone"
|
||||
@@ -56,3 +76,4 @@ complete -c wpctl -n '__wpctl_command_shape "*"' -n "__fish_seen_subcommand_from
|
||||
complete -c wpctl -n '__wpctl_command_shape "*"' -n "__fish_seen_subcommand_from get-volume inspect set-volume set-mute set-profile" -a "(__wpctl_get_nodes Audio Sources) (__wpctl_get_nodes Audio Sinks)"
|
||||
complete -c wpctl -n '__wpctl_command_shape "*"' -n "__fish_seen_subcommand_from inspect set-profile" -a "(__wpctl_get_nodes Audio Sources) (__wpctl_get_nodes Audio Sinks) (__wpctl_get_nodes Video Source)"
|
||||
complete -c wpctl -n '__wpctl_command_shape set-mute "*"' -a "0 1 toggle"
|
||||
complete -c wpctl -n '__wpctl_command_shape settings' -a "(__wpctl_get_settings)"
|
||||
|
||||
@@ -69,8 +69,8 @@ function __fish_complete_man
|
||||
|
||||
# Fish commands are not given by apropos
|
||||
if not set -ql exclude_fish_commands
|
||||
set -l files $__fish_data_dir/man/man1/*.1
|
||||
string replace -r '.*/([^/]+)\.1$' '$1\t1: fish command' -- $files (status list-files man/man1/ 2>/dev/null)
|
||||
set -l files $__fish_data_dir/man/man1/*.1*
|
||||
string replace -r '.*/([^/]+)\.1(\.gz)?$' '$1\t1: fish command' -- $files (status list-files man/man1/ 2>/dev/null)
|
||||
end
|
||||
else
|
||||
return 1
|
||||
|
||||
@@ -30,13 +30,12 @@ if status is-interactive
|
||||
# Commands to run in interactive sessions can go here
|
||||
end" >$__fish_config_dir/config.fish
|
||||
|
||||
fish_config theme save "fish default" --yes --track
|
||||
echo yes | fish_config theme save "fish default"
|
||||
set -Ue fish_color_keyword fish_color_option
|
||||
end
|
||||
if test $__fish_initialized -lt 3800 && test "$fish_color_search_match[1]" = bryellow
|
||||
set --universal fish_color_search_match[1] white
|
||||
end
|
||||
fish_config theme update
|
||||
|
||||
#
|
||||
# Generate man page completions if not present.
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
function __fish_in_gnu_screen
|
||||
test -n "$STY" || contains -- $TERM screen screen-256color
|
||||
end
|
||||
@@ -1,9 +0,0 @@
|
||||
function __fish_in_terminal_multiplexer
|
||||
set -l terminal_name "(status xtversion | string match -r '^\S*')"
|
||||
string match -q -- tmux $terminal_name ||
|
||||
__fish_in_gnu_screen ||
|
||||
# Emacs does probably not support multiplexing between multiple parent
|
||||
# terminals, but it is affected by the same issues. Same for Vim's
|
||||
# :terminal TODO detect that before they implement XTGETTCAP.
|
||||
contains -- $TERM dvtm-256color eterm eterm-color
|
||||
end
|
||||
@@ -1,5 +1,5 @@
|
||||
function __fish_print_commands --description "Print a list of documented fish commands"
|
||||
if test -d $__fish_data_dir/man/man1/
|
||||
if set -q __fish_data_dir[1] && test -d $__fish_data_dir/man/man1/
|
||||
for file in $__fish_data_dir/man/man1/**.1*
|
||||
string replace -r '.*/' '' -- $file |
|
||||
string replace -r '.1(.gz)?$' '' |
|
||||
|
||||
@@ -48,6 +48,9 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
|
||||
bind --preset $argv shift-right forward-bigword
|
||||
bind --preset $argv shift-left backward-bigword
|
||||
|
||||
bind --preset $argv alt-b prevd-or-backward-word
|
||||
bind --preset $argv alt-f nextd-or-forward-word
|
||||
|
||||
set -l alt_right_aliases alt-right \e\[1\;9C # iTerm2 < 3.5.12
|
||||
set -l alt_left_aliases alt-left \e\[1\;9D # iTerm2 < 3.5.12
|
||||
if test (__fish_uname) = Darwin
|
||||
@@ -77,11 +80,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
|
||||
bind --preset $argv alt-l __fish_list_current_token
|
||||
bind --preset $argv alt-o __fish_preview_current_file
|
||||
bind --preset $argv alt-w __fish_whatis_current_token
|
||||
bind --preset $argv ctrl-l (
|
||||
if not __fish_in_gnu_screen && and __fish_xtgettcap indn
|
||||
echo scrollback-push
|
||||
end
|
||||
) clear-screen
|
||||
bind --preset $argv ctrl-l scrollback-push clear-screen
|
||||
bind --preset $argv ctrl-c clear-commandline
|
||||
bind --preset $argv ctrl-u backward-kill-line
|
||||
bind --preset $argv ctrl-k kill-line
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
function __fish_systemctl --description 'Call systemctl with some options from the current commandline'
|
||||
# We don't want to complete with ANSI color codes
|
||||
set -lu SYSTEMD_COLORS
|
||||
|
||||
# These options are all global - before or after subcommand/arguments.
|
||||
# There's a bunch of long-only options in here, so we need to be creative with the mandatory short version.
|
||||
set -l opts t/type= s-state= p/property= a/all
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
function __fish_systemctl_services
|
||||
# We don't want to complete with ANSI color codes
|
||||
set -lu SYSTEMD_COLORS
|
||||
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
systemctl --user list-unit-files --full --no-legend --no-pager --plain --type=service 2>/dev/null $argv | string split -f 1 ' '
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# Like for running machines, I'm assuming machinectl doesn't allow spaces in image names
|
||||
# This does not include the special image ".host" since it isn't valid for most operations
|
||||
function __fish_systemd_machine_images
|
||||
# We don't want to complete with ANSI color codes
|
||||
set -lu SYSTEMD_COLORS
|
||||
|
||||
machinectl --no-legend --no-pager list-images | while read -l a b
|
||||
echo $a
|
||||
end
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# It seems machinectl will eliminate spaces from machine names so we don't need to handle that
|
||||
function __fish_systemd_machines
|
||||
# We don't want to complete with ANSI color codes
|
||||
set -lu SYSTEMD_COLORS
|
||||
|
||||
machinectl --no-legend --no-pager list --all | while read -l a b
|
||||
echo $a
|
||||
end
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
function __fish_xtgettcap --argument-names terminfo_code
|
||||
if test $FISH_UNIT_TESTS_RUNNING = 1
|
||||
return 1
|
||||
end
|
||||
set -l varname __fish_tcap_$terminfo_code
|
||||
if not set -q $varname\[0\]
|
||||
set --global $varname (
|
||||
status xtgettcap $terminfo_code && echo true || echo false
|
||||
)
|
||||
end
|
||||
test "$$varname" = true
|
||||
end
|
||||
@@ -5,18 +5,13 @@ function export --description 'Set env variable. Alias for `set -gx` for bash co
|
||||
end
|
||||
for arg in $argv
|
||||
set -l v (string split -m 1 "=" -- $arg)
|
||||
set -l value
|
||||
switch (count $v)
|
||||
case 1
|
||||
set -gx $v $$v
|
||||
set value $$v[1]
|
||||
case 2
|
||||
if contains -- $v[1] PATH CDPATH MANPATH
|
||||
set -l colonized_path (string replace -- "$$v[1]" (string join ":" -- $$v[1]) $v[2])
|
||||
set -gx $v[1] (string split ":" -- $colonized_path)
|
||||
else
|
||||
# status is 1 from the contains check, and `set` does not change the status on success: reset it.
|
||||
true
|
||||
set -gx $v[1] $v[2]
|
||||
end
|
||||
set value $v[2]
|
||||
end
|
||||
set -gx $v[1] $value
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
# Variables a theme is allowed to set
|
||||
set -l theme_var_filter '^fish_(?:pager_)?color.*$'
|
||||
|
||||
function fish_config --description "Launch fish's web based configuration" \
|
||||
--inherit-variable theme_var_filter
|
||||
|
||||
set -l _flag_track
|
||||
argparse h/help track yes -- $argv
|
||||
function fish_config --description "Launch fish's web based configuration"
|
||||
argparse h/help -- $argv
|
||||
or return
|
||||
|
||||
if set -q _flag_help
|
||||
@@ -16,15 +10,6 @@ function fish_config --description "Launch fish's web based configuration" \
|
||||
set -l cmd $argv[1]
|
||||
set -e argv[1]
|
||||
|
||||
if set -q _flag_track[1] && not { test "$cmd" = theme && test "$argv[1]" = save }
|
||||
echo >&2 fish_config: --track: unknown option
|
||||
return 1
|
||||
end
|
||||
if set -q _flag_yes[1] && not { contains "$cmd" prompt theme && test "$argv[1]" = save }
|
||||
echo >&2 fish_config: --yes: unknown option
|
||||
return 1
|
||||
end
|
||||
|
||||
set -q cmd[1]
|
||||
or set cmd browse
|
||||
|
||||
@@ -80,6 +65,9 @@ function fish_config --description "Launch fish's web based configuration" \
|
||||
return 1
|
||||
end
|
||||
|
||||
# Variables a theme is allowed to set
|
||||
set -l theme_var_filter '^fish_(?:pager_)?color.*$'
|
||||
|
||||
switch $cmd
|
||||
case prompt
|
||||
# prompt - for prompt switching
|
||||
@@ -156,8 +144,8 @@ function fish_config --description "Launch fish's web based configuration" \
|
||||
functions --erase fish_right_prompt
|
||||
end
|
||||
case save
|
||||
if set -q _flag_yes[1] ||
|
||||
{ read -P"Overwrite prompt? [y/N]" -l yesno; string match -riq 'y(es)?' -- $yesno }
|
||||
read -P"Overwrite prompt? [y/N]" -l yesno
|
||||
if string match -riq 'y(es)?' -- $yesno
|
||||
echo Overwriting
|
||||
# Skip the cp if unnecessary,
|
||||
# or we'd throw an error on a stock fish.
|
||||
@@ -286,10 +274,8 @@ function fish_config --description "Launch fish's web based configuration" \
|
||||
set -l have_colors
|
||||
|
||||
if contains -- $cmd save
|
||||
if not set -q _flag_yes &&
|
||||
{ read -P"Overwrite your current theme? [y/N] " -l yesno
|
||||
not string match -riq 'y(es)?' -- $yesno
|
||||
}
|
||||
read -P"Overwrite your current theme? [y/N] " -l yesno
|
||||
if not string match -riq 'y(es)?' -- $yesno
|
||||
echo Not overwriting >&2
|
||||
return 1
|
||||
end
|
||||
@@ -306,7 +292,34 @@ function fish_config --description "Launch fish's web based configuration" \
|
||||
# If we are choosing a theme or saving from a named theme, load the theme now.
|
||||
# Otherwise, we'll persist the currently loaded/themed variables (in case of `theme save`).
|
||||
if set -q argv[1]
|
||||
__fish_config_theme_get $argv[1] | while read -lat toks
|
||||
set -l files $dirs/$argv[1].theme
|
||||
set -l file
|
||||
|
||||
for f in $files
|
||||
if test -e "$f"
|
||||
set file $f
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not set -q file[1]
|
||||
if status list-files tools/web_config/themes/$argv[1].theme &>/dev/null
|
||||
set file tools/web_config/themes/$argv[1].theme
|
||||
else
|
||||
echo "No such theme: $argv[1]" >&2
|
||||
echo "Searched directories: $dirs" >&2
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
set -l content
|
||||
if string match -qr '^tools/' -- $file
|
||||
set content (status get-file $file)
|
||||
else
|
||||
read -z content < $file
|
||||
end
|
||||
|
||||
printf %s\n $content | while read -lat toks
|
||||
# The whitelist allows only color variables.
|
||||
# Not the specific list, but something named *like* a color variable.
|
||||
# This also takes care of empty lines and comment lines.
|
||||
@@ -318,7 +331,7 @@ function fish_config --description "Launch fish's web based configuration" \
|
||||
if test x"$scope" = x-U; and set -qg $toks[1]
|
||||
set -eg $toks[1]
|
||||
end
|
||||
set $scope $toks $_flag_track=$argv[1]
|
||||
set $scope $toks
|
||||
set -a have_colors $toks[1]
|
||||
end
|
||||
|
||||
@@ -330,7 +343,7 @@ function fish_config --description "Launch fish's web based configuration" \
|
||||
# Erase conflicting global variables so we don't get a warning and
|
||||
# so changes are observed immediately.
|
||||
set -eg $c
|
||||
set $scope $c $_flag_track=$argv[1]
|
||||
set $scope $c
|
||||
end
|
||||
else
|
||||
# We're persisting whatever current colors are loaded (maybe in the global scope)
|
||||
@@ -352,8 +365,6 @@ function fish_config --description "Launch fish's web based configuration" \
|
||||
# If we've made it this far, we've either found a theme file or persisted the current
|
||||
# state (if any). In all cases we haven't failed, so return 0.
|
||||
return 0
|
||||
case update
|
||||
__fish_config_theme_update $argv
|
||||
case dump
|
||||
# Write the current theme in .theme format, to stdout.
|
||||
set -L | string match -r $theme_var_filter
|
||||
@@ -363,100 +374,3 @@ function fish_config --description "Launch fish's web based configuration" \
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_config_theme_get
|
||||
set -l dirs $__fish_config_dir/themes $__fish_data_dir/tools/web_config/themes
|
||||
set -l files $dirs/$argv[1].theme
|
||||
set -l file
|
||||
set -l is_default_theme false
|
||||
|
||||
for f in $files
|
||||
if test -e "$f"
|
||||
set file $f
|
||||
if test $f = $__fish_data_dir/tools/web_config/themes/$argv[1].theme
|
||||
set is_default_theme true
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not set -q file[1]
|
||||
if status list-files tools/web_config/themes/$argv[1].theme &>/dev/null
|
||||
set file tools/web_config/themes/$argv[1].theme
|
||||
set is_default_theme true
|
||||
else
|
||||
echo "No such theme: $argv[1]" >&2
|
||||
echo "Searched directories: $dirs" >&2
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
set -l content (
|
||||
if string match -qr '^tools/' -- $file
|
||||
status get-file $file
|
||||
else
|
||||
string join \n <$file
|
||||
end
|
||||
)
|
||||
if $is_default_theme && not __fish_in_gnu_screen && not __fish_xtgettcap Su && not __fish_in_terminal_multiplexer
|
||||
set content (string replace -- --underline=curly "" $content)
|
||||
end
|
||||
|
||||
string join \n $content
|
||||
end
|
||||
|
||||
function __fish_config_show_tracked_color_vars
|
||||
set -l color_var $argv[1]
|
||||
set -l _flag_track
|
||||
argparse --ignore-unknown track= -- _set_color $argv[2..]
|
||||
or return $status
|
||||
if not set -q _flag_track[1]
|
||||
return
|
||||
end
|
||||
if set -q _flag_track[2]
|
||||
echo >&2 "fish_config: $color_var: --track option can only be specified once"
|
||||
exit 1
|
||||
end
|
||||
if test (printf %s $_flag_track | count) -ne 0
|
||||
echo >&2 "fish_config: $color_var: error: tracking theme name must not contain newlines"
|
||||
exit 1
|
||||
end
|
||||
printf %s\n $color_var $_flag_track
|
||||
end
|
||||
|
||||
function __fish_config_theme_update --inherit-variable theme_var_filter
|
||||
if set -q argv[1]
|
||||
echo "fish_config: too many arguments" >&2
|
||||
return 1
|
||||
end
|
||||
set -l themes
|
||||
|
||||
set -l tracking_variables (
|
||||
set --universal --long |
|
||||
string match -r '^fish_(?:pager_)?color.*$' |
|
||||
string replace -r '.*' '__fish_config_show_tracked_color_vars $0' |
|
||||
source
|
||||
)
|
||||
or return $status
|
||||
string join \n $tracking_variables |
|
||||
while read --line _colorvar theme
|
||||
if not contains -- $theme $themes
|
||||
set -a themes $theme
|
||||
end
|
||||
end
|
||||
|
||||
for theme in $themes
|
||||
set -l colorvars
|
||||
string join \n $tracking_variables |
|
||||
while read --line color_var t
|
||||
if test $t = $theme
|
||||
set -a colorvars $color_var
|
||||
end
|
||||
end
|
||||
set -l theme_escaped (string escape -- $theme)
|
||||
__fish_config_theme_get $theme |
|
||||
string match -r -- "^(?:$(string join '|' $colorvars))\b .*" |
|
||||
string replace -r '.*' "set -U \$0 --track=$theme_escaped" |
|
||||
source
|
||||
end
|
||||
end
|
||||
|
||||
@@ -61,8 +61,6 @@ function fish_default_key_bindings -d "emacs-like key binds"
|
||||
bind --preset $argv alt-delete kill-token
|
||||
bind --preset $argv ctrl-delete kill-word
|
||||
end
|
||||
bind --preset $argv alt-b prevd-or-backward-word
|
||||
bind --preset $argv alt-f nextd-or-forward-word
|
||||
|
||||
bind --preset $argv alt-\< beginning-of-buffer
|
||||
bind --preset $argv alt-\> end-of-buffer
|
||||
|
||||
@@ -113,13 +113,10 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
|
||||
bind -s --preset -M insert end end-of-line
|
||||
bind -s --preset -M default end end-of-line
|
||||
|
||||
# Vi moves the cursor back if, after deleting, it is at EOL.
|
||||
# To emulate that, move forward, then backward, which will be a NOP
|
||||
# if there is something to move forward to.
|
||||
bind -s --preset -M default x delete-char 'set fish_cursor_end_mode exclusive' forward-single-char backward-char 'set fish_cursor_end_mode inclusive'
|
||||
bind -s --preset -M default x delete-char
|
||||
bind -s --preset -M default X backward-delete-char
|
||||
bind -s --preset -M insert delete delete-char forward-single-char backward-char
|
||||
bind -s --preset -M default delete delete-char 'set fish_cursor_end_mode exclusive' forward-single-char backward-char 'set fish_cursor_end_mode inclusive'
|
||||
bind -s --preset -M insert delete delete-char
|
||||
bind -s --preset -M default delete delete-char
|
||||
|
||||
# Backspace deletes a char in insert mode, but not in normal/default mode.
|
||||
bind -s --preset -M insert backspace backward-delete-char
|
||||
@@ -238,7 +235,7 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
|
||||
# in vim p means paste *after* current character, so go forward a char before pasting
|
||||
# also in vim, P means paste *at* current position (like at '|' with cursor = line),
|
||||
# \ so there's no need to go back a char, just paste it without moving
|
||||
bind -s --preset p 'set -g fish_cursor_end_mode exclusive' forward-char 'set -g fish_cursor_end_modefish_cursor_end_modeinclusive' yank
|
||||
bind -s --preset p 'set -g fish_cursor_end_mode exclusive' forward-char 'set -g fish_cursor_end_mode inclusive' yank
|
||||
bind -s --preset P yank
|
||||
bind -s --preset g,p yank-pop
|
||||
|
||||
@@ -252,10 +249,10 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
|
||||
# Lowercase r, enters replace_one mode
|
||||
#
|
||||
bind -s --preset -m replace_one r repaint-mode
|
||||
bind -s --preset -M replace_one -m default '' delete-char self-insert backward-char repaint-mode
|
||||
bind -s --preset -M replace_one -m default enter 'commandline -f delete-char; commandline -i \n; commandline -f backward-char; commandline -f repaint-mode'
|
||||
bind -s --preset -M replace_one -m default ctrl-j 'commandline -f delete-char; commandline -i \n; commandline -f backward-char; commandline -f repaint-mode'
|
||||
bind -s --preset -M replace_one -m default ctrl-m 'commandline -f delete-char; commandline -i \n; commandline -f backward-char; commandline -f repaint-mode'
|
||||
bind -s --preset -M replace_one -m default '' 'set -g fish_cursor_end_mode exclusive' delete-char self-insert backward-char repaint-mode 'set -g fish_cursor_end_mode inclusive'
|
||||
bind -s --preset -M replace_one -m default enter 'set -g fish_cursor_end_mode exclusive' 'commandline -f delete-char; commandline -i \n; commandline -f backward-char' repaint-mode 'set -g fish_cursor_end_mode inclusive'
|
||||
bind -s --preset -M replace_one -m default ctrl-j 'set -g fish_cursor_end_mode exclusive' 'commandline -f delete-char; commandline -i \n; commandline -f backward-char' repaint-mode 'set -g fish_cursor_end_mode inclusive'
|
||||
bind -s --preset -M replace_one -m default ctrl-m 'set -g fish_cursor_end_mode exclusive' 'commandline -f delete-char; commandline -i \n; commandline -f backward-char' repaint-mode 'set -g fish_cursor_end_mode inclusive'
|
||||
bind -s --preset -M replace_one -m default escape cancel repaint-mode
|
||||
bind -s --preset -M replace_one -m default ctrl-\[ cancel repaint-mode
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ function history --description "display or manipulate interactive command histor
|
||||
set -l searchterm $argv
|
||||
if not set -q argv[1]
|
||||
read -P"Search term: " searchterm
|
||||
or return $status
|
||||
end
|
||||
|
||||
if test "$search_mode" = --exact
|
||||
@@ -119,6 +120,7 @@ function history --description "display or manipulate interactive command histor
|
||||
echo "Enter 'all' to delete all the matching entries."
|
||||
echo
|
||||
read --local --prompt "echo 'Delete which entries? '" choice
|
||||
or return $status
|
||||
echo ''
|
||||
|
||||
if test -z "$choice"
|
||||
@@ -192,6 +194,7 @@ function history --description "display or manipulate interactive command histor
|
||||
|
||||
printf (_ "If you enter 'yes' your entire interactive command history will be erased\n")
|
||||
read --local --prompt "echo 'Are you sure you want to clear history? (yes/no) '" choice
|
||||
or return $status
|
||||
if test "$choice" = yes
|
||||
builtin history clear $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $argv
|
||||
and printf (_ "Command history cleared!\n")
|
||||
@@ -205,6 +208,7 @@ function history --description "display or manipulate interactive command histor
|
||||
set -l newitem $argv
|
||||
if not set -q argv[1]
|
||||
read -P "Command: " newitem
|
||||
or return $status
|
||||
end
|
||||
|
||||
builtin history append $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $newitem
|
||||
|
||||
@@ -10,7 +10,7 @@ fish_color_comment f7ca88
|
||||
fish_color_cwd green
|
||||
fish_color_cwd_root red
|
||||
fish_color_end ba8baf
|
||||
fish_color_error ab4642 --underline=curly
|
||||
fish_color_error ab4642
|
||||
fish_color_escape 86c1b9
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -10,7 +10,7 @@ fish_color_comment f7ca88
|
||||
fish_color_cwd green
|
||||
fish_color_cwd_root red
|
||||
fish_color_end ba8baf
|
||||
fish_color_error ab4642 --underline=curly
|
||||
fish_color_error ab4642
|
||||
fish_color_escape 86c1b9
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -10,7 +10,7 @@ fish_color_comment ffcc66
|
||||
fish_color_cwd green
|
||||
fish_color_cwd_root red
|
||||
fish_color_end cc99cc
|
||||
fish_color_error f2777a --underline=curly
|
||||
fish_color_error f2777a
|
||||
fish_color_escape 66cccc
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -9,7 +9,7 @@ fish_color_comment FF9640
|
||||
fish_color_cwd green
|
||||
fish_color_cwd_root red
|
||||
fish_color_end FFB273
|
||||
fish_color_error FF7400 --underline=curly
|
||||
fish_color_error FF7400
|
||||
fish_color_escape 00a6b2
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -21,7 +21,7 @@ fish_color_comment 6272a4
|
||||
fish_color_cwd 50fa7b
|
||||
fish_color_cwd_root red
|
||||
fish_color_end ffb86c
|
||||
fish_color_error ff5555 --underline=curly
|
||||
fish_color_error ff5555
|
||||
fish_color_escape ff79c6
|
||||
fish_color_history_current --bold
|
||||
fish_color_host bd93f9
|
||||
|
||||
@@ -9,7 +9,7 @@ fish_color_comment FFE100
|
||||
fish_color_cwd green
|
||||
fish_color_cwd_root red
|
||||
fish_color_end 8D003B
|
||||
fish_color_error EC3B86 --underline=curly
|
||||
fish_color_error EC3B86
|
||||
fish_color_escape 00a6b2
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -9,7 +9,7 @@ fish_color_comment B0B0B0
|
||||
fish_color_cwd green
|
||||
fish_color_cwd_root red
|
||||
fish_color_end 969696
|
||||
fish_color_error FFA779 --underline=curly
|
||||
fish_color_error FFA779
|
||||
fish_color_escape 00a6b2
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -6,7 +6,7 @@ fish_color_command FF9400
|
||||
fish_color_quote BF9C30
|
||||
fish_color_redirection BF5B30
|
||||
fish_color_end FF4C00
|
||||
fish_color_error FFDD73 --underline=curly
|
||||
fish_color_error FFDD73
|
||||
fish_color_param FFC000
|
||||
fish_color_comment A63100
|
||||
fish_color_selection white --background=brblack --bold
|
||||
|
||||
@@ -9,7 +9,7 @@ fish_color_comment 4e4e4e
|
||||
fish_color_cwd green
|
||||
fish_color_cwd_root red
|
||||
fish_color_end 767676
|
||||
fish_color_error b2b2b2 --underline=curly
|
||||
fish_color_error b2b2b2
|
||||
fish_color_escape 00a6b2
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -6,7 +6,7 @@ fish_color_command ffffff
|
||||
fish_color_quote a8a8a8
|
||||
fish_color_redirection 808080
|
||||
fish_color_end 949494
|
||||
fish_color_error 585858 --underline=curly
|
||||
fish_color_error 585858
|
||||
fish_color_param d7d7d7
|
||||
fish_color_comment bcbcbc
|
||||
fish_color_selection white --background=brblack --bold
|
||||
|
||||
@@ -9,7 +9,7 @@ fish_color_comment
|
||||
fish_color_cwd normal
|
||||
fish_color_cwd_root normal
|
||||
fish_color_end
|
||||
fish_color_error --underline=curly
|
||||
fish_color_error
|
||||
fish_color_escape
|
||||
fish_color_history_current
|
||||
fish_color_host normal
|
||||
|
||||
@@ -11,7 +11,7 @@ fish_color_comment 4c566a --italics
|
||||
fish_color_cwd 5e81ac
|
||||
fish_color_cwd_root bf616a
|
||||
fish_color_end 81a1c1
|
||||
fish_color_error bf616a --underline=curly
|
||||
fish_color_error bf616a
|
||||
fish_color_escape ebcb8b
|
||||
fish_color_history_current e5e9f0 --bold
|
||||
fish_color_host a3be8c
|
||||
|
||||
@@ -9,7 +9,7 @@ fish_color_comment 30BE30
|
||||
fish_color_cwd green
|
||||
fish_color_cwd_root red
|
||||
fish_color_end FF7B7B
|
||||
fish_color_error A40000 --underline=curly
|
||||
fish_color_error A40000
|
||||
fish_color_escape 00a6b2
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -9,7 +9,7 @@ fish_color_comment 5C9900
|
||||
fish_color_cwd green
|
||||
fish_color_cwd_root red
|
||||
fish_color_end 8EEB00
|
||||
fish_color_error 60B9CE --underline=curly
|
||||
fish_color_error 60B9CE
|
||||
fish_color_escape 00a6b2
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -6,7 +6,7 @@ fish_color_command 164CC9
|
||||
fish_color_quote 4C3499
|
||||
fish_color_redirection 248E8E
|
||||
fish_color_end 02BDBD
|
||||
fish_color_error 9177E5 --underline=curly
|
||||
fish_color_error 9177E5
|
||||
fish_color_param 4319CC
|
||||
fish_color_comment 007B7B
|
||||
fish_color_selection white --background=brblack --bold
|
||||
|
||||
@@ -10,7 +10,7 @@ fish_color_comment 586e75
|
||||
fish_color_cwd green
|
||||
fish_color_cwd_root red
|
||||
fish_color_end 268bd2
|
||||
fish_color_error dc322f --underline=curly
|
||||
fish_color_error dc322f
|
||||
fish_color_escape 00a6b2
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -7,7 +7,7 @@ fish_color_command 586e75
|
||||
fish_color_quote 839496
|
||||
fish_color_redirection 6c71c4
|
||||
fish_color_end 268bd2
|
||||
fish_color_error dc322f --underline=curly
|
||||
fish_color_error dc322f
|
||||
fish_color_param 657b83
|
||||
fish_color_comment 93a1a1
|
||||
fish_color_selection white --background=brblack --bold
|
||||
|
||||
@@ -10,7 +10,7 @@ fish_color_comment e7c547
|
||||
fish_color_cwd green
|
||||
fish_color_cwd_root red
|
||||
fish_color_end c397d8
|
||||
fish_color_error d54e53 --underline=curly
|
||||
fish_color_error d54e53
|
||||
fish_color_escape 00a6b2
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -7,7 +7,7 @@ fish_color_command b294bb
|
||||
fish_color_quote b5bd68
|
||||
fish_color_redirection 8abeb7
|
||||
fish_color_end b294bb
|
||||
fish_color_error cc6666 --underline=curly
|
||||
fish_color_error cc6666
|
||||
fish_color_param 81a2be
|
||||
fish_color_comment f0c674
|
||||
fish_color_selection white --background=brblack --bold
|
||||
|
||||
@@ -10,7 +10,7 @@ fish_color_comment eab700
|
||||
fish_color_cwd green
|
||||
fish_color_cwd_root red
|
||||
fish_color_end 8959a8
|
||||
fish_color_error c82829 --underline=curly
|
||||
fish_color_error c82829
|
||||
fish_color_escape 00a6b2
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -7,7 +7,7 @@ fish_color_command 39BAE6
|
||||
fish_color_quote C2D94C
|
||||
fish_color_redirection FFEE99
|
||||
fish_color_end F29668
|
||||
fish_color_error FF3333 --underline=curly
|
||||
fish_color_error FF3333
|
||||
fish_color_param B3B1AD
|
||||
fish_color_comment 626A73
|
||||
fish_color_selection --background=E6B450 --bold
|
||||
|
||||
@@ -10,7 +10,7 @@ fish_color_comment ABB0B6
|
||||
fish_color_cwd 399EE6
|
||||
fish_color_cwd_root red
|
||||
fish_color_end ED9366
|
||||
fish_color_error F51818 --underline=curly
|
||||
fish_color_error F51818
|
||||
fish_color_escape 4CBF99
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -10,7 +10,7 @@ fish_color_comment 5C6773
|
||||
fish_color_cwd 73D0FF
|
||||
fish_color_cwd_root red
|
||||
fish_color_end F29E74
|
||||
fish_color_error FF3333 --underline=curly
|
||||
fish_color_error FF3333
|
||||
fish_color_escape 95E6CB
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -9,7 +9,7 @@ fish_color_comment '888' '--italics'
|
||||
fish_color_cwd 0A0
|
||||
fish_color_cwd_root A00
|
||||
fish_color_end 009900
|
||||
fish_color_error F22 --underline=curly
|
||||
fish_color_error F22
|
||||
fish_color_escape 0AA
|
||||
fish_color_history_current 0AA
|
||||
fish_color_host normal
|
||||
|
||||
@@ -11,7 +11,7 @@ fish_color_comment red
|
||||
fish_color_cwd green
|
||||
fish_color_cwd_root red
|
||||
fish_color_end green
|
||||
fish_color_error brred --underline=curly
|
||||
fish_color_error brred
|
||||
fish_color_escape brcyan
|
||||
fish_color_history_current --bold
|
||||
fish_color_host normal
|
||||
|
||||
@@ -244,7 +244,7 @@ def parse_color(color_str):
|
||||
underline = "single"
|
||||
elif comp.startswith("--underline="):
|
||||
underline = comp.stripprefix("--underline=")
|
||||
elif comp.startswith("-u"): # Multiple short options like "-rbcurly" are not yet supported.
|
||||
elif comp.startswith("-u"): # Multiple short options like "-rucurly" are not yet supported.
|
||||
underline = comp.stripprefix("-u")
|
||||
elif comp == "--italics" or comp == "-i":
|
||||
italics = True
|
||||
|
||||
2641
src/ast.rs
2641
src/ast.rs
File diff suppressed because it is too large
Load Diff
198
src/autoload.rs
198
src/autoload.rs
@@ -9,7 +9,9 @@
|
||||
#[cfg(test)]
|
||||
use crate::tests::prelude::*;
|
||||
use crate::wchar::{wstr, WString, L};
|
||||
use crate::wchar_ext::WExt;
|
||||
use crate::wutil::{file_id_for_path, FileId, INVALID_FILE_ID};
|
||||
use crate::FLOGF;
|
||||
use lru::LruCache;
|
||||
#[cfg(feature = "embed-data")]
|
||||
use rust_embed::RustEmbed;
|
||||
@@ -56,6 +58,12 @@ pub fn has_asset(_cmd: &str) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Eq, PartialEq)]
|
||||
enum AssetDir {
|
||||
Functions,
|
||||
Completions,
|
||||
}
|
||||
|
||||
pub enum AutoloadPath {
|
||||
#[cfg(feature = "embed-data")]
|
||||
Embedded(String),
|
||||
@@ -63,7 +71,7 @@ pub enum AutoloadPath {
|
||||
}
|
||||
|
||||
enum AutoloadResult {
|
||||
Path(WString),
|
||||
Path(AutoloadPath),
|
||||
Loaded,
|
||||
Pending,
|
||||
None,
|
||||
@@ -97,71 +105,33 @@ pub fn new(env_var_name: &'static wstr) -> Self {
|
||||
/// mark_autoload_finished() with the same command. Note this does not actually execute any
|
||||
/// code; it is the caller's responsibility to load the file.
|
||||
pub fn resolve_command(&mut self, cmd: &wstr, env: &dyn Environment) -> Option<AutoloadPath> {
|
||||
use crate::wchar_ext::WExt;
|
||||
|
||||
let mut possible_path = None;
|
||||
if let Some(var) = env.get(self.env_var_name) {
|
||||
match self.resolve_command_impl(cmd, var.as_list()) {
|
||||
AutoloadResult::Path(path) => {
|
||||
crate::FLOGF!(autoload, "Loading from path with var: %ls", path);
|
||||
// HACK: Ignore generated_completions until we tried the embedded assets
|
||||
if path
|
||||
.find("/generated_completions/".chars().collect::<Vec<_>>())
|
||||
.is_some()
|
||||
{
|
||||
possible_path = Some(path);
|
||||
} else {
|
||||
return Some(AutoloadPath::Path(path));
|
||||
match self.resolve_command_impl(
|
||||
cmd,
|
||||
env.get(self.env_var_name)
|
||||
.as_ref()
|
||||
.map(|var| var.as_list())
|
||||
.unwrap_or_default(),
|
||||
) {
|
||||
AutoloadResult::Path(path) => {
|
||||
match &path {
|
||||
#[cfg(feature = "embed-data")]
|
||||
AutoloadPath::Embedded(_) => {
|
||||
FLOGF!(autoload, "Embedded: %ls", cmd);
|
||||
}
|
||||
AutoloadPath::Path(path) => {
|
||||
FLOGF!(
|
||||
autoload,
|
||||
"Loading %ls from var %ls from path %ls",
|
||||
cmd,
|
||||
self.env_var_name,
|
||||
path
|
||||
)
|
||||
}
|
||||
}
|
||||
AutoloadResult::Loaded => return None,
|
||||
AutoloadResult::Pending => return None,
|
||||
AutoloadResult::None => (),
|
||||
};
|
||||
} else {
|
||||
match self.resolve_command_impl(cmd, &[]) {
|
||||
AutoloadResult::Path(path) => {
|
||||
crate::FLOGF!(autoload, "Loading from path with var: %ls", path);
|
||||
return Some(AutoloadPath::Path(path));
|
||||
}
|
||||
AutoloadResult::Loaded => return None,
|
||||
AutoloadResult::Pending => return None,
|
||||
AutoloadResult::None => (),
|
||||
};
|
||||
}
|
||||
|
||||
// HACK: In cargo tests, this used to never load functions
|
||||
// It will hang for reasons unrelated to this.
|
||||
if cfg!(test) {
|
||||
return None;
|
||||
}
|
||||
|
||||
#[cfg(feature = "embed-data")]
|
||||
{
|
||||
let narrow = wcs2string(cmd);
|
||||
let cmdstr = std::str::from_utf8(&narrow).ok()?;
|
||||
let p = if self.env_var_name == "fish_function_path" {
|
||||
"functions/".to_owned() + cmdstr + ".fish"
|
||||
} else if self.env_var_name == "fish_complete_path" {
|
||||
"completions/".to_owned() + cmdstr + ".fish"
|
||||
} else {
|
||||
return None;
|
||||
};
|
||||
if has_asset(&p) {
|
||||
if let Some(loaded_file) = self.autoloaded_files.get(cmd) {
|
||||
if *loaded_file == INVALID_FILE_ID {
|
||||
// The file has been autoloaded and is unchanged.
|
||||
return None;
|
||||
}
|
||||
}
|
||||
self.current_autoloading.insert(cmd.to_owned());
|
||||
self.autoloaded_files
|
||||
.insert(cmd.to_owned(), INVALID_FILE_ID);
|
||||
crate::FLOGF!(autoload, "Embedded: %ls", cmd);
|
||||
return Some(AutoloadPath::Embedded(p));
|
||||
Some(path)
|
||||
}
|
||||
AutoloadResult::Loaded | AutoloadResult::Pending | AutoloadResult::None => None,
|
||||
}
|
||||
possible_path.map(AutoloadPath::Path)
|
||||
}
|
||||
|
||||
/// Helper to actually perform an autoload.
|
||||
@@ -182,7 +152,7 @@ pub fn perform_autoload(path: &AutoloadPath, parser: &Parser) {
|
||||
AutoloadPath::Embedded(name) => {
|
||||
use crate::common::str2wcstring;
|
||||
use std::sync::Arc;
|
||||
crate::FLOGF!(autoload, "Loading embedded: %ls", name);
|
||||
FLOGF!(autoload, "Loading embedded: %ls", name);
|
||||
let emfile = Asset::get(name).expect("Embedded file not found");
|
||||
let src = str2wcstring(&emfile.data);
|
||||
let mut widename = L!("embedded:").to_owned();
|
||||
@@ -209,7 +179,9 @@ pub fn autoload_in_progress(&self, cmd: &wstr) -> bool {
|
||||
/// Return whether a command could potentially be autoloaded.
|
||||
/// This does not actually mark the command as being autoloaded.
|
||||
pub fn can_autoload(&mut self, cmd: &wstr) -> bool {
|
||||
self.cache.check(cmd, true /* allow stale */).is_some()
|
||||
self.cache
|
||||
.check(self.env_var_name, cmd, true /* allow stale */)
|
||||
.is_some()
|
||||
}
|
||||
|
||||
/// Return whether autoloading has been attempted for a command.
|
||||
@@ -259,13 +231,19 @@ fn resolve_command_impl(&mut self, cmd: &wstr, paths: &[WString]) -> AutoloadRes
|
||||
}
|
||||
|
||||
// Do we have an entry to load?
|
||||
let Some(file) = self.cache.check(cmd, false) else {
|
||||
let Some(file) = self.cache.check(self.env_var_name, cmd, false) else {
|
||||
return AutoloadResult::None;
|
||||
};
|
||||
|
||||
let file_id = match &file {
|
||||
AutoloadableFileInfo::FileInfo(file) => &file.file_id,
|
||||
#[cfg(feature = "embed-data")]
|
||||
AutoloadableFileInfo::EmbeddedPath(_) => &INVALID_FILE_ID,
|
||||
};
|
||||
|
||||
// Is this file the same as what we previously autoloaded?
|
||||
if let Some(loaded_file) = self.autoloaded_files.get(cmd) {
|
||||
if *loaded_file == file.file_id {
|
||||
if *loaded_file == *file_id {
|
||||
// The file has been autoloaded and is unchanged.
|
||||
return AutoloadResult::Loaded;
|
||||
}
|
||||
@@ -273,8 +251,13 @@ fn resolve_command_impl(&mut self, cmd: &wstr, paths: &[WString]) -> AutoloadRes
|
||||
|
||||
// We're going to (tell our caller to) autoload this command.
|
||||
self.current_autoloading.insert(cmd.to_owned());
|
||||
self.autoloaded_files.insert(cmd.to_owned(), file.file_id);
|
||||
AutoloadResult::Path(file.path)
|
||||
self.autoloaded_files
|
||||
.insert(cmd.to_owned(), file_id.clone());
|
||||
AutoloadResult::Path(match file {
|
||||
AutoloadableFileInfo::FileInfo(path) => AutoloadPath::Path(path.path),
|
||||
#[cfg(feature = "embed-data")]
|
||||
AutoloadableFileInfo::EmbeddedPath(path) => AutoloadPath::Embedded(path),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,19 +266,28 @@ fn resolve_command_impl(&mut self, cmd: &wstr, paths: &[WString]) -> AutoloadRes
|
||||
|
||||
/// Represents a file that we might want to autoload.
|
||||
#[derive(Clone)]
|
||||
struct AutoloadableFile {
|
||||
struct FileInfo {
|
||||
/// The path to the file.
|
||||
path: WString,
|
||||
/// The metadata for the file.
|
||||
file_id: FileId,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
enum AutoloadableFileInfo {
|
||||
/// An on-disk file.
|
||||
FileInfo(FileInfo),
|
||||
/// An embedded file.
|
||||
#[cfg(feature = "embed-data")]
|
||||
EmbeddedPath(String),
|
||||
}
|
||||
|
||||
// A timestamp is a monotonic point in time.
|
||||
type Timestamp = time::Instant;
|
||||
type MissesLruCache = LruCache<WString, Timestamp>;
|
||||
|
||||
struct KnownFile {
|
||||
file: AutoloadableFile,
|
||||
file: AutoloadableFileInfo,
|
||||
last_checked: Timestamp,
|
||||
}
|
||||
|
||||
@@ -343,10 +335,32 @@ fn dirs(&self) -> &[WString] {
|
||||
/// Check if a command `cmd` can be loaded.
|
||||
/// If `allow_stale` is true, allow stale entries; otherwise discard them.
|
||||
/// This returns an autoloadable file, or none() if there is no such file.
|
||||
fn check(&mut self, cmd: &wstr, allow_stale: bool) -> Option<AutoloadableFile> {
|
||||
fn check(
|
||||
&mut self,
|
||||
env_var_name: &wstr,
|
||||
cmd: &wstr,
|
||||
allow_stale: bool,
|
||||
) -> Option<AutoloadableFileInfo> {
|
||||
let asset_dir = cfg!(feature = "embed-data").then_some(()).and_then(|()| {
|
||||
if env_var_name == "fish_function_path" {
|
||||
Some(AssetDir::Functions)
|
||||
} else if cfg!(feature = "embed-data") && env_var_name == "fish_complete_path" {
|
||||
Some(AssetDir::Completions)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
|
||||
// Check hits.
|
||||
if let Some(value) = self.known_files.get(cmd) {
|
||||
if allow_stale || Self::is_fresh(value.last_checked, Self::current_timestamp()) {
|
||||
#[cfg(feature = "embed-data")]
|
||||
let embedded = matches!(value.file, AutoloadableFileInfo::EmbeddedPath(_));
|
||||
#[cfg(not(feature = "embed-data"))]
|
||||
let embedded = false;
|
||||
if allow_stale
|
||||
|| embedded
|
||||
|| Self::is_fresh(value.last_checked, Self::current_timestamp())
|
||||
{
|
||||
// Re-use this cached hit.
|
||||
return Some(value.file.clone());
|
||||
}
|
||||
@@ -365,7 +379,10 @@ fn check(&mut self, cmd: &wstr, allow_stale: bool) -> Option<AutoloadableFile> {
|
||||
}
|
||||
|
||||
// We couldn't satisfy this request from the cache. Hit the disk.
|
||||
let file = self.locate_file(cmd);
|
||||
let file = self
|
||||
.locate_file(cmd, asset_dir, false)
|
||||
.or_else(|| self.locate_asset(cmd, asset_dir?))
|
||||
.or_else(|| self.locate_file(cmd, asset_dir, true));
|
||||
if let Some(file) = file.as_ref() {
|
||||
let old_value = self.known_files.insert(
|
||||
cmd.to_owned(),
|
||||
@@ -408,7 +425,12 @@ fn is_fresh(then: Timestamp, now: Timestamp) -> bool {
|
||||
|
||||
/// Attempt to find an autoloadable file by searching our path list for a given command.
|
||||
/// Return the file, or none() if none.
|
||||
fn locate_file(&self, cmd: &wstr) -> Option<AutoloadableFile> {
|
||||
fn locate_file(
|
||||
&self,
|
||||
cmd: &wstr,
|
||||
asset_dir: Option<AssetDir>,
|
||||
want_generated_completions: bool,
|
||||
) -> Option<AutoloadableFileInfo> {
|
||||
// If the command is empty or starts with NULL (i.e. is empty as a path)
|
||||
// we'd try to source the *directory*, which exists.
|
||||
// So instead ignore these here.
|
||||
@@ -421,6 +443,12 @@ fn locate_file(&self, cmd: &wstr) -> Option<AutoloadableFile> {
|
||||
// Re-use the storage for path.
|
||||
let mut path;
|
||||
for dir in self.dirs() {
|
||||
if asset_dir == Some(AssetDir::Completions) {
|
||||
// HACK: Ignore generated_completions until we tried the embedded assets
|
||||
if dir.ends_with(L!("/generated_completions")) != want_generated_completions {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Construct the path as dir/cmd.fish
|
||||
path = dir.to_owned();
|
||||
path.push('/');
|
||||
@@ -430,11 +458,31 @@ fn locate_file(&self, cmd: &wstr) -> Option<AutoloadableFile> {
|
||||
let file_id = file_id_for_path(&path);
|
||||
if file_id != INVALID_FILE_ID {
|
||||
// Found it.
|
||||
return Some(AutoloadableFile { path, file_id });
|
||||
return Some(AutoloadableFileInfo::FileInfo(FileInfo { path, file_id }));
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "embed-data"))]
|
||||
fn locate_asset(&self, _cmd: &wstr, _asset_dir: AssetDir) -> Option<AutoloadableFileInfo> {
|
||||
None
|
||||
}
|
||||
#[cfg(feature = "embed-data")]
|
||||
fn locate_asset(&self, cmd: &wstr, asset_dir: AssetDir) -> Option<AutoloadableFileInfo> {
|
||||
// HACK: In cargo tests, this used to never load functions
|
||||
// It will hang for reasons unrelated to this.
|
||||
if cfg!(test) {
|
||||
return None;
|
||||
}
|
||||
let narrow = wcs2string(cmd);
|
||||
let cmdstr = std::str::from_utf8(&narrow).ok()?;
|
||||
let p = match asset_dir {
|
||||
AssetDir::Functions => "functions/".to_owned() + cmdstr + ".fish",
|
||||
AssetDir::Completions => "completions/".to_owned() + cmdstr + ".fish",
|
||||
};
|
||||
has_asset(&p).then_some(AutoloadableFileInfo::EmbeddedPath(p))
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
use fish::{
|
||||
ast::Ast,
|
||||
ast,
|
||||
builtins::{
|
||||
fish_indent, fish_key_reader,
|
||||
shared::{
|
||||
@@ -226,7 +226,7 @@ fn run_command_list(parser: &Parser, cmds: &[OsString]) -> Result<(), libc::c_in
|
||||
let cmd_wcs = str2wcstring(cmd.as_bytes());
|
||||
|
||||
let mut errors = ParseErrorList::new();
|
||||
let ast = Ast::parse(&cmd_wcs, ParseTreeFlags::empty(), Some(&mut errors));
|
||||
let ast = ast::parse(&cmd_wcs, ParseTreeFlags::empty(), Some(&mut errors));
|
||||
let errored = ast.errored() || {
|
||||
parse_util_detect_errors_in_ast(&ast, &cmd_wcs, Some(&mut errors)).is_err()
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::prelude::*;
|
||||
use crate::ast::{Ast, Leaf};
|
||||
use crate::ast::{self, Kind, Leaf};
|
||||
use crate::common::{unescape_string, UnescapeFlags, UnescapeStringStyle};
|
||||
use crate::complete::Completion;
|
||||
use crate::expand::{expand_string, ExpandFlags, ExpandResultCode};
|
||||
@@ -44,7 +44,7 @@ enum AppendMode {
|
||||
Append,
|
||||
}
|
||||
|
||||
enum TokenMode {
|
||||
enum TokenOutputMode {
|
||||
Expanded,
|
||||
Raw,
|
||||
Unescaped,
|
||||
@@ -108,7 +108,7 @@ fn strip_dollar_prefixes(insert_mode: AppendMode, prefix: &wstr, insert: &wstr)
|
||||
}
|
||||
insert.find(L!("$ "))?; // Early return.
|
||||
let source = prefix.to_owned() + insert;
|
||||
let ast = Ast::parse(
|
||||
let ast = ast::parse(
|
||||
&source,
|
||||
ParseTreeFlags::ACCEPT_INCOMPLETE_TOKENS | ParseTreeFlags::LEAVE_UNTERMINATED,
|
||||
None,
|
||||
@@ -116,7 +116,7 @@ fn strip_dollar_prefixes(insert_mode: AppendMode, prefix: &wstr, insert: &wstr)
|
||||
let mut stripped = WString::new();
|
||||
let mut have = prefix.len();
|
||||
for node in ast.walk() {
|
||||
let Some(ds) = node.as_decorated_statement() else {
|
||||
let Kind::DecoratedStatement(ds) = node.kind() else {
|
||||
continue;
|
||||
};
|
||||
let Some(range) = ds.command.range() else {
|
||||
@@ -151,7 +151,7 @@ fn write_part(
|
||||
range: Range<usize>,
|
||||
range_is_single_token: bool,
|
||||
cut_at_cursor: bool,
|
||||
token_mode: Option<TokenMode>,
|
||||
token_mode: Option<TokenOutputMode>,
|
||||
buffer: &wstr,
|
||||
cursor_pos: usize,
|
||||
streams: &mut IoStreams,
|
||||
@@ -171,7 +171,7 @@ fn write_part(
|
||||
let mut args = vec![];
|
||||
let mut add_token = |token_text: &wstr| {
|
||||
match token_mode {
|
||||
TokenMode::Expanded => {
|
||||
TokenOutputMode::Expanded => {
|
||||
const COMMANDLINE_TOKENS_MAX_EXPANSION: usize = 512;
|
||||
|
||||
match expand_string(
|
||||
@@ -199,10 +199,10 @@ fn write_part(
|
||||
ExpandResultCode::ok => (),
|
||||
};
|
||||
}
|
||||
TokenMode::Raw => {
|
||||
TokenOutputMode::Raw => {
|
||||
args.push(Completion::from_completion(token_text.to_owned()));
|
||||
}
|
||||
TokenMode::Unescaped => {
|
||||
TokenOutputMode::Unescaped => {
|
||||
let unescaped = unescape_string(
|
||||
token_text,
|
||||
UnescapeStringStyle::Script(UnescapeFlags::INCOMPLETE),
|
||||
@@ -218,10 +218,16 @@ fn write_part(
|
||||
add_token(buff);
|
||||
} else {
|
||||
let mut tok = Tokenizer::new(buff, TOK_ACCEPT_UNFINISHED);
|
||||
let mut in_redirection = false;
|
||||
while let Some(token) = tok.next() {
|
||||
if cut_at_cursor && token.end() >= pos {
|
||||
break;
|
||||
}
|
||||
let is_redirection_target = in_redirection;
|
||||
in_redirection = token.type_ == TokenType::redirect;
|
||||
if is_redirection_target && token.type_ == TokenType::string {
|
||||
continue;
|
||||
}
|
||||
if token.type_ != TokenType::string {
|
||||
continue;
|
||||
}
|
||||
@@ -319,9 +325,9 @@ pub fn commandline(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr])
|
||||
return Err(STATUS_INVALID_ARGS);
|
||||
}
|
||||
token_mode = Some(match c {
|
||||
'x' => TokenMode::Expanded,
|
||||
'\x02' => TokenMode::Raw,
|
||||
'o' => TokenMode::Unescaped,
|
||||
'x' => TokenOutputMode::Expanded,
|
||||
'\x02' => TokenOutputMode::Raw,
|
||||
'o' => TokenOutputMode::Unescaped,
|
||||
_ => unreachable!(),
|
||||
})
|
||||
}
|
||||
@@ -447,7 +453,7 @@ pub fn commandline(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr])
|
||||
streams.err.append(wgettext_fmt!(
|
||||
BUILTIN_ERR_COMBO2,
|
||||
cmd,
|
||||
"--cut-at-cursor and --tokens can not be used when setting the commandline"
|
||||
"--cut-at-cursor and token options can not be used when setting the commandline"
|
||||
));
|
||||
builtin_print_error_trailer(parser, streams.err, cmd);
|
||||
return Err(STATUS_INVALID_ARGS);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user