mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-14 00:47:30 +00:00
Merge branch 'master' into completions-update
This commit is contained in:
commit
4d596a8f1d
193 changed files with 1523 additions and 663 deletions
17
.clang-tidy
Normal file
17
.clang-tidy
Normal file
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
Checks: 'clang-diagnostic-*,clang-analyzer-*,cert-*,performance-*,portability-*,modernize-use-auto,modernize-loop-convert,modernize-use-bool-literals,modernize-use-using,hicpp-uppercase-literal-suffix,readability-make-member-function-const,readability-redundant-string-init,readability-inconsistent-declaration-parameter-name,readability-redundant-access-specifiers'
|
||||
WarningsAsErrors: ''
|
||||
HeaderFilterRegex: ''
|
||||
AnalyzeTemporaryDtors: false
|
||||
FormatStyle: File
|
||||
CheckOptions:
|
||||
- key: cert-dcl16-c.NewSuffixes
|
||||
value: 'L;LL;LU;LLU'
|
||||
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
|
||||
value: '0'
|
||||
- key: modernize-loop-convert.MinConfidence
|
||||
value: 'risky'
|
||||
- key: modernize-use-auto.RemoveStars
|
||||
value: '1'
|
||||
...
|
||||
|
16
.github/workflows/lockthreads.yml
vendored
Normal file
16
.github/workflows/lockthreads.yml
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
name: 'Lock threads'
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 * * * *'
|
||||
|
||||
jobs:
|
||||
lock:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/lock-threads@v2
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
issue-lock-inactive-days: '90'
|
||||
pr-lock-inactive-days: '90'
|
||||
issue-exclude-labels: 'question'
|
48
.github/workflows/main.yml
vendored
Normal file
48
.github/workflows/main.yml
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
name: C/C++ CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
ubuntu:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install deps
|
||||
run: |
|
||||
sudo apt install expect gettext libncurses5-dev libpcre2-dev
|
||||
- name: cmake
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
- name: make
|
||||
run: |
|
||||
make
|
||||
- name: make test
|
||||
run: |
|
||||
make test
|
||||
|
||||
# macos:
|
||||
|
||||
# runs-on: macos-latest
|
||||
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - name: Install deps
|
||||
# run: |
|
||||
# brew install pcre2
|
||||
# - name: cmake
|
||||
# run: |
|
||||
# mkdir build && cd build
|
||||
# cmake ..
|
||||
# - name: make
|
||||
# run: |
|
||||
# make
|
||||
# - name: make test
|
||||
# run: |
|
||||
# make test
|
|
@ -3,6 +3,9 @@
|
|||
## Notable improvements and fixes
|
||||
- `fish --no-execute` will no longer complain about unknown commands or non-matching wildcards, as these could be defined differently at runtime (especially for functions). #977
|
||||
- `jobs --quiet PID` will no longer print 'no suitable job' if the job for PID does not exist (e.g. because it has finished). #6809
|
||||
- A variable `fish_kill_signal` will be set to the signal that terminated the last foreground job, or `0` if the job exited normally.
|
||||
- On BSD systems, with the `-s` option, `fish_md5` does not use the given string, but `-s`. From now on the string is used.
|
||||
- Control-C no longer kills background jobs for which job control is disabled, matching POSIX semantics (#6828).
|
||||
|
||||
### Syntax changes and new commands
|
||||
|
||||
|
@ -14,6 +17,7 @@
|
|||
|
||||
#### New or improved bindings
|
||||
- New readline commands `undo` (Ctrl+_) and `redo` (Alt-/) can be used to revert changes to the command line or the pager search field (#6570).
|
||||
- New function `__fish_preview_current_file` (Alt+O) opens the current file at the cursor in a pager (#6838).
|
||||
|
||||
#### Improved prompts
|
||||
- The default and example prompts print the correct exit status for commands prefixed with `not` (#6566).
|
||||
|
@ -29,12 +33,17 @@
|
|||
- `tcpdump`
|
||||
- `tig`
|
||||
- `windscribe`
|
||||
- `zopfli`, and `zopflipng`
|
||||
- `nmap`, `ncat`
|
||||
- `nc`, `netcat`, `nc.openbsd`, `nc.traditional`
|
||||
|
||||
### Deprecations and removed features
|
||||
|
||||
### For distributors and developers
|
||||
- fish source tarballs are now distributed using the XZ compression method (#5460).
|
||||
- Allow finishing builds on OS X <10.13.6 (previously builds would fail at the `codesign` step)
|
||||
- The pkg-config file now uses pkg-config variables
|
||||
- The default values for the extra_completionsdir, extra_functionsdir and extra_confdir options now use the installation prefix instead of hardcoding `/usr/local`
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ endif()
|
|||
include(cmake/Mac.cmake)
|
||||
|
||||
project(fish)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# We are C++11.
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
@ -217,11 +218,11 @@ include(cmake/MacApp.cmake)
|
|||
# CMake does not support the "iquote" flag - https://gitlab.kitware.com/cmake/cmake/issues/15491
|
||||
set(LINT_ARGS "-D$<JOIN:$<TARGET_PROPERTY:fishlib,COMPILE_DEFINITIONS>, -D>" "-I$<JOIN:$<TARGET_PROPERTY:fishlib,INCLUDE_DIRECTORIES>, -I>")
|
||||
add_custom_target(lint
|
||||
COMMAND build_tools/lint.fish -- ${LINT_ARGS}
|
||||
COMMAND build_tools/lint.fish -p ${CMAKE_BINARY_DIR} -- ${LINT_ARGS}
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
add_custom_target(lint-all
|
||||
COMMAND build_tools/lint.fish --all -- ${LINT_ARGS}
|
||||
COMMAND build_tools/lint.fish --all -p ${CMAKE_BINARY_DIR} -- ${LINT_ARGS}
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ set all no
|
|||
set kernel_name (uname -s)
|
||||
set machine_type (uname -m)
|
||||
|
||||
argparse a/all -- $argv
|
||||
argparse a/all p/project= -- $argv
|
||||
|
||||
# We only want -D and -I options to be passed thru to cppcheck.
|
||||
for arg in $argv
|
||||
|
@ -117,6 +117,14 @@ if set -q c_files[1]
|
|||
# output will expect those messages to be written to stdout.
|
||||
oclint $c_files -- $argv 2>&1
|
||||
end
|
||||
|
||||
if type -q clang-tidy; and set -q _flag_project
|
||||
echo
|
||||
echo ========================================
|
||||
echo Running clang-tidy
|
||||
echo ========================================
|
||||
clang-tidy -p $_flag_project $c_files
|
||||
end
|
||||
else
|
||||
echo
|
||||
echo 'WARNING: No C/C++ files to check'
|
||||
|
|
|
@ -24,16 +24,20 @@ set(configure_input
|
|||
"This file was generated from a corresponding .in file.\
|
||||
DO NOT MANUALLY EDIT THIS FILE!")
|
||||
|
||||
set(rel_completionsdir "fish/vendor_completions.d")
|
||||
set(rel_functionsdir "fish/vendor_functions.d")
|
||||
set(rel_confdir "fish/vendor_conf.d")
|
||||
|
||||
set(extra_completionsdir
|
||||
/usr/local/share/fish/vendor_completions.d
|
||||
"${datadir}/${rel_completionsdir}"
|
||||
CACHE STRING "Path for extra completions")
|
||||
|
||||
set(extra_functionsdir
|
||||
/usr/local/share/fish/vendor_functions.d
|
||||
"${datadir}/${rel_functionsdir}"
|
||||
CACHE STRING "Path for extra functions")
|
||||
|
||||
set(extra_confdir
|
||||
/usr/local/share/fish/vendor_conf.d
|
||||
"${datadir}/${rel_confdir}"
|
||||
CACHE STRING "Path for extra configuration")
|
||||
|
||||
# These are the man pages that go in system manpath; all manpages go in the fish-specific manpath.
|
||||
|
@ -99,7 +103,7 @@ fish_create_dirs(${rel_datadir}/fish/vendor_completions.d ${rel_datadir}/fish/ve
|
|||
${rel_datadir}/fish/vendor_conf.d)
|
||||
|
||||
fish_try_create_dirs(${rel_datadir}/pkgconfig)
|
||||
configure_file(fish.pc.in fish.pc.noversion)
|
||||
configure_file(fish.pc.in fish.pc.noversion @ONLY)
|
||||
|
||||
add_custom_command(OUTPUT fish.pc
|
||||
COMMAND sed '/Version/d' fish.pc.noversion > fish.pc
|
||||
|
|
2
debian/control
vendored
2
debian/control
vendored
|
@ -25,7 +25,7 @@ Package: fish-common
|
|||
Architecture: all
|
||||
Multi-Arch: foreign
|
||||
Depends: ${misc:Depends}
|
||||
Recommends: fish, python3 (>= 3.5)
|
||||
Recommends: fish, python3 (>= 3.5), python3-distutils
|
||||
Suggests: xdg-utils
|
||||
Replaces: fish (<= 2.1.1.dfsg-2)
|
||||
Description: friendly interactive shell (architecture-independent files)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.. _cmd-breakpoint:
|
||||
|
||||
breakpoint - Launch debug mode
|
||||
breakpoint - launch debug mode
|
||||
==============================
|
||||
|
||||
Synopsis
|
||||
|
|
|
@ -27,8 +27,6 @@ As a special case, ``cd .`` is equivalent to ``cd $PWD``, which is useful in cas
|
|||
Examples
|
||||
--------
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
cd
|
||||
|
@ -37,8 +35,7 @@ Examples
|
|||
cd /usr/src/fish-shell
|
||||
# changes the working directory to /usr/src/fish-shell
|
||||
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
See also the :ref:`cdh <cmd-cdh>` command for changing to a recently visited directory.
|
||||
Navigate directories using the :ref:`directory history <directory-history>` or the :ref:`directory stack <directory-stack>`
|
||||
|
|
|
@ -10,15 +10,16 @@ Synopsis
|
|||
|
||||
cdh [ directory ]
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
``cdh`` with no arguments presents a list of recently visited directories. You can then select one of the entries by letter or number. You can also press :kbd:`Tab` to use the completion pager to select an item from the list. If you give it a single argument it is equivalent to ``cd directory``.
|
||||
``cdh`` with no arguments presents a list of :ref:`recently visited directories <directory-history>`. You can then select one of the entries by letter or number. You can also press :kbd:`Tab` to use the completion pager to select an item from the list. If you give it a single argument it is equivalent to ``cd directory``.
|
||||
|
||||
Note that the ``cd`` command limits directory history to the 25 most recently visited directories. The history is stored in the ``$dirprev`` and ``$dirnext`` variables which this command manipulates. If you make those universal variables your ``cd`` history is shared among all fish instances.
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
See also the :ref:`prevd <cmd-prevd>` and :ref:`pushd <cmd-pushd>` commands which also work with the recent ``cd`` history and are provided for compatibility with other shells.
|
||||
- the :ref:`dirh <cmd-dirh>` command to print the directory history
|
||||
- the :ref:`prevd <cmd-prevd>` command to move backward
|
||||
- the :ref:`nextd <cmd-nextd>` command to move forward
|
||||
|
|
|
@ -83,7 +83,7 @@ The `echo $flounder >&` is the first process, `less` the second and `and echo $c
|
|||
|
||||
`$flounder` is the current token.
|
||||
|
||||
More examples::
|
||||
More examples:
|
||||
|
||||
|
||||
::
|
||||
|
|
|
@ -76,13 +76,13 @@ the fish manual.
|
|||
|
||||
- ``-u`` and ``--unauthoritative`` no longer do anything and are silently ignored.
|
||||
|
||||
Command specific tab-completions in ``fish`` are based on the notion of options and arguments. An option is a parameter which begins with a hyphen, such as '``-h``', '``-help``' or '``--help``'. Arguments are parameters that do not begin with a hyphen. Fish recognizes three styles of options, the same styles as the GNU version of the getopt library. These styles are:
|
||||
Command specific tab-completions in ``fish`` are based on the notion of options and arguments. An option is a parameter which begins with a hyphen, such as ``-h``, ``-help`` or ``--help``. Arguments are parameters that do not begin with a hyphen. Fish recognizes three styles of options, the same styles as the GNU version of the getopt library. These styles are:
|
||||
|
||||
- Short options, like '``-a``'. Short options are a single character long, are preceded by a single hyphen and may be grouped together (like '``-la``', which is equivalent to '``-l -a``'). Option arguments may be specified in the following parameter ('``-w 32``') or by appending the option with the value ('``-w32``').
|
||||
- Short options, like ``-a``. Short options are a single character long, are preceded by a single hyphen and may be grouped together (like ``-la``, which is equivalent to ``-l -a``). Option arguments may be specified in the following parameter (``-w 32``) or by appending the option with the value (``-w32``).
|
||||
|
||||
- Old style long options, like '``-Wall``'. Old style long options can be more than one character long, are preceded by a single hyphen and may not be grouped together. Option arguments are specified in the following parameter ('``-ao null``').
|
||||
- Old style long options, like ``-Wall``. Old style long options can be more than one character long, are preceded by a single hyphen and may not be grouped together. Option arguments are specified in the following parameter (``-ao null``).
|
||||
|
||||
- GNU style long options, like '``--colors``'. GNU style long options can be more than one character long, are preceded by two hyphens, and may not be grouped together. Option arguments may be specified in the following parameter ('``--quoting-style shell``') or by appending the option with a '``=``' and the value ('``--quoting-style=shell``'). GNU style long options may be abbreviated so long as the abbreviation is unique ('``--h``') is equivalent to '``--help``' if help is the only long option beginning with an 'h').
|
||||
- GNU style long options, like ``--colors``. GNU style long options can be more than one character long, are preceded by two hyphens, and may not be grouped together. Option arguments may be specified in the following parameter (``--quoting-style shell``) or by appending the option with a ``=`` and the value (``--quoting-style=shell``). GNU style long options may be abbreviated so long as the abbreviation is unique (``--h``) is equivalent to ``--help`` if help is the only long option beginning with an 'h').
|
||||
|
||||
The options for specifying command name and command path may be used multiple times to define the same completions for multiple commands.
|
||||
|
||||
|
@ -111,7 +111,7 @@ The short style option ``-o`` for the ``gcc`` command requires that a file follo
|
|||
complete -c gcc -s o -r
|
||||
|
||||
|
||||
The short style option ``-d`` for the ``grep`` command requires that one of the strings '``read``', '``skip``' or '``recurse``' is used. This can be specified writing:
|
||||
The short style option ``-d`` for the ``grep`` command requires that one of the strings ``read``, ``skip`` or ``recurse`` is used. This can be specified writing:
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -13,8 +13,15 @@ Synopsis
|
|||
Description
|
||||
-----------
|
||||
|
||||
``dirh`` prints the current directory history. The current position in the history is highlighted using the color defined in the ``fish_color_history_current`` environment variable.
|
||||
``dirh`` prints the current :ref:`directory history <directory-history>`. The current position in the history is highlighted using the color defined in the ``fish_color_history_current`` environment variable.
|
||||
|
||||
``dirh`` does not accept any parameters.
|
||||
|
||||
Note that the ``cd`` command limits directory history to the 25 most recently visited directories. The history is stored in the ``$dirprev`` and ``$dirnext`` variables.
|
||||
Note that the :ref:`cd <cmd-cd>` command limits directory history to the 25 most recently visited directories. The history is stored in the ``$dirprev`` and ``$dirnext`` variables.
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
- the :ref:`cdh <cmd-cdh>` command to display a prompt to quickly navigate the history
|
||||
- the :ref:`prevd <cmd-prevd>` command to move backward
|
||||
- the :ref:`nextd <cmd-nextd>` command to move forward
|
||||
|
|
|
@ -14,8 +14,13 @@ Synopsis
|
|||
Description
|
||||
-----------
|
||||
|
||||
``dirs`` prints the current directory stack, as created by :ref:`pushd <cmd-pushd>` and modified by :ref:`popd <cmd-popd>`.
|
||||
``dirs`` prints the current :ref:`directory stack <directory-stack>`, as created by :ref:`pushd <cmd-pushd>` and modified by :ref:`popd <cmd-popd>`.
|
||||
|
||||
With "-c", it clears the directory stack instead.
|
||||
|
||||
``dirs`` does not accept any parameters.
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
- the :ref:`cdh <cmd-cdh>` command which provides a more intuitive way to navigate to recently visited directories.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.. _cmd-emit:
|
||||
|
||||
emit - Emit a generic event
|
||||
emit - emit a generic event
|
||||
===========================
|
||||
|
||||
Synopsis
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.. _cmd-end:
|
||||
|
||||
end - end a block of commands.
|
||||
==============================
|
||||
end - end a block of commands
|
||||
=============================
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
|
|
|
@ -21,10 +21,6 @@ The following options are available:
|
|||
|
||||
- ``-c`` or ``--continuous`` begins a session where multiple key sequences can be inspected. By default the program exits after capturing a single key sequence.
|
||||
|
||||
- ``-d`` or ``--debug=CATEGORY_GLOB`` enables debug output and specifies a glob for matching debug categories (like ``fish -d``). Defaults to empty.
|
||||
|
||||
- ``-D`` or ``--debug-stack-frames=DEBUG_LEVEL`` specify how many stack frames to display when debug messages are written. The default is zero. A value of 3 or 4 is usually sufficient to gain insight into how a given debug call was reached but you can specify a value up to 128.
|
||||
|
||||
- ``-h`` or ``--help`` prints usage information.
|
||||
|
||||
- ``-v`` or ``--version`` prints fish_key_reader's version and exits.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.. _cmd-fish_update_completions:
|
||||
|
||||
fish_update_completions - Update completions using manual pages
|
||||
fish_update_completions - update completions using manual pages
|
||||
===============================================================
|
||||
|
||||
Synopsis
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.. _cmd-for:
|
||||
|
||||
for - perform a set of commands multiple times.
|
||||
===============================================
|
||||
for - perform a set of commands multiple times
|
||||
==============================================
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.. _cmd-history:
|
||||
|
||||
history - Show and manipulate command history
|
||||
history - show and manipulate command history
|
||||
=============================================
|
||||
|
||||
Synopsis
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.. _cmd-math:
|
||||
|
||||
math - Perform mathematics calculations
|
||||
math - perform mathematics calculations
|
||||
=======================================
|
||||
|
||||
Synopsis
|
||||
|
|
|
@ -10,23 +10,18 @@ Synopsis
|
|||
|
||||
nextd [ -l | --list ] [POS]
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
``nextd`` moves forwards ``POS`` positions in the history of visited directories; if the end of the history has been hit, a warning is printed.
|
||||
``nextd`` moves forwards ``POS`` positions in the :ref:`history of visited directories <directory-history>`; if the end of the history has been hit, a warning is printed.
|
||||
|
||||
If the ``-l`` or ``--list`` flag is specified, the current directory history is also displayed.
|
||||
|
||||
Note that the ``cd`` command limits directory history to the 25 most recently visited directories. The history is stored in the ``$dirprev`` and ``$dirnext`` variables which this command manipulates.
|
||||
|
||||
You may be interested in the :ref:`cdh <cmd-cdh>` command which provides a more intuitive way to navigate to recently visited directories.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
cd /usr/src
|
||||
|
@ -41,3 +36,9 @@ Example
|
|||
nextd
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
- the :ref:`cdh <cmd-cdh>` command to display a prompt to quickly navigate the history
|
||||
- the :ref:`dirh <cmd-dirh>` command to print the directory history
|
||||
- the :ref:`prevd <cmd-prevd>` command to move backward
|
||||
|
|
|
@ -10,13 +10,10 @@ Synopsis
|
|||
|
||||
popd
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
``popd`` removes the top directory from the directory stack and changes the working directory to the new top directory. Use :ref:`pushd <cmd-pushd>` to add directories to the stack or :ref:`dirs <cmd-dirs>` to print it.
|
||||
|
||||
You may be interested in the :ref:`cdh <cmd-cdh>` command which provides a more intuitive way to navigate to recently visited directories.
|
||||
``popd`` removes the top directory from the :ref:`directory stack <directory-stack>` and changes the working directory to the new top directory. Use :ref:`pushd <cmd-pushd>` to add directories to the stack.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
@ -35,3 +32,8 @@ Example
|
|||
# Working directory is now /usr/src
|
||||
# Directory stack contains /usr/src
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
- the :ref:`dirs <cmd-dirs>` command to print the directory stack
|
||||
- the :ref:`cdh <cmd-cdh>` command which provides a more intuitive way to navigate to recently visited directories.
|
||||
|
|
|
@ -13,19 +13,15 @@ Synopsis
|
|||
Description
|
||||
-----------
|
||||
|
||||
``prevd`` moves backwards ``POS`` positions in the history of visited directories; if the beginning of the history has been hit, a warning is printed.
|
||||
``prevd`` moves backwards ``POS`` positions in the :ref:`history of visited directories <directory-history>`; if the beginning of the history has been hit, a warning is printed.
|
||||
|
||||
If the ``-l`` or ``--list`` flag is specified, the current history is also displayed.
|
||||
|
||||
Note that the ``cd`` command limits directory history to the 25 most recently visited directories. The history is stored in the ``$dirprev`` and ``$dirnext`` variables which this command manipulates.
|
||||
|
||||
You may be interested in the :ref:`cdh <cmd-cdh>` command which provides a more intuitive way to navigate to recently visited directories.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
|
||||
|
||||
::
|
||||
|
||||
cd /usr/src
|
||||
|
@ -40,3 +36,9 @@ Example
|
|||
nextd
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
- the :ref:`cdh <cmd-cdh>` command to display a prompt to quickly navigate the history
|
||||
- the :ref:`dirh <cmd-dirh>` command to print the directory history
|
||||
- the :ref:`nextd <cmd-nextd>` command to move forward
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.. _cmd-prompt_pwd:
|
||||
|
||||
prompt_pwd - Print pwd suitable for prompt
|
||||
prompt_pwd - print pwd suitable for prompt
|
||||
==========================================
|
||||
|
||||
Synopsis
|
||||
|
|
|
@ -13,7 +13,7 @@ Synopsis
|
|||
Description
|
||||
-----------
|
||||
|
||||
The ``pushd`` function adds ``DIRECTORY`` to the top of the directory stack and makes it the current working directory. :ref:`popd <cmd-popd>` will pop it off and return to the original directory.
|
||||
The ``pushd`` function adds ``DIRECTORY`` to the top of the :ref:`directory stack <directory-stack>` and makes it the current working directory. :ref:`popd <cmd-popd>` will pop it off and return to the original directory.
|
||||
|
||||
Without arguments, it exchanges the top two directories in the stack.
|
||||
|
||||
|
@ -21,10 +21,6 @@ Without arguments, it exchanges the top two directories in the stack.
|
|||
|
||||
``pushd -NUMBER`` rotates clockwise i.e. top to bottom.
|
||||
|
||||
See also :ref:`dirs <cmd-dirs>` to print the stack and ``dirs -c`` to clear it.
|
||||
|
||||
You may be interested in the :ref:`cdh <cmd-cdh>` command which provides a more intuitive way to navigate to recently visited directories.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
|
@ -49,3 +45,9 @@ Example
|
|||
popd
|
||||
# Working directory is now /usr/src/fish-shell
|
||||
# Directory stack contains /usr/src/fish-shell /tmp
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
- the :ref:`dirs <cmd-dirs>` command to print the directory stack
|
||||
- the :ref:`cdh <cmd-cdh>` command which provides a more intuitive way to navigate to recently visited directories.
|
||||
|
|
|
@ -21,3 +21,8 @@ The following options are available:
|
|||
- ``-L`` or ``--logical`` Output the logical working directory, without resolving symlinks (default behavior).
|
||||
|
||||
- ``-P`` or ``--physical`` Output the physical working directory, with symlinks resolved.
|
||||
|
||||
See Also
|
||||
--------
|
||||
|
||||
Navigate directories using the :ref:`directory history <directory-history>` or the :ref:`directory stack <directory-stack>`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.. _cmd-realpath:
|
||||
|
||||
realpath - Convert a path to an absolute path without symlinks
|
||||
realpath - convert a path to an absolute path without symlinks
|
||||
==============================================================
|
||||
|
||||
Synopsis
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.. _cmd-set:
|
||||
|
||||
set - display and change shell variables.
|
||||
=========================================
|
||||
set - display and change shell variables
|
||||
========================================
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.. _cmd-source:
|
||||
|
||||
source - evaluate contents of file.
|
||||
===================================
|
||||
source - evaluate contents of file
|
||||
==================================
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
|
@ -19,7 +19,7 @@ Description
|
|||
|
||||
fish will search the working directory to resolve relative paths but will not search ``$PATH``.
|
||||
|
||||
If no file is specified and stdin is not the terminal, or if the file name '``-``' is used, stdin will be read.
|
||||
If no file is specified and stdin is not the terminal, or if the file name ``-`` is used, stdin will be read.
|
||||
|
||||
The exit status of ``source`` is the exit status of the last job to execute. If something goes wrong while opening or reading the file, ``source`` exits with a non-zero status.
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ Synopsis
|
|||
status function
|
||||
status line-number
|
||||
status stack-trace
|
||||
status job-control CONTROL-TYPE
|
||||
status job-control CONTROL_TYPE
|
||||
status features
|
||||
status test-feature FEATURE
|
||||
|
||||
|
@ -63,7 +63,7 @@ The following operations (sub-commands) are available:
|
|||
|
||||
- ``stack-trace`` prints a stack trace of all function calls on the call stack. Also ``print-stack-trace``, ``-t`` or ``--print-stack-trace``.
|
||||
|
||||
- ``job-control CONTROL-TYPE`` sets the job control type, which can be ``none``, ``full``, or ``interactive``. Also ``-j CONTROL-TYPE`` or ``--job-control=CONTROL-TYPE``.
|
||||
- ``job-control CONTROL_TYPE`` sets the job control type, which can be ``none``, ``full``, or ``interactive``. Also ``-j CONTROL_TYPE`` or ``--job-control CONTROL_TYPE``.
|
||||
|
||||
- ``features`` lists all available feature flags.
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ Synopsis
|
|||
|
||||
::
|
||||
|
||||
string split [(-m | --max) MAX] [(-n | --no-empty)] [(-q | --quiet)] [(-r | --right)] SEP [STRING...]
|
||||
string split0 [(-m | --max) MAX] [(-n | --no-empty)] [(-q | --quiet)] [(-r | --right)] [STRING...]
|
||||
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...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
|
@ -20,6 +20,8 @@ Description
|
|||
|
||||
``string split`` splits each STRING on the separator SEP, which can be an empty string. If ``-m`` or ``--max`` is specified, at most MAX splits are done on each STRING. If ``-r`` or ``--right`` is given, splitting is performed right-to-left. This is useful in combination with ``-m`` or ``--max``. With ``-n`` or ``--no-empty``, empty results are excluded from consideration (e.g. ``hello\n\nworld`` would expand to two strings and not three). Exit status: 0 if at least one split was performed, or 1 otherwise.
|
||||
|
||||
Use ``-f`` or ``--fields`` to print out specific fields. Unless ``--allow-empty`` is used, if a given field does not exist, then the command exits with status 1 and does not print anything.
|
||||
|
||||
See also the ``--delimiter`` option of the :ref:`read <cmd-read>` command.
|
||||
|
||||
``string split0`` splits each STRING on the zero byte (NUL). Options are the same as ``string split`` except that no separator is given.
|
||||
|
@ -49,6 +51,11 @@ Examples
|
|||
b
|
||||
c
|
||||
|
||||
>_ string split --allow-empty -f1,3,5 '' abc
|
||||
a
|
||||
c
|
||||
|
||||
|
||||
NUL Delimited Examples
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ which is logically equivalent to the following:
|
|||
Standards
|
||||
---------
|
||||
|
||||
``test`` implements a subset of the `IEEE Std 1003.1-2008 (POSIX.1) standard <http://www.unix.com/man-page/POSIX/1/test/>`__. The following exceptions apply:
|
||||
``test`` implements a subset of the `IEEE Std 1003.1-2008 (POSIX.1) standard <https://www.unix.com/man-page/posix/1p/test/>`__. The following exceptions apply:
|
||||
|
||||
- The ``<`` and ``>`` operators for comparing strings are not implemented.
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ To specify a completion, use the ``complete`` command. ``complete`` takes as a p
|
|||
|
||||
To provide a list of possible completions for myprog, use the ``-a`` switch. If ``myprog`` accepts the arguments start and stop, this can be specified as ``complete -c myprog -a 'start stop'``. The argument to the ``-a`` switch is always a single string. At completion time, it will be tokenized on spaces and tabs, and variable expansion, command substitution and other forms of parameter expansion will take place.
|
||||
|
||||
``fish`` has a special syntax to support specifying switches accepted by a command. The switches ``-s``, ``-l`` and ``-o`` are used to specify a short switch (single character, such as ``-l``), a gnu style long switch (such as '``--color``') and an old-style long switch (like '``-shuffle``'), respectively. If the command 'myprog' has an option '-o' which can also be written as '``--output``', and which can take an additional value of either 'yes' or 'no', this can be specified by writing::
|
||||
``fish`` has a special syntax to support specifying switches accepted by a command. The switches ``-s``, ``-l`` and ``-o`` are used to specify a short switch (single character, such as ``-l``), a gnu style long switch (such as ``--color``) and an old-style long switch (like ``-shuffle``), respectively. If the command 'myprog' has an option '-o' which can also be written as ``--output``, and which can take an additional value of either 'yes' or 'no', this can be specified by writing::
|
||||
|
||||
complete -c myprog -s o -l output -a "yes no"
|
||||
|
||||
|
@ -71,7 +71,7 @@ For examples of how to write your own complex completions, study the completions
|
|||
Useful functions for writing completions
|
||||
----------------------------------------
|
||||
|
||||
``fish`` ships with several functions that are very useful when writing command specific completions. Most of these functions name begins with the string '``__fish_``'. Such functions are internal to ``fish`` and their name and interface may change in future fish versions. Still, some of them may be very useful when writing completions. A few of these functions are described here. Be aware that they may be removed or changed in future versions of fish.
|
||||
``fish`` ships with several functions that are very useful when writing command specific completions. Most of these functions name begins with the string ``__fish_``. Such functions are internal to ``fish`` and their name and interface may change in future fish versions. Still, some of them may be very useful when writing completions. A few of these functions are described here. Be aware that they may be removed or changed in future versions of fish.
|
||||
|
||||
Functions beginning with the string ``__fish_print_`` print a newline separated list of strings. For example, ``__fish_print_filesystems`` prints a list of all known file systems. Functions beginning with ``__fish_complete_`` print out a newline separated list of completions with descriptions. The description is separated from the completion by a tab character.
|
||||
|
||||
|
@ -100,7 +100,7 @@ Functions beginning with the string ``__fish_print_`` print a newline separated
|
|||
Where to put completions
|
||||
------------------------
|
||||
|
||||
Completions can be defined on the commandline or in a configuration file, but they can also be automatically loaded. Fish automatically searches through any directories in the list variable ``$fish_complete_path``, and any completions defined are automatically loaded when needed. A completion file must have a filename consisting of the name of the command to complete and the suffix '``.fish``'.
|
||||
Completions can be defined on the commandline or in a configuration file, but they can also be automatically loaded. Fish automatically searches through any directories in the list variable ``$fish_complete_path``, and any completions defined are automatically loaded when needed. A completion file must have a filename consisting of the name of the command to complete and the suffix ``.fish``.
|
||||
|
||||
By default, Fish searches the following for completions, using the first available file that it finds:
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ Examples:
|
|||
|
||||
- Having both aliases and functions is confusing, especially since both of them have limitations and problems. ``fish`` functions have none of the drawbacks of either syntax.
|
||||
|
||||
- The many Posix quoting styles are silly, especially $''.
|
||||
- The many Posix quoting styles are silly, especially ``$``.
|
||||
|
||||
|
||||
The law of responsiveness
|
||||
|
|
|
@ -176,7 +176,7 @@ Use the web configuration tool, :ref:`fish_config <cmd-fish_config>`, or alter t
|
|||
|
||||
I accidentally entered a directory path and fish changed directory. What happened?
|
||||
----------------------------------------------------------------------------------
|
||||
If fish is unable to locate a command with a given name, and it starts with '``.``', '``/``' or '``~``', fish will test if a directory of that name exists. If it does, it is implicitly assumed that you want to change working directory. For example, the fastest way to switch to your home directory is to simply press ``~`` and enter.
|
||||
If fish is unable to locate a command with a given name, and it starts with ``.``, ``/`` or ``~``, fish will test if a directory of that name exists. If it does, it is implicitly assumed that you want to change working directory. For example, the fastest way to switch to your home directory is to simply press ``~`` and enter.
|
||||
|
||||
The open command doesn't work.
|
||||
------------------------------
|
||||
|
|
|
@ -100,7 +100,7 @@ This line tells the shell to execute the file with the bash interpreter, that is
|
|||
|
||||
For a script, written in another language, just replace the interpreter ``/bin/bash`` with the language interpreter of that other language (for example ``/bin/python`` for a ``python`` script)
|
||||
|
||||
This line is only needed when scripts are executed without specifying the interpreter. For functions inside fish or when executing a script with ```fish /path/to/script`` they aren't required (but don't hurt either!).
|
||||
This line is only needed when scripts are executed without specifying the interpreter. For functions inside fish or when executing a script with ``fish /path/to/script`` they aren't required (but don't hurt either!).
|
||||
|
||||
.. _syntax:
|
||||
|
||||
|
@ -133,11 +133,11 @@ Here is a list of some useful commands:
|
|||
- ``open``, open files with the default application associated with each filetype
|
||||
- ``less``, list the contents of files
|
||||
|
||||
Commands and parameters are separated by the space character `' '`. Every command ends with either a newline (i.e. by pressing the return key) or a semicolon '``;``'. More than one command can be written on the same line by separating them with semicolons.
|
||||
Commands and parameters are separated by the space character ``' '``. Every command ends with either a newline (i.e. by pressing the return key) or a semicolon ``;``. More than one command can be written on the same line by separating them with semicolons.
|
||||
|
||||
A switch is a very common special type of argument. Switches almost always start with one or more hyphens '``-``' and alter the way a command operates. For example, the '``ls``' command usually lists all the files and directories in the current working directory, but by using the '``-l``' switch, the behavior of '``ls``' is changed to not only display the filename, but also the size, permissions, owner and modification time of each file.
|
||||
A switch is a very common special type of argument. Switches almost always start with one or more hyphens ``-`` and alter the way a command operates. For example, the ``ls`` command usually lists all the files and directories in the current working directory, but by using the ``-l`` switch, the behavior of ``ls`` is changed to not only display the filename, but also the size, permissions, owner and modification time of each file.
|
||||
|
||||
Switches differ between commands and are documented in the manual page for each command. Some switches are common to most command though, for example '``--help``' will usually display a help text, '``-i``' will often turn on interactive prompting before taking action, while '``-f``' will turn it off.
|
||||
Switches differ between commands and are documented in the manual page for each command. Some switches are common to most command though, for example ``--help`` will usually display a help text, ``-i`` will often turn on interactive prompting before taking action, while ``-f`` will turn it off.
|
||||
|
||||
.. _syntax-words:
|
||||
|
||||
|
@ -286,7 +286,7 @@ Example: ``echo Hello 2>output.stderr`` writes the standard error (file descript
|
|||
Piping
|
||||
------
|
||||
|
||||
The user can string together multiple commands into a *pipeline*. This means that the standard output of one command will be read in as standard input into the next command. This is done by separating the commands by the pipe character '``|``'. For example
|
||||
The user can string together multiple commands into a *pipeline*. This means that the standard output of one command will be read in as standard input into the next command. This is done by separating the commands by the pipe character ``|``. For example
|
||||
|
||||
::
|
||||
|
||||
|
@ -337,20 +337,20 @@ Functions
|
|||
|
||||
Functions are programs written in the fish syntax. They group together one or more commands and their arguments using a single name. It can also be used to start a specific command with additional arguments.
|
||||
|
||||
For example, the following is a function definition that calls the command ``ls`` with the argument '``-l``' to print a detailed listing of the contents of the current directory::
|
||||
For example, the following is a function definition that calls the command ``ls`` with the argument ``-l`` to print a detailed listing of the contents of the current directory::
|
||||
|
||||
function ll
|
||||
ls -l $argv
|
||||
end
|
||||
|
||||
The first line tells fish that a function by the name of ``ll`` is to be defined. To use it, simply write ``ll`` on the commandline. The second line tells fish that the command ``ls -l $argv`` should be called when ``ll`` is invoked. '``$argv``' is a list variable, which always contains all arguments sent to the function. In the example above, these are simply passed on to the ``ls`` command. For more information on functions, see the documentation for the :ref:`function <cmd-function>` builtin.
|
||||
The first line tells fish that a function by the name of ``ll`` is to be defined. To use it, simply write ``ll`` on the commandline. The second line tells fish that the command ``ls -l $argv`` should be called when ``ll`` is invoked. ``$argv`` is a list variable, which always contains all arguments sent to the function. In the example above, these are simply passed on to the ``ls`` command. For more information on functions, see the documentation for the :ref:`function <cmd-function>` builtin.
|
||||
|
||||
.. _syntax-function-wrappers:
|
||||
|
||||
Defining aliases
|
||||
----------------
|
||||
|
||||
One of the most common uses for functions is to slightly alter the behavior of an already existing command. For example, one might want to redefine the ``ls`` command to display colors. The switch for turning on colors on GNU systems is '``--color=auto``'. An alias, or wrapper, around ``ls`` might look like this::
|
||||
One of the most common uses for functions is to slightly alter the behavior of an already existing command. For example, one might want to redefine the ``ls`` command to display colors. The switch for turning on colors on GNU systems is ``--color=auto``. An alias, or wrapper, around ``ls`` might look like this::
|
||||
|
||||
function ls
|
||||
command ls --color=auto $argv
|
||||
|
@ -377,7 +377,7 @@ Functions can be defined on the commandline or in a configuration file, but they
|
|||
- If the function definition is changed, all running shells will automatically reload the altered version.
|
||||
- Startup time and memory usage is improved, etc.
|
||||
|
||||
When fish needs to load a function, it searches through any directories in the list variable ``$fish_function_path`` for a file with a name consisting of the name of the function plus the suffix '``.fish``' and loads the first it finds.
|
||||
When fish needs to load a function, it searches through any directories in the list variable ``$fish_function_path`` for a file with a name consisting of the name of the function plus the suffix ``.fish`` and loads the first it finds.
|
||||
|
||||
By default ``$fish_function_path`` contains the following:
|
||||
|
||||
|
@ -437,11 +437,11 @@ Wildcards
|
|||
|
||||
If a star (``*``) or a question mark (``?``) is present in the parameter, ``fish`` attempts to match the given parameter to any files in such a way that:
|
||||
|
||||
- ``*`` can match any string of characters not containing '/'. This includes matching an empty string.
|
||||
- ``*`` can match any string of characters not containing ``/``. This includes matching an empty string.
|
||||
|
||||
- ``**`` matches any string of characters. This includes matching an empty string. The matched string may include the ``/`` character; that is, it recurses into subdirectories. Note that augmenting this wildcard with other strings will not match files in the current working directory (``$PWD``) if you separate the strings with a slash ("/"). This is unlike other shells such as zsh. For example, ``**\/*.fish`` in zsh will match ``.fish`` files in the PWD but in fish will only match such files in a subdirectory. In fish you should type ``**.fish`` to match files in the PWD as well as subdirectories.
|
||||
- ``**`` matches any string of characters. This includes matching an empty string. The matched string may include the ``/`` character; that is, it recurses into subdirectories. Note that augmenting this wildcard with other strings will not match files in the current working directory (``$PWD``) if you separate the strings with a slash (``/``). This is unlike other shells such as zsh. For example, ``**\/*.fish`` in zsh will match ``.fish`` files in the PWD but in fish will only match such files in a subdirectory. In fish you should type ``**.fish`` to match files in the PWD as well as subdirectories.
|
||||
|
||||
- ``?`` can match any single character except '/'. This is deprecated and can be disabled via the `qmark-noglob` :ref:`feature flag<featureflags>`, so `?` will just be an ordinary character.
|
||||
- ``?`` can match any single character except ``/``. This is deprecated and can be disabled via the `qmark-noglob` :ref:`feature flag<featureflags>`, so `?` will just be an ordinary character.
|
||||
|
||||
Other shells, such as zsh, provide a rich glob syntax for restricting the files matched by globs. For example, ``**(.)``, to only match regular files. Fish prefers to defer such features to programs, such as ``find``, rather than reinventing the wheel. Thus, if you want to limit the wildcard expansion to just regular files the fish approach is to define and use a function. For example,
|
||||
|
||||
|
@ -671,7 +671,7 @@ Index range expansion
|
|||
|
||||
Sometimes it's necessary to access only some of the elements of a list, or some of the lines a command substitution outputs. Both allow this by providing a set of indices in square brackets.
|
||||
|
||||
Sequences of elements can be written with the range operator '``..``'. A range '``a..b``' ('a' and 'b' being integers) is expanded into a sequence of indices '``a a+1 a+2 ... b``' or '``a a-1 a-2 ... b``' depending on which of 'a' or 'b' is higher. Negative range limits are calculated from the end of the list. If an index is too large or small it's silently clamped to one or the size of the list as appropriate.
|
||||
Sequences of elements can be written with the range operator ``..``. A range ``a..b`` ('a' and 'b' being integers) is expanded into a sequence of indices ``a a+1 a+2 ... b`` or ``a a-1 a-2 ... b`` depending on which of 'a' or 'b' is higher. Negative range limits are calculated from the end of the list. If an index is too large or small it's silently clamped to one or the size of the list as appropriate.
|
||||
|
||||
If the end is smaller than the start, or the start is larger than the end, range expansion will go in reverse. This is unless exactly one of the given indices is negative, so the direction doesn't change if the list has fewer elements than expected.
|
||||
|
||||
|
@ -814,11 +814,11 @@ There are three kinds of variables in fish: universal, global and local variable
|
|||
|
||||
Variables can be explicitly set to be universal with the ``-U`` or ``--universal`` switch, global with the ``-g`` or ``--global`` switch, or local with the ``-l`` or ``--local`` switch. The scoping rules when creating or updating a variable are:
|
||||
|
||||
- If a variable is explicitly set to a scope (universal, global or local), that setting will be honored. If a variable of the same name exists in a different scope, that variable will not be changed.
|
||||
- When a scope is explicitly given, it will be used. If a variable of the same name exists in a different scope, that variable will not be changed.
|
||||
|
||||
- If a variable is not explicitly set to a scope, but has been previously defined, the variable scope is not changed.
|
||||
- When no scope is given, but a variable of that name exists, the variable of the smallest scope will be modified. The scope will not be changed.
|
||||
|
||||
- If a variable is not explicitly set to a scope and has not been defined, the variable will be local to the currently executing function. Note that this is different from using the ``-l`` or ``--local`` flag. If one of those flags is used, the variable will be local to the most inner currently executing block, while without these the variable will be local to the function. If no function is executing, the variable will be global.
|
||||
- As a special case, when no scope is given and no variable has been defined the variable will belong to the scope of the currently executing *function*. Note that this is different from the ``--local`` flag``, which would make the variable local to the current *block*.
|
||||
|
||||
There may be many variables with the same name, but different scopes. When using a variable, the variable scope will be searched from the inside out, i.e. a local variable will be used rather than a global variable with the same name, a global variable will be used rather than a universal variable with the same name.
|
||||
|
||||
|
@ -829,10 +829,13 @@ The following code will not output anything::
|
|||
begin
|
||||
# This is a nice local scope where all variables will die
|
||||
set -l pirate 'There be treasure in them thar hills'
|
||||
set captain Space, the final frontier
|
||||
end
|
||||
|
||||
echo $pirate
|
||||
# This will not output anything, since the pirate was local
|
||||
echo $captain
|
||||
# This will output the good Captain's speech since $captain had function-scope.
|
||||
|
||||
.. _variables-override:
|
||||
|
||||
|
@ -861,7 +864,7 @@ This syntax is supported since fish 3.1.
|
|||
More on universal variables
|
||||
---------------------------
|
||||
|
||||
Universal variables are variables that are shared between all the users' fish sessions on the computer. Fish stores many of its configuration options as universal variables. This means that in order to change fish settings, all you have to do is change the variable value once, and it will be automatically updated for all sessions, and preserved across computer reboots and login/logout.
|
||||
Universal variables are variables that are shared between all the user's fish sessions on the computer. Fish stores many of its configuration options as universal variables. This means that in order to change fish settings, all you have to do is change the variable value once, and it will be automatically updated for all sessions, and preserved across computer reboots and login/logout.
|
||||
|
||||
To see universal variables in action, start two fish sessions side by side, and issue the following command in one of them ``set fish_color_cwd blue``. Since ``fish_color_cwd`` is a universal variable, the color of the current working directory listing in the prompt will instantly change to blue on both terminals.
|
||||
|
||||
|
@ -1059,6 +1062,8 @@ The user can change the settings of ``fish`` by changing the values of certain v
|
|||
|
||||
- ``pipestatus``, a list of exit statuses of all processes that made up the last executed pipe.
|
||||
|
||||
- ``fish_kill_signal``, the signal that terminated the last foreground job, or `0` if the job exited normally.
|
||||
|
||||
- ``USER``, the current username. This variable can be changed by the user.
|
||||
|
||||
- ``CMD_DURATION``, the runtime of the last command in milliseconds.
|
||||
|
@ -1232,9 +1237,9 @@ Autosuggestions are a powerful way to quickly summon frequently entered commands
|
|||
Tab Completion
|
||||
--------------
|
||||
|
||||
Tab completion is one of the most time saving features of any modern shell. By tapping the tab key, the user asks ``fish`` to guess the rest of the command or parameter that the user is currently typing. If ``fish`` can only find one possible completion, ``fish`` will write it out. If there is more than one completion, ``fish`` will write out the longest prefix that all completions have in common. If the completions differ on the first character, a list of all possible completions is printed. The list features descriptions of the completions and if the list doesn't fit the screen, it is scrollable by using the arrow keys, the page up/page down keys, the tab key or the space bar.
|
||||
Tab completion is one of the most time saving features of any modern shell. By tapping :kbd:`Tab`, the user asks ``fish`` to guess the rest of the command or parameter that the user is currently typing. If ``fish`` can only find one possible completion, ``fish`` will write it out. If there is more than one completion, ``fish`` will write out the longest prefix that all completions have in common. If the completions differ on the first character, a list of all possible completions is printed. The list features descriptions of the completions and if the list doesn't fit the screen, it is scrollable by using the arrow keys, :kbd:`Page Up` / :kbd:`Page Down`, :kbd:`Tab` or :kbd:`Space`.
|
||||
|
||||
If the list is visible, pressing control-S (or the ``pager-toggle-search`` binding) will allow filtering the list. Shift-tab (or the ``complete-and-search`` binding) will trigger completion with the search field immediately visible.
|
||||
If the list is visible, pressing :kbd:`Control`\ +\ :kbd:`S` (or the ``pager-toggle-search`` binding) will allow filtering the list. :kbd:`Shift`\ +\ :kbd:`Tab` (or the ``complete-and-search`` binding) will trigger completion with the search field immediately visible.
|
||||
These are the general purpose tab completions that ``fish`` provides:
|
||||
|
||||
- Completion of commands (builtins, functions and regular programs).
|
||||
|
@ -1243,7 +1248,7 @@ These are the general purpose tab completions that ``fish`` provides:
|
|||
|
||||
- Completion of usernames for tilde expansion.
|
||||
|
||||
- Completion of filenames, even on strings with wildcards such as '``*``' and '``**``'.
|
||||
- Completion of filenames, even on strings with wildcards such as ``*`` and ``**``.
|
||||
|
||||
``fish`` provides a large number of program specific completions. Most of these completions are simple options like the ``-l`` option for ``ls``, but some are more advanced. The latter include:
|
||||
|
||||
|
@ -1289,7 +1294,7 @@ Some bindings are shared between emacs- and vi-mode because they aren't text edi
|
|||
|
||||
- :kbd:`Tab` `completes <#tab-completion>`_ the current token. :kbd:`Shift`\ +\ :kbd:`Tab` completes the current token and starts the pager's search mode.
|
||||
|
||||
- :kbd:`←` (Left) and :kbd:`→` (Right) move the cursor left or right by one character. If the cursor is already at the end of the line, and an autosuggestion is available, they accept one word of the autosuggestion.
|
||||
- :kbd:`←` (Left) and :kbd:`→` (Right) move the cursor left or right by one character. If the cursor is already at the end of the line, and an autosuggestion is available, :kbd:`→` accepts the autosuggestion.
|
||||
|
||||
- :kbd:`Alt`\ +\ :kbd:`←` and :kbd:`Alt`\ +\ :kbd:`→` move the cursor one word left or right (to the next space or punctuation mark), or moves forward/backward in the directory history if the command line is empty. If the cursor is already at the end of the line, and an autosuggestion is available, :kbd:`Alt`\ +\ :kbd:`→` (or :kbd:`Alt`\ +\ :kbd:`F`) accepts the first word in the suggestion.
|
||||
|
||||
|
@ -1319,7 +1324,9 @@ Some bindings are shared between emacs- and vi-mode because they aren't text edi
|
|||
|
||||
- :kbd:`Alt`\ +\ :kbd:`L` lists the contents of the current directory, unless the cursor is over a directory argument, in which case the contents of that directory will be listed.
|
||||
|
||||
- :kbd:`Alt`\ +\ :kbd:`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`\ +\ :kbd:`O` opens the file at the cursor in a pager.
|
||||
|
||||
- :kbd:`Alt`\ +\ :kbd:`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`\ +\ :kbd:`W` prints a short description of the command under the cursor.
|
||||
|
||||
|
@ -1329,7 +1336,7 @@ Some bindings are shared between emacs- and vi-mode because they aren't text edi
|
|||
|
||||
- :kbd:`Alt`\ +\ :kbd:`S` Prepends `sudo` to the current commandline.
|
||||
|
||||
- :kbd:`Control`\ +\ :kbd:`Space` Inserts a space without expanding an :ref:`abbreviation <abbreviations>`. (for vi-mode this only applies to insert-mode)
|
||||
- :kbd:`Control`\ +\ :kbd:`Space` Inserts a space without expanding an :ref:`abbreviation <abbreviations>`. For vi-mode this only applies to insert-mode.
|
||||
|
||||
.. _emacs-mode:
|
||||
|
||||
|
@ -1340,11 +1347,11 @@ Emacs mode commands
|
|||
|
||||
- :kbd:`End` or :kbd:`Control`\ +\ :kbd:`E` moves to the end of line. If the cursor is already at the end of the line, and an autosuggestion is available, :kbd:`End` or :kbd:`Control`\ +\ :kbd:`E` accepts the autosuggestion.
|
||||
|
||||
- :kbd:`Control`\ +\ :kbd:`B`, :kbd:`Control`\ +\ :kbd:`F` move the cursor one character left or right just like the :kbd:`←` (Left) and :kbd:`→` (Right) shared bindings (which are available as well).
|
||||
- :kbd:`Control`\ +\ :kbd:`B`, :kbd:`Control`\ +\ :kbd:`F` move the cursor one character left or right or accept the autosuggestion just like the :kbd:`←` (Left) and :kbd:`→` (Right) shared bindings (which are available as well).
|
||||
|
||||
- :kbd:`Control`\ +\ :kbd:`N`, :kbd:`Control`\ +\ :kbd:`P` move the cursor up/down or through history, like the up and down arrow shared bindings.
|
||||
|
||||
- :kbd:`Delete` and :kbd:`Backspace` removes one character forwards or backwards respectively.
|
||||
- :kbd:`Delete` or :kbd:`Backspace` removes one character forwards or backwards respectively.
|
||||
|
||||
- :kbd:`Control`\ +\ :kbd:`K` moves contents from the cursor to the end of line to the `killring <#killring>`__.
|
||||
|
||||
|
@ -1352,13 +1359,13 @@ Emacs mode commands
|
|||
|
||||
- :kbd:`Alt`\ +\ :kbd:`U` makes the current word uppercase.
|
||||
|
||||
- :kbd:`Control`\ +\ :kbd:`T` transposes the last two characters
|
||||
- :kbd:`Control`\ +\ :kbd:`T` transposes the last two characters.
|
||||
|
||||
- :kbd:`Alt`\ +\ :kbd:`T` transposes the last two words
|
||||
- :kbd:`Alt`\ +\ :kbd:`T` transposes the last two words.
|
||||
|
||||
- :kbd:`Control`\ +\ :kbd:`_` (:kbd:`Control`\ +\ :kbd:`/` on some terminals) undoes the most recent edit of the line
|
||||
- :kbd:`Control`\ +\ :kbd:`_` (:kbd:`Control`\ +\ :kbd:`/` on some terminals) undoes the most recent edit of the line.
|
||||
|
||||
- :kbd:`Alt`\ +\ :kbd:`/` reverts the most recent undo
|
||||
- :kbd:`Alt`\ +\ :kbd:`/` reverts the most recent undo.
|
||||
|
||||
|
||||
You can change these key bindings using the :ref:`bind <cmd-bind>` builtin.
|
||||
|
@ -1470,10 +1477,25 @@ In addition, when pasting inside single quotes, pasted single quotes and backsla
|
|||
|
||||
.. [#] These rely on external tools. Currently xsel, xclip, wl-copy/wl-paste and pbcopy/pbpaste are supported.
|
||||
|
||||
.. _multiline:
|
||||
|
||||
Multiline editing
|
||||
-----------------
|
||||
|
||||
The fish commandline editor can be used to work on commands that are several lines long. There are three ways to make a command span more than a single line:
|
||||
|
||||
- Pressing the :kbd:`Enter` key while a block of commands is unclosed, such as when one or more block commands such as ``for``, ``begin`` or ``if`` do not have a corresponding :ref:`end <cmd-end>` command.
|
||||
|
||||
- Pressing :kbd:`Alt`\ +\ :kbd:`Enter` instead of pressing the :kbd:`Enter` key.
|
||||
|
||||
- By inserting a backslash (``\``) character before pressing the :kbd:`Enter` key, escaping the newline.
|
||||
|
||||
The fish commandline editor works exactly the same in single line mode and in multiline mode. To move between lines use the left and right arrow keys and other such keyboard shortcuts.
|
||||
|
||||
.. _history-search:
|
||||
|
||||
Searchable history
|
||||
------------------
|
||||
Searchable command history
|
||||
--------------------------
|
||||
|
||||
After a command has been entered, it is inserted at the end of a history list. Any duplicate history items are automatically removed. By pressing the up and down keys, the user can search forwards and backwards in the history. If the current command line is not empty when starting a history search, only the commands containing the string entered into the command line are shown.
|
||||
|
||||
|
@ -1496,21 +1518,35 @@ To search for previous entries containing the word 'make', type ``make`` in the
|
|||
|
||||
If the commandline reads ``cd m``, place the cursor over the ``m`` character and press :kbd:`Alt`\ +\ :kbd:`↑` to search for previously typed words containing 'm'.
|
||||
|
||||
Navigating directories
|
||||
======================
|
||||
|
||||
.. _multiline:
|
||||
.. _directory-history:
|
||||
|
||||
Multiline editing
|
||||
The current working directory can be displayed with the :ref:`pwd <cmd-pwd>` command.
|
||||
|
||||
Directory history
|
||||
-----------------
|
||||
|
||||
The fish commandline editor can be used to work on commands that are several lines long. There are three ways to make a command span more than a single line:
|
||||
Fish automatically keeps a trail of the recent visited directories with :ref:`cd <cmd-cd>` by storing this history in the ``dirprev`` and ``dirnext`` variables.
|
||||
|
||||
- Pressing the :kbd:`Enter` key while a block of commands is unclosed, such as when one or more block commands such as ``for``, ``begin`` or ``if`` do not have a corresponding :ref:`end <cmd-end>` command.
|
||||
Several commands are provided to interact with this directory history:
|
||||
|
||||
- Pressing :kbd:`Alt`\ +\ :kbd:`Enter` instead of pressing the :kbd:`Enter` key.
|
||||
- :ref:`dirh <cmd-dirh>` prints the history
|
||||
- :ref:`cdh <cmd-cdh>` displays a prompt to quickly navigate the history
|
||||
- :ref:`prevd <cmd-prevd>` moves backward through the history. It is bound to :kbd:`Alt`\ +\ :kbd:`←`
|
||||
- :ref:`nextd <cmd-nextd>` moves forward through the history. It is bound to :kbd:`Alt`\ +\ :kbd:`→`
|
||||
|
||||
- By inserting a backslash (``\``) character before pressing the :kbd:`Enter` key, escaping the newline.
|
||||
.. _directory-stack:
|
||||
|
||||
The fish commandline editor works exactly the same in single line mode and in multiline mode. To move between lines use the left and right arrow keys and other such keyboard shortcuts.
|
||||
Directory stack
|
||||
---------------
|
||||
|
||||
Another set of commands, usually also available in other shells like bash, deal with the directory stack. Stack handling is not automatic and needs explicit calls of the following commands:
|
||||
|
||||
- :ref:`dirs <cmd-dirs>` prints the stack
|
||||
- :ref:`pushd <cmd-pushd>` adds a directory on top of the stack and makes it the current working directory
|
||||
- :ref:`popd <cmd-popd>` removes the directory on top of the stack and changes the current working directory
|
||||
|
||||
.. _job-control:
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ This prompt that you see above is the ``fish`` default prompt: it shows your use
|
|||
- to change this prompt see `how to change your prompt <#prompt>`_
|
||||
- to switch to fish permanently see `switch your default shell to fish <#switching-to-fish>`_.
|
||||
|
||||
From now on, we'll pretend your prompt is just a '``>``' to save space.
|
||||
From now on, we'll pretend your prompt is just a ``>`` to save space.
|
||||
|
||||
|
||||
Learning fish
|
||||
|
@ -101,7 +101,7 @@ A command may be invalid because it does not exist, or refers to a file that you
|
|||
> cat :underline:`~/somefi`
|
||||
|
||||
|
||||
This tells you that there exists a file that starts with '``somefi``', which is useful feedback as you type.
|
||||
This tells you that there exists a file that starts with ``somefi``, which is useful feedback as you type.
|
||||
|
||||
These colors, and many more, can be changed by running ``fish_config``, or by modifying variables directly.
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
prefix=@prefix@
|
||||
datadir=@datadir@
|
||||
completionsdir=@extra_completionsdir@
|
||||
functionsdir=@extra_functionsdir@
|
||||
confdir=@extra_confdir@
|
||||
datadir=${prefix}/@rel_datadir@
|
||||
completionsdir=${datadir}/@rel_completionsdir@
|
||||
functionsdir=${datadir}/@rel_functionsdir@
|
||||
confdir=${datadir}/@rel_confdir@
|
||||
|
||||
Name: fish
|
||||
Description: fish, the friendly interactive shell
|
||||
|
|
|
@ -22,7 +22,7 @@ BuildRequires: update-desktop-files
|
|||
%endif
|
||||
|
||||
%if 0%{?opensuse_bs} && 0%{?rhel} && 0%{?rhel} < 7
|
||||
BuildRequires: gcc48 gcc48-c++ python-argparse
|
||||
BuildRequires: gcc48 gcc48-c++
|
||||
%endif
|
||||
|
||||
# for tests
|
||||
|
@ -95,7 +95,12 @@ cp -a CONTRIBUTING.md %{buildroot}%{_pkgdocdir}
|
|||
%if 0%{?__builddir:1}
|
||||
cd %__builddir
|
||||
%endif
|
||||
# Turn off tests on RHEL 6, they are hard to keep running
|
||||
%if 0%{?opensuse_bs} && 0%{?rhel} && 0%{?rhel} < 7
|
||||
./fish -c 'exit 0'
|
||||
%else
|
||||
make test SHOW_INTERACTIVE_LOG=1
|
||||
%endif
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
set -l cmds 'scontrols scontents controls contents sget sset cset cget set get'
|
||||
complete -c amixer -xa "$cmds" -n "not __fish_seen_subcommand_from $cmds"
|
||||
complete -c amixer -n '__fish_seen_subcommand_from sset sget get set' -xa "(amixer scontrols | cut --delimiter \' --fields 2)"
|
||||
complete -c amixer -n '__fish_seen_subcommand_from sset sget get set' -xa "(amixer scontrols | string split -f 2 \')"
|
||||
|
||||
complete -c amixer -s h -l help -d 'this help'
|
||||
complete -c amixer -s c -l card -r -d 'select the card'
|
||||
|
|
|
@ -2,5 +2,4 @@ complete -c command -n 'test (count (commandline -opc)) -eq 1' -s h -l help -d '
|
|||
complete -c command -n 'test (count (commandline -opc)) -eq 1' -s a -l all -d 'Print all external commands by the given name'
|
||||
complete -c command -n 'test (count (commandline -opc)) -eq 1' -s q -l quiet -d 'Do not print anything, only set exit status'
|
||||
complete -c command -n 'test (count (commandline -opc)) -eq 1' -s s -l search -d 'Print the file that would be executed'
|
||||
complete -c command -n 'test (count (commandline -opc)) -eq 1' -s s -l search -d 'Print the file that would be executed'
|
||||
complete -c command -xa "(__fish_complete_subcommand)"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
# First parameter is the profile name, or 'usage'
|
||||
complete --command duply --no-files --condition __fish_is_first_token --arguments '(/bin/ls /etc/duply 2>/dev/null) (/bin/ls ~/.duply 2>/dev/null)' -d Profile
|
||||
complete -c duply -f -n __fish_is_first_token - '(set -l files /etc/duply/* ~/.duply/*; string replace -r ".*/" "" -- $files)' -d Profile
|
||||
complete --command duply --no-files --arguments usage -d 'Get usage help text'
|
||||
|
||||
# Second parameter is a duply command
|
||||
|
|
3
share/completions/fish_key_reader.fish
Normal file
3
share/completions/fish_key_reader.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
complete -c fish_key_reader -s h -l help -d 'Display help and exit'
|
||||
complete -c fish_key_reader -s v -l version -d 'Display version and exit'
|
||||
complete -c fish_key_reader -s c -l continuous -d 'Start a continuous session'
|
|
@ -1,7 +1,6 @@
|
|||
__fish_make_completion_signals
|
||||
for i in $__kill_signals
|
||||
set number (echo $i | cut -d " " -f 1)
|
||||
set name (echo $i | cut -d " " -f 2)
|
||||
string split -f 1,2 " " -- $i | read --line number name
|
||||
complete -c fuser -o $number -d $name
|
||||
complete -c fuser -o $name -d $name
|
||||
end
|
||||
|
|
|
@ -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
|
||||
# Using eval to expand ~ and variables specified on the commandline.
|
||||
eval command git $global_args \$saved_args
|
||||
end
|
||||
|
||||
# Print an optspec for argparse to handle git's options that are independent of any subcommand.
|
||||
|
|
3
share/completions/groups.fish
Normal file
3
share/completions/groups.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
complete -c groups -x -a "(__fish_complete_users)"
|
||||
complete -c groups -l help -d 'Display help message'
|
||||
complete -c groups -l version -d 'Display version information'
|
|
@ -16,7 +16,7 @@ function __fish_journalctl_is_field
|
|||
end
|
||||
|
||||
function __fish_journalctl_field_values
|
||||
set -l token (commandline -t | cut -d"=" -f 1)
|
||||
set -l token (commandline -t | string split -f1 =)
|
||||
command journalctl -F $token 2>/dev/null | while read value
|
||||
echo $token=$value
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ function __fish_print_make_targets --argument-names directory file
|
|||
if make --version 2>/dev/null | string match -q 'GNU*'
|
||||
# https://stackoverflow.com/a/26339924
|
||||
make $makeflags -pRrq : 2>/dev/null |
|
||||
awk -F: '/^# Files/,/^# Finished Make data base/ {
|
||||
awk -F: '/^# Files/,/^# Finished Make data base/ {
|
||||
if ($1 == "# Not a target") skip = 1;
|
||||
if ($1 !~ "^[#.\t]") { if (!skip) print $1; skip=0 }
|
||||
}' 2>/dev/null
|
||||
|
|
|
@ -1,51 +1,12 @@
|
|||
complete -c nc -d "Remote hostname" -x -a "(__fish_print_hostnames)"
|
||||
# There a several different implementations of netcat.
|
||||
# Try to figure out which is the current used one
|
||||
# and load the right set of completions.
|
||||
|
||||
complete -c nc -s 4 -d "Use IPv4 only"
|
||||
complete -c nc -s 6 -d "Use IPv6 only"
|
||||
complete -c nc -s U -l unixsock -d "Use Unix domain sockets only"
|
||||
complete -c nc -l vsock -d "Use vsock sockets only"
|
||||
complete -c nc -s C -l crlf -d "Use CRLF for EOL sequence"
|
||||
complete -c nc -s c -l sh-exec -x -d "Executes the given command via /bin/sh"
|
||||
complete -c nc -s e -l exec -F -d "Executes the given command"
|
||||
complete -c nc -l lua-exec -F -d "Executes the given Lua script"
|
||||
complete -c nc -s g -x -d "Loose source routing hop points"
|
||||
complete -c nc -s G -x -d "Loose source routing hop pointer"
|
||||
complete -c nc -s m -l max-conns -x -d "Maximum simultaneous connections"
|
||||
complete -c nc -s h -d "Show help"
|
||||
complete -c nc -s d -l delay -x -d "Wait between read/writes"
|
||||
complete -c nc -s o -l output -F -d "Dump session data to a file"
|
||||
complete -c nc -s x -l hex-dump -F -d "Dump session data as hex to a file"
|
||||
complete -c nc -s i -l idle-timeout -x -d "Idle read/write timeout"
|
||||
complete -c nc -s p -l source-port -x -d "Specify source port to use"
|
||||
complete -c nc -s s -l source -x -d "Specify source address"
|
||||
complete -c nc -s l -l listen -d "Bind and listen for incoming connections"
|
||||
complete -c nc -s k -l keep-open -d "Accept multiple connections in listen mode"
|
||||
complete -c nc -s n -l nodns -d "Do not resolve hostnames via DNS"
|
||||
complete -c nc -s t -l telnet -d "Answer Telnet negotiation"
|
||||
complete -c nc -s u -l udp -d "Use UDP instead of default TCP"
|
||||
complete -c nc -l sctp -d "Use SCTP instead of default TCP"
|
||||
complete -c nc -s v -l verbose -d "Set verbosity level"
|
||||
complete -c nc -s w -l wait -x -d "Connect timeout"
|
||||
complete -c nc -s z -d "Zero-I/O mode, report connection status only"
|
||||
complete -c nc -l append-output -d "Append rather than clobber specified output files"
|
||||
complete -c nc -l send-only -d "Only send data, ignoring received"
|
||||
complete -c nc -l recv-only -d "Only receive data, never send anything"
|
||||
complete -c nc -l no-shutdown -d "Continue half-duplex when receiving EOF"
|
||||
complete -c nc -l allow -x -d "Allow only given hosts to connect"
|
||||
complete -c nc -l allowfile -F -d "A file of hosts allowed to connect"
|
||||
complete -c nc -l deny -x -d "Deny given hosts from connecting"
|
||||
complete -c nc -l denyfile -F -d "A file of hosts denied from connecting"
|
||||
complete -c nc -l broker -d "Enable connection brokering mode"
|
||||
complete -c nc -l chat -d "Start a simple chat server"
|
||||
complete -c nc -l proxy -x -d "Specify address of host to proxy through"
|
||||
complete -c nc -l proxy-type -x -a "http socks4 socks5" -d "Specify proxy type"
|
||||
complete -c nc -l proxy-auth -x -d "Authenticate with HTTP or SOCKS proxy"
|
||||
complete -c nc -l proxy-dns -x -a "local remote both none" -d "Specify where to resolve proxy destination"
|
||||
complete -c nc -l ssl -d "Connect or listen with SSL"
|
||||
complete -c nc -l ssl-cert -F -d "Specify SSL certificate file"
|
||||
complete -c nc -l ssl-key -F -d "Specify SSL private key"
|
||||
complete -c nc -l ssl-verify -d "Verify trust and domain name of certificates"
|
||||
complete -c nc -l ssl-trustfile -F -d "PEM file containing trusted SSL certificates"
|
||||
complete -c nc -l ssl-ciphers -x -d "Cipherlist containing SSL ciphers to use"
|
||||
complete -c nc -l ssl-alpn -x -d "ALPN protocol list to use"
|
||||
complete -c nc -l version -d "Display version information"
|
||||
set -l flavor
|
||||
if string match -rq -- '^OpenBSD netcat' (nc -h 2>&1)[1]
|
||||
set flavor nc.openbsd
|
||||
else
|
||||
set flavor (basename (realpath (command -v nc)))
|
||||
end
|
||||
|
||||
__fish_complete_netcat nc $flavor
|
||||
|
|
1
share/completions/nc.openbsd.fish
Normal file
1
share/completions/nc.openbsd.fish
Normal file
|
@ -0,0 +1 @@
|
|||
__fish_complete_netcat nc.openbsd
|
1
share/completions/nc.traditional.fish
Normal file
1
share/completions/nc.traditional.fish
Normal file
|
@ -0,0 +1 @@
|
|||
__fish_complete_netcat nc.traditional
|
74
share/completions/ncat.fish
Normal file
74
share/completions/ncat.fish
Normal file
|
@ -0,0 +1,74 @@
|
|||
# Completions for ncat (https://www.nmap.org)
|
||||
|
||||
complete -c ncat -f -a "(__fish_print_hostnames)"
|
||||
|
||||
# PROTOCOL OPTIONS
|
||||
complete -c ncat -s 4 -d "IPv4 only"
|
||||
complete -c ncat -s 6 -d "IPv6 only"
|
||||
complete -c ncat -s U -l unixsock -d "Use Unix domain sockets"
|
||||
complete -c ncat -s u -l udp -d "Use UDP"
|
||||
complete -c ncat -l sctp -d "Use SCTP"
|
||||
|
||||
# CONNECT MODE OPTIONS
|
||||
complete -c ncat -s g -x -d "Loose source routing"
|
||||
complete -c ncat -s G -x -d "Set source routing pointer"
|
||||
complete -c ncat -s p -l source-port -x -d "Specify source port"
|
||||
complete -c ncat -s s -l source -x -d "Specify source address"
|
||||
|
||||
# LISTEN MODE OPTIONS
|
||||
complete -c ncat -s l -l listen -d "Listen for connections"
|
||||
complete -c ncat -s m -l max-conns -x -d "Specify maximum number of connections"
|
||||
complete -c ncat -s k -l keep-open -d "Accept multiple connections"
|
||||
complete -c ncat -l broker -d "Connection brokering"
|
||||
complete -c ncat -l chat -d "Ad-hoc \"chat server\""
|
||||
|
||||
# SSL OPTIONS
|
||||
complete -c ncat -l ssl -d "Use SSL"
|
||||
complete -c ncat -l ssl-verify -d "Verify server certificates"
|
||||
complete -c ncat -l ssl-cert -r -d "Specify SSL certificate"
|
||||
complete -c ncat -l ssl-key -r -d "Specify SSL private key"
|
||||
complete -c ncat -l ssl-trustfile -r -d "List trusted certificates"
|
||||
function __fish_complete_openssl_ciphers
|
||||
openssl ciphers -s -stdname | string replace -r '^([^ ]*) - ([^ ]*).*$' '$2\t$1'
|
||||
for cs in COMPLEMENTOFDEFAULT ALL COMPLEMENTOFALL HIGH MEDIUM LOW eNULL NULL aNULL kRSA aRSA RSA kDHr kDHd kDH kDHE kEDH DH DHE EDH ADH kEECDH kECDHE ECDH ECDHE EECDH AECDH aDSS DSS aDH aECDSA ECDSA TLSv1.2 TLSv1.0 SSLv3 AES128 AES256 AES AESGCM AESCCM AESCCM8 ARIA128 ARIA256 ARIA CAMELLIA128 CAMELLIA256 CAMELLIA CHACHA20 3DES DES RC4 RC2 IDEA SEED MD5 SHA1 SHA SHA256 SHA384 aGOST aGOST01 kGOST GOST94 GOST89MAC PSK kPSK kECDHEPSK kDHEPSK kRSAPSK aPSK SUITEB128 SUITEB128ONLY SUITEB192
|
||||
printf "%s\tCipher String\n" $cs
|
||||
end
|
||||
end
|
||||
complete -c ncat -l ssl-ciphers -x -a "(__fish_complete_list : __fish_complete_openssl_ciphers)" -d "Specify SSL ciphersuites"
|
||||
complete -c ncat -l ssl-alpn -x -d "Specify ALPN protocol list"
|
||||
|
||||
# PROXY OPTIONS
|
||||
complete -c ncat -l proxy -x -d "Specify proxy address"
|
||||
complete -c ncat -l proxy-type -x -d "Specify proxy protocol"
|
||||
complete -c ncat -l proxy-auth -x -d "Specify proxy credentials"
|
||||
|
||||
# COMMAND EXECUTION OPTIONS
|
||||
complete -c ncat -s e -l exec -r -d "Execute command"
|
||||
complete -c ncat -s c -l sh-exec -r -d "Execute command via sh"
|
||||
complete -c ncat -l lua-exec -r -d "Execute a .lua script"
|
||||
|
||||
# ACCESS CONTROL OPTIONS
|
||||
complete -c ncat -l allow -x -a "(__fish_print_hostnames)" -d "Allow connections"
|
||||
complete -c ncat -l allowfile -r -d "Allow connections from file"
|
||||
complete -c ncat -l deny -x -a "(__fish_print_hostnames)" -d "Deny connections"
|
||||
complete -c ncat -l denyfile -r -d "Deny connections from file"
|
||||
|
||||
# TIMING OPTIONS
|
||||
complete -c ncat -s d -l delay -x -d "Specify line delay"
|
||||
complete -c ncat -s i -l idle-timeout -x -d "Specify idle timeout"
|
||||
complete -c ncat -s w -l wait -x -d "Specify connect timeout"
|
||||
|
||||
# OUTPUT OPTIONS
|
||||
complete -c ncat -s o -l output -r -d "Save session data"
|
||||
complete -c ncat -s x -l hex-dump -r -d "Save session data in hex"
|
||||
complete -c ncat -l append-output -d "Append output"
|
||||
complete -c ncat -s v -l verbose -d "Be verbose"
|
||||
|
||||
# MISC OPTIONS
|
||||
complete -c ncat -s C -l crlf -d "Use CRLF as EOL"
|
||||
complete -c ncat -s h -l help -d "Help screen"
|
||||
complete -c ncat -l -recv-only -d "Only receive data"
|
||||
complete -c ncat -l send-only -d "Only send data"
|
||||
complete -c ncat -l no-shutdown -d "Do not shutdown into half-duplex mode"
|
||||
complete -c ncat -s t -l telnet -d "Answer Telnet negotiations"
|
||||
complete -c ncat -l version -d "Display version"
|
12
share/completions/netcat.fish
Normal file
12
share/completions/netcat.fish
Normal file
|
@ -0,0 +1,12 @@
|
|||
# There a several different implementations of netcat.
|
||||
# Try to figure out which is the current used one
|
||||
# and load the right set of completions.
|
||||
|
||||
set -l flavor
|
||||
if string match -rq -- '^OpenBSD netcat' (netcat -h 2>&1)[1]
|
||||
set flavor nc.openbsd
|
||||
else
|
||||
set flavor (basename (realpath (command -v netcat)))
|
||||
end
|
||||
|
||||
__fish_complete_netcat netcat $flavor
|
|
@ -1 +1 @@
|
|||
complete -c nextd -s l -d "Also print directory history"
|
||||
complete -c nextd -s l -l list -d "Also print directory history"
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
function __fish_ninja
|
||||
set -l saved_args $argv
|
||||
set -l dir .
|
||||
argparse -i C/dir= -- (commandline -opc)
|
||||
and set -ql _flag_C
|
||||
and set -l dir $_flag_C
|
||||
test -f $dir/build.ninja
|
||||
and command ninja -C$dir $saved_args
|
||||
if argparse -i C/dir= -- (commandline -opc)
|
||||
# Using eval to expand ~ and variables specified on the commandline.
|
||||
eval command ninja -C$_flag_C \$saved_args
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_print_ninja_tools
|
||||
|
|
180
share/completions/nmap.fish
Normal file
180
share/completions/nmap.fish
Normal file
|
@ -0,0 +1,180 @@
|
|||
# Completions for nmap (https://www.nmap.org)
|
||||
|
||||
complete -c nmap -f -a "(__fish_print_hostnames)"
|
||||
|
||||
# TARGET SPECIFICATION
|
||||
complete -c nmap -o iL -F -d 'Input target from file'
|
||||
complete -c nmap -o iR -x -d 'Choose random targets'
|
||||
complete -c nmap -l exclude -x -a "(__fish_print_hostnames)" -d 'Exclude hosts/networks'
|
||||
complete -c nmap -l excludefile -r -d 'Exclude list from file'
|
||||
|
||||
# HOST DISCOVERY
|
||||
complete -c nmap -o sL -d 'Scan: List Scan'
|
||||
complete -c nmap -o sn -d 'Scan: No port scan'
|
||||
complete -c nmap -o Pn -d 'Probe: No Ping'
|
||||
complete -c nmap -o PS -x -d 'Probe: TCP Syn Ping'
|
||||
complete -c nmap -o PA -x -d 'Probe: TCP ACK Ping'
|
||||
complete -c nmap -o PU -x -d 'Probe: UDP Ping'
|
||||
complete -c nmap -o PY -x -d 'Probe: SCTP INIT Ping'
|
||||
complete -c nmap -o PE -d 'Probe: ICMP Echo Ping'
|
||||
complete -c nmap -o PP -d 'Probe: ICMP timestamp request'
|
||||
complete -c nmap -o PM -d 'Probe: ICMP netmask Ping'
|
||||
complete -c nmap -o PO -x -d 'Probe: IP Protocol Ping'
|
||||
complete -c nmap -o PR -d 'Probe: ARP Ping'
|
||||
complete -c nmap -l disable-arp-ping -d 'No ARP or ND Ping'
|
||||
complete -c nmap -l traceroute -d 'Trace path to host'
|
||||
complete -c nmap -s n -d 'No DNS resolution'
|
||||
complete -c nmap -s R -d 'DNS resolution for all targets'
|
||||
complete -c nmap -l system-dns -d 'Use system DNS resolver'
|
||||
complete -c nmap -l dns-servers -x -a "(__fish_print_hostnames)" -d 'Servers to use for reverse DNS queries'
|
||||
|
||||
# PORT SCANNING TECHNIQUES
|
||||
complete -c nmap -o sS -d 'Scan: TCP SYN'
|
||||
complete -c nmap -o sT -d 'Scan: TCP connect'
|
||||
complete -c nmap -o sU -d 'Scan: UDP'
|
||||
complete -c nmap -o sY -d 'Scan: SCTP INIT'
|
||||
complete -c nmap -o sN -d 'Scan: TCP NULL'
|
||||
complete -c nmap -o sF -d 'Scan: FIN'
|
||||
complete -c nmap -o sX -d 'Scan: Xmas'
|
||||
complete -c nmap -o sA -d 'Scan: ACK'
|
||||
complete -c nmap -o sW -d 'Scan: Window'
|
||||
complete -c nmap -o sM -d 'Scan: Mainmon'
|
||||
complete -c nmap -l scanflags -d 'Custom TCP scan flags'
|
||||
complete -c nmap -o sZ -d 'Scan: SCTP COOKIE ECHO'
|
||||
complete -c nmap -o sI -x -a"(__fish_print_hostnames)" -d 'Scan: Idle Scan'
|
||||
complete -c nmap -o sO -d 'Scan: IP protocol'
|
||||
complete -c nmap -s b -x -a"(__fish_print_hostnames)" -d 'FTP bounce scan'
|
||||
|
||||
# PORT SPECIFICATION AND SCAN ORDER
|
||||
complete -c nmap -s p -d 'Only scan specified ports'
|
||||
complete -c nmap -l exclude-ports -d 'Exclude the specified ports from scanning'
|
||||
complete -c nmap -s F -d 'Fast (limited port) scan'
|
||||
complete -c nmap -s r -d "Don't randomize ports"
|
||||
complete -c nmap -l port-ratio -x -d 'Scan ports with ratio greater then'
|
||||
complete -c nmap -l top-ports -x -d 'Scan the n highest-ratio ports'
|
||||
|
||||
# SERVICE AND VERSION DETECTION
|
||||
complete -c nmap -o sV -d 'Scan: Version'
|
||||
complete -c nmap -l allports -d "Don't exclude any ports from version detection"
|
||||
complete -c nmap -l version-intensity -x -d 'Set version scan intensity'
|
||||
complete -c nmap -l version-light -d 'Enable light mode'
|
||||
complete -c nmap -l version-all -d 'Try every single probe'
|
||||
complete -c nmap -l version-trace -d 'Trace version scan activity'
|
||||
|
||||
# OS DETECTION
|
||||
complete -c nmap -s O -d 'Enable OS detection'
|
||||
complete -c nmap -l osscan-limit -d 'Limit OS detection to promising targets'
|
||||
complete -c nmap -l osscan-guess -d 'Guess OS detection results'
|
||||
complete -c nmap -l fuzzy -d 'Guess OS detection results'
|
||||
complete -c nmap -l max-os-tries -d 'Set the maximum number of OS detection tries against a target'
|
||||
|
||||
# NMAP SCRIPTING ENGINE (NSE)
|
||||
complete -c nmap -o sC -d 'Scan: Scripts (default)'
|
||||
function __fish_complete_nmap_script
|
||||
# cache completion for 5 minutes (`nmap --script-help all` is slow)
|
||||
if test -z "$__fish_nmap_script_completion_cache" -o (date -d "now - 5min" +"%s") -gt "$__fish_nmap_script_completion_cache_time"
|
||||
set -g __fish_nmap_script_completion_cache_time (date +"%s")
|
||||
set -g __fish_nmap_script_completion_cache ""
|
||||
set -l cmd
|
||||
for l in (nmap --script-help all|grep -A2 -B1 Categories:|grep -v '^\\(--\\|Categories:\\|https:\\)')
|
||||
if string match -q -v --regex "^ " $l
|
||||
set cmd $l
|
||||
else
|
||||
set __fish_nmap_script_completion_cache $__fish_nmap_script_completion_cache\n$cmd\t(string trim -l $l)
|
||||
end
|
||||
end
|
||||
for cat in all auth broadcast brute default discovery dos exploit external fuzzer intrusive malware safe version vuln
|
||||
set __fish_nmap_script_completion_cache $__fish_nmap_script_completion_cache\n$cat\tCategory\n
|
||||
end
|
||||
end
|
||||
echo -e $__fish_nmap_script_completion_cache
|
||||
end
|
||||
complete -c nmap -l script -r -a "(__fish_complete_list , __fish_complete_nmap_script)"
|
||||
complete -c nmap -l script -r -d 'Runs a script scan'
|
||||
complete -c nmap -l script-args -d 'provide arguments to NSE scripts'
|
||||
complete -c nmap -l script-args-file -r -d 'load arguments to NSE scripts from a file'
|
||||
complete -c nmap -l script-help -r -a "(__fish_complete_list , __fish_complete_nmap_script)"
|
||||
complete -c nmap -l script-help -r -d "Shows help about scripts"
|
||||
complete -c nmap -l script-trace
|
||||
complete -c nmap -l script-updatedb
|
||||
|
||||
# TIMING AND PERFORMANCE
|
||||
complete -c nmap -l min-hostgroup -l max-hostgroup -x -d 'Adjust paralel scan group size'
|
||||
complete -c nmap -l min-parallelism -l max-parallelism -x -d 'Adjust probe parallelization'
|
||||
complete -c nmap -l min-rtt-timeout -l max-rtt-timeout -l initial-rtt-timeout -x -d 'Adjust probe timeouts'
|
||||
complete -c nmap -l max-retries -x -d 'Specify the maximum number of port scan probe retransmissions'
|
||||
complete -c nmap -l host-timeout -d 'to skip slow hosts'
|
||||
complete -c nmap -l script-timeout -x
|
||||
complete -c nmap -l scan-delay -l max-scan-delay -x -d 'Adjust delay between probes'
|
||||
complete -c nmap -l min-rate -l max-rate -x -d 'Directly control the scanning rate'
|
||||
complete -c nmap -l defeat-rst-ratelimit -d 'ignore ICMP-RST rate limits'
|
||||
complete -c nmap -l defeat-icmp-ratelimit -d 'ignore ICMP unreachable in UDP'
|
||||
complete -c nmap -l nsock-engine -x -d 'Enforce use of a given nsock IO multiplexing engine' -a "epoll kqueue poll select"
|
||||
function __fish_complete_nmap_timing-template
|
||||
set -l i 0
|
||||
for t in paranoid sneaky polite normal aggressive insane
|
||||
printf "%i\t%s timing\n" $i $t
|
||||
printf "%s\tTemplate %i\n" $t $i
|
||||
set i (math $i + 1)
|
||||
end
|
||||
end
|
||||
complete -c nmap -s T -x -a "(__fish_complete_nmap_timing-template)" -d 'Set a timing template'
|
||||
|
||||
# FIREWALL/IDS EVASION AND SPOOFING
|
||||
complete -c nmap -s f -d 'fragment packets' -n "not __fish_contains_opt -s f"
|
||||
complete -c nmap -s f -d 'use 16 bytes per fragment' -n "__fish_contains_opt -s f"
|
||||
complete -c nmap -l mtu -d 'use specified mtu' -n "__fish_contains_opt -s f"
|
||||
complete -c nmap -s D -x -d 'Cloak a scan with decoys'
|
||||
complete -c nmap -s S -x -d 'Spoof source address'
|
||||
complete -c nmap -s e -x -d 'Use specified interface' -a "(__fish_print_interfaces)"
|
||||
complete -c nmap -l source-port -s g -x -d 'Spoof source port number'
|
||||
complete -c nmap -l data -x -d 'Append custom binary data to sent packets'
|
||||
complete -c nmap -l data-string -x -d 'Append custom string to sent packets'
|
||||
complete -c nmap -l data-length -x -d 'Append random data to sent packets'
|
||||
function __fish_complete_nmap_ip-options
|
||||
printf "S\tstrict source routing\n" # may be followed by ip addresses
|
||||
printf "R\trecord route\n" # may be followed by ip addresses
|
||||
printf "L\tloose source routing\n" # may be followed by ip addresses
|
||||
printf "T\trecord internet timestamps\n"
|
||||
printf "U\trecord timestamps and ip addresses\n"
|
||||
end
|
||||
complete -c nmap -l ip-options -x -a "(__fish_complete_nmap_ip-options)" -d 'Send packets with specified ip options'
|
||||
complete -c nmap -l ttl -x -d 'Set IP time-to-live field'
|
||||
complete -c nmap -l randomize-hosts -d 'Randomize target host order'
|
||||
complete -c nmap -l spoof-mac -x -d 'Spoof MAC address'
|
||||
complete -c nmap -l proxies -x -d 'Relay TCP connections through a chain of proxies'
|
||||
complete -c nmap -l badsum -d 'Send packets with bogus TCP/UDP checksums'
|
||||
complete -c nmap -l adler32 -d 'Use deprecated Adler32 instead of CRC32C for SCTP checksums'
|
||||
|
||||
# OUTPUT
|
||||
complete -c nmap -o oN -r -d 'normal output'
|
||||
complete -c nmap -o oX -r -d 'XML output'
|
||||
complete -c nmap -o oS -r -d 'ScRipT KIdd|3 oUTpuT'
|
||||
complete -c nmap -o oG -r -d 'grepable output'
|
||||
complete -c nmap -o oA -r -d 'Output in the three major formats'
|
||||
complete -c nmap -s v -d 'Increase/Set verbosity level'
|
||||
complete -c nmap -s d -d 'Increase/Set debugging level' -a '0 1 2 3 4 5 6 7 8 9'
|
||||
complete -c nmap -l reason -d 'Host and port state reasons'
|
||||
complete -c nmap -l stats-every -x -d 'Print periodic timing stats'
|
||||
complete -c nmap -l packet-trace -d 'Trace packets and data sent and received'
|
||||
complete -c nmap -l open -d 'Show only open (or possibly open) ports'
|
||||
complete -c nmap -l iflist -d 'List interfaces and routes'
|
||||
complete -c nmap -l append-output -d 'Append to rather than clobber output files'
|
||||
complete -c nmap -l resume -r -d 'Resume aborted scan'
|
||||
complete -c nmap -l stylesheet -r -d 'Set XSL stylesheet to transform XML output'
|
||||
complete -c nmap -l webxml -d 'Load stylesheet from Nmap.Org'
|
||||
complete -c nmap -l no-stylesheet -d 'Omit XSL stylesheet declaration from XML'
|
||||
|
||||
# MISCELLANEOUS OPTIONS
|
||||
complete -c nmap -s 6 -d 'Enable IPv6 scanning'
|
||||
complete -c nmap -s A -d 'Aggressive scan options'
|
||||
complete -c nmap -l datadir -x -a "(__fish_complete_directories)" -d 'Specify custom Nmap data file location'
|
||||
complete -c nmap -l servicedb -r -d 'Specify custom services file'
|
||||
complete -c nmap -l versiondb -r -d 'Specify custom service probes file'
|
||||
complete -c nmap -l send-eth -d 'Use raw ethernet sending'
|
||||
complete -c nmap -l send-ip -d 'Send at raw IP level'
|
||||
complete -c nmap -l privileged -d 'Assume that the user is fully privileged'
|
||||
complete -c nmap -l unprivileged -d 'Assume that the user lacks raw socket privileges'
|
||||
complete -c nmap -l release-memory -d 'Release memory before quitting'
|
||||
complete -c nmap -s V -l version -d 'Print version number'
|
||||
complete -c nmap -s h -l help -d 'Print help summary page'
|
|
@ -50,7 +50,7 @@ function __fish_complete_npm -d "Complete the commandline using npm's 'completio
|
|||
if command -sq npm
|
||||
# npm completion is bash-centric, so we need to translate fish's "commandline" stuff to bash's $COMP_* stuff
|
||||
# COMP_LINE is an array with the words in the commandline
|
||||
set -lx COMP_LINE (commandline -o)
|
||||
set -lx COMP_LINE (commandline -opc)
|
||||
# COMP_CWORD is the index of the current word in COMP_LINE
|
||||
# bash starts arrays with 0, so subtract 1
|
||||
set -lx COMP_CWORD (math (count $COMP_LINE) - 1)
|
||||
|
|
7
share/completions/openssl.fish
Normal file
7
share/completions/openssl.fish
Normal file
|
@ -0,0 +1,7 @@
|
|||
function __fish_openssl_subcommand_options --description "Print options for openssl subcommand"
|
||||
set -l cmd (commandline -poc)
|
||||
openssl list -options $cmd[2] | string replace -r -- '^(\S*)\s*.*' '-$1'
|
||||
end
|
||||
|
||||
complete -c openssl -n __fish_use_subcommand -x -a "(openssl list -1 -commands -cipher-commands -digest-commands)"
|
||||
complete -c openssl -n 'not __fish_use_subcommand && string match -qr -- "^-" (commandline -ct)' -a "(__fish_openssl_subcommand_options)"
|
|
@ -11,7 +11,7 @@ end
|
|||
# Lists PHPUnit objects corresponding to the given option
|
||||
function __fish_phpunit_list --argument option
|
||||
# Use the same PHPUnit binary as in the command being completed
|
||||
set -l phpunit (commandline -o)[1]
|
||||
set -l phpunit (commandline -opc)[1]
|
||||
test -x $phpunit
|
||||
or return
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
complete -c prevd -s l -d "Also print directory history"
|
||||
complete -c prevd -s l -l list -d "Also print directory history"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# rmmod completion
|
||||
complete -c rmmod -x -a "(/sbin/lsmod | awk 'NR > 1 {print \$1}')"
|
||||
complete -c rmmod -x -a "(lsmod | string replace -r '\s.*' '')"
|
||||
|
||||
complete -c rmmod -s h -l help -d "Prints the help text."
|
||||
complete -c rmmod -s s -l syslog -d "Send errors to syslog instead of standard error."
|
||||
complete -c rmmod -s v -l verbose -d "Print messages about what the program is doing."
|
||||
complete -c rmmod -s h -l help -d "Prints the help text"
|
||||
complete -c rmmod -s s -l syslog -d "Send errors to syslog instead of standard error"
|
||||
complete -c rmmod -s v -l verbose -d "Print messages about what the program is doing"
|
||||
complete -c rmmod -s V -l version -d "Show version of program and exit"
|
||||
complete -c rmmod -s f -l force -d "With this option, you can remove modules which are being used, or which are not designed to be removed, or have been marked as unsafe"
|
||||
|
|
24
share/completions/sftp.fish
Normal file
24
share/completions/sftp.fish
Normal file
|
@ -0,0 +1,24 @@
|
|||
complete -c sftp -x -a "(__fish_complete_user_at_hosts)"
|
||||
|
||||
complete -c sftp -s 4 -d 'Use IPv4 addresses only'
|
||||
complete -c sftp -s 6 -d 'Use IPv6 addresses only'
|
||||
complete -c sftp -s a -d 'Attempt to continue interrupted transfers'
|
||||
complete -c sftp -s B -x -d 'Size of the buffer when transferring files'
|
||||
complete -c sftp -s b -F -d 'Reads a series of commands from an input batchfile'
|
||||
complete -c sftp -s C -d 'Enables compression'
|
||||
complete -c sftp -s c -x -d 'The cipher to use for encrypting data'
|
||||
complete -c sftp -s D -x -d 'Connect directly to a local sftp server'
|
||||
complete -c sftp -s F -F -d 'Alternative per-user configuration file'
|
||||
complete -c sftp -s f -d 'Flush files to disk after transfer'
|
||||
complete -c sftp -s i -F -d 'Identity (private key) file'
|
||||
complete -c sftp -s J -x -a "(__fish_complete_user_at_hosts)" -d 'ProxyJump host'
|
||||
complete -c sftp -s l -x -d 'Limits the used bandwidth (Kbit/s)'
|
||||
complete -c sftp -s o -x -d 'Set additional ssh_config options'
|
||||
complete -c sftp -s P -x -d 'Port to connect to on the remote host'
|
||||
complete -c sftp -s p -d 'Preserve timestamps from the original files transferred'
|
||||
complete -c sftp -s q -d 'Quiet mode'
|
||||
complete -c sftp -s R -x -d 'How many requests may be outstanding'
|
||||
complete -c sftp -s r -d 'Recursively copy entire directories'
|
||||
complete -c sftp -s S -r -d 'Program to use for the encrypted connection'
|
||||
complete -c sftp -s s -x -d 'The SSH2 subsystem or the path for an sftp server'
|
||||
complete -c sftp -s v -d 'Raise logging level'
|
|
@ -13,6 +13,7 @@ complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains --
|
|||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a split
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a split0
|
||||
complete -x -c string -n 'test (count (commandline -opc)) -ge 2; and string match -qr split0\?\$ -- (commandline -opc)[2]' -s m -l max -a "(seq 1 10)" -d "Specify maximum number of splits"
|
||||
complete -x -c string -n 'test (count (commandline -opc)) -ge 2; and string match -qr split0\?\$ -- (commandline -opc)[2]' -s f -l fields -a "(seq 1 10)" -d "Specify fields"
|
||||
complete -f -c string -n 'test (count (commandline -opc)) -ge 2; and string match -qr split0\?\$ -- (commandline -opc)[2]' -s r -l right -d "Split right-to-left"
|
||||
complete -f -c string -n 'test (count (commandline -opc)) -ge 2; and string match -qr split0\?\$ -- (commandline -opc)[2]' -s n -l no-empty -d "Empty results excluded"
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a collect
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
# Completions for su
|
||||
function __fish_complete_su_env_whitelist
|
||||
env | string match -v -e -r '^(?:HOME|SHELL|USER|LOGNAME|PATH)=' | string replace -r '([^=]+)=(.*)' '$1\t$2'
|
||||
end
|
||||
|
||||
complete -c su -x -a "(__fish_complete_users)"
|
||||
|
||||
complete -x -c su -a "(__fish_complete_users)"
|
||||
complete -c su -s l -l login -d "Make login shell"
|
||||
complete -c su -s c -l command -d "Pass command to shell" -xa "(__fish_complete_external_command)"
|
||||
complete -c su -s f -l fast -d "Pass -f to the shell"
|
||||
complete -c su -s m -l preserve_environment -d "Preserve environment"
|
||||
complete -c su -s p -d "Preserve environment"
|
||||
complete -x -c su -s s -l shell -a "(cat /etc/shells)"
|
||||
complete -c su -l help -d "Display help and exit"
|
||||
complete -c su -l version -d "Display version and exit"
|
||||
|
||||
complete -c su -s g -l group -x -a "(__fish_complete_groups)" -d "Specify the primary group"
|
||||
complete -c su -s G -l supp-group -x -a "(__fish_complete_groups)" -d "Specify a supplemental group"
|
||||
complete -c su -s m -s p -l preserve_environment -d "Preserve environment"
|
||||
complete -c su -s P -l pty -d "Create pseudo-terminal for the session"
|
||||
complete -c su -s s -l shell -x -a "(cat /etc/shells)" -d "Run the specified shell"
|
||||
complete -c su -s w -l whitelist-environment -x -a "(__fish_complete_list , __fish_complete_su_env_whitelist)" -d "Don't reset these environment variables"
|
||||
complete -c su -s h -l help -d "Display help and exit"
|
||||
complete -c su -s V -l version -d "Display version and exit"
|
||||
|
|
|
@ -320,12 +320,12 @@ _svn_cmpl_ svn:keywords -a Id -d 'A compressed summary of all keywords'
|
|||
#
|
||||
# Completions for the 'relocate' subcommand
|
||||
#
|
||||
_svn_cmpl_ $relocate -xa '( svn info | string match "*URL:*" | cut -d " " -f 2 ) http:// ftp:// svn+ssh:// svn+ssh://(__fish_print_hostnames)'
|
||||
_svn_cmpl_ $relocate -xa '( svn info | string match "*URL:*" | string split -f2 " ") http:// ftp:// svn+ssh:// svn+ssh://(__fish_print_hostnames)'
|
||||
|
||||
#
|
||||
# Completions for the 'switch', 'sw' subcommands
|
||||
#
|
||||
_svn_cmpl_ $switch -l relocate -d 'Relocate via URL-rewriting' -xa '( svn info | string match "*URL:*" | cut -d " " -f 2 ) http:// ftp:// svn+ssh:// svn+ssh://(__fish_print_hostnames)'
|
||||
_svn_cmpl_ $switch -l relocate -d 'Relocate via URL-rewriting' -xa '( svn info | string match "*URL:*" | string split -f2 " ") http:// ftp:// svn+ssh:// svn+ssh://(__fish_print_hostnames)'
|
||||
|
||||
#
|
||||
# Completions for the 'status', 'st' subcommands
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
function __fish_tokei_supported_serializations
|
||||
# Expecting a line like:
|
||||
# tokei 10.0.1 compiled with serialization support: cbor, json, yaml
|
||||
command tokei --help | grep 'with serialization support' | cut -d : -f 2 | string trim | string split ', '
|
||||
command tokei --help | grep 'with serialization support' | string split --fields 2 : | string trim | string split ', '
|
||||
end
|
||||
|
||||
complete -c tokei -s f -l files -d 'Print out statistics for individual files'
|
||||
|
|
|
@ -28,7 +28,11 @@ complete -c unzip -s M -d "pipe through `more` pager"
|
|||
if unzip -v 2>/dev/null | string match -eq Debian
|
||||
|
||||
# the first non-switch argument should be the zipfile
|
||||
complete -c unzip -n __fish_is_first_token -xa '(__fish_complete_suffix .zip)'
|
||||
complete -c unzip -n __fish_is_first_token -xa '(
|
||||
__fish_complete_suffix .zip
|
||||
__fish_complete_suffix .jar
|
||||
__fish_complete_suffix .aar
|
||||
)'
|
||||
|
||||
# Files thereafter are either files to include or exclude from the operation
|
||||
set -l zipfile
|
||||
|
@ -37,6 +41,10 @@ if unzip -v 2>/dev/null | string match -eq Debian
|
|||
else
|
||||
|
||||
# all tokens should be zip files
|
||||
complete -c unzip -xa '(__fish_complete_suffix .zip)'
|
||||
complete -c unzip -xa '(
|
||||
__fish_complete_suffix .zip
|
||||
__fish_complete_suffix .jar
|
||||
__fish_complete_suffix .aar
|
||||
)'
|
||||
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
complete -c useradd -s c -l comment -d 'A comment about this user' -r
|
||||
complete -c useradd -s d -l home -d 'Home directory for the new user' -x -a '(__fish_complete_directories)'
|
||||
complete -c useradd -s G -l groups -d 'Supplementary groups' -xa '(__fish_append , (cut -d : -f 1 /etc/group))'
|
||||
complete -c useradd -s G -l groups -d 'Supplementary groups' -xa '(__fish_append , (string split -f1 : /etc/group))'
|
||||
complete -c useradd -s h -l help -d 'Display help message and exit'
|
||||
complete -c useradd -s m -l create-home -d 'The user\'s home directory will be created if it does not exist'
|
||||
complete -c useradd -s n -d 'A group having the same name as the user being added to the system will be created by default (when -g is not specified)'
|
||||
|
@ -18,5 +18,5 @@ complete -c useradd -s u -l uid -d 'The numerical value of the user\'s ID' -r
|
|||
complete -c useradd -s b -l base-dir -d 'The initial path prefix for a new user\'s home directory' -r -a '(__fish_complete_directories)'
|
||||
complete -c useradd -s e -l expiredate -d 'The date on which the user account is disabled' -r
|
||||
complete -c useradd -s f -l inactive -d 'The number of days after a password has expired before the account will be disabled' -r
|
||||
complete -c useradd -s g -l gid -d 'The group name or ID for a new user\'s initial group' -x -a '(string match -r "^[^#].*" < /etc/group | cut -d : -f 1,3 | string replace -a ":" \n)'
|
||||
complete -c useradd -s g -l gid -d 'The group name or ID for a new user\'s initial group' -x -a '(string match -r "^[^#].*" < /etc/group | string split -f1,3 ":" | string join ":" | string replace -a ":" \n)'
|
||||
complete -c useradd -s s -l shell -d 'Name of the new user\'s login shell' -x -a '(string match -r "^[^#].*" < /etc/shells)'
|
||||
|
|
3
share/completions/wait.fish
Normal file
3
share/completions/wait.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
complete -c wait -xa '(__fish_complete_job_pids)'
|
||||
complete -c wait -s n -l any -d 'Return as soon as the first job completes'
|
||||
complete -c wait -s h -l help -d 'Display help and exit'
|
|
@ -16,7 +16,7 @@ complete -c wget -o nv -d "Turn off verbose without being completely quiet"
|
|||
complete -c wget -s i -l input-file -d "Read URLs from file" -r
|
||||
complete -c wget -s F -l force-html -d "Force input to be treated as HTML"
|
||||
complete -c wget -s B -l base -d "Prepend string to relative links" -x
|
||||
complete -c wget -l bind-adress -d "Bind address on local machine" -xa "(__fish_print_addresses; __fish_print_hostnames)"
|
||||
complete -c wget -l bind-address -d "Bind address on local machine" -xa "(__fish_print_addresses; __fish_print_hostnames)"
|
||||
complete -c wget -s t -l tries -d "Set number of retries to number" -xa "0 1 2 4 8 16 32 64 128"
|
||||
complete -c wget -s O -l output-document -d "Concatenate output to file" -r
|
||||
complete -c wget -l no-clobber -d "Never overwrite files with same name"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function __fish_xprop_list_properties
|
||||
# TODO search commandline for a target window ("-root" or "-name foo")
|
||||
xprop -root | cut -d'(' -f 1
|
||||
xprop -root | string split -f1 '('
|
||||
end
|
||||
|
||||
complete -c xprop -o help -d "Display help and exit"
|
||||
|
@ -19,4 +19,3 @@ complete -c xprop -o set -d "Set property" -x -a " (__fish_xprop_list_properties
|
|||
complete -c xprop -o spy -d "Examine property updates forever"
|
||||
complete -c xprop -o f -d "Set format"
|
||||
complete -c xprop -d Property -x -a "( __fish_xprop_list_properties)"
|
||||
|
||||
|
|
8
share/completions/zopfli.fish
Normal file
8
share/completions/zopfli.fish
Normal file
|
@ -0,0 +1,8 @@
|
|||
complete -c zopfli -s h -d "Gives this help"
|
||||
complete -c zopfli -s c -d "Write the result on stdout"
|
||||
complete -c zopfli -s v -d "Verbose mode"
|
||||
complete -c zopfli -l i -d "Number of iterations"
|
||||
complete -c zopfli -l gzip -d "Output to gzip format (default)"
|
||||
complete -c zopfli -l zlib -d "Output to zlib format"
|
||||
complete -c zopfli -l deflate -d "Output to deflate format"
|
||||
complete -c zopfli -l splitlast -d "Left for backwards compatibility"
|
15
share/completions/zopflipng.fish
Normal file
15
share/completions/zopflipng.fish
Normal file
|
@ -0,0 +1,15 @@
|
|||
complete -x -c zopflipng -a "(__fish_complete_suffix .png)"
|
||||
|
||||
complete -c zopflipng -s m -d "Compress more"
|
||||
complete -c zopflipng -l prefix -d "Add prefix"
|
||||
complete -c zopflipng -s y -d "Do not ask about overwriting"
|
||||
complete -c zopflipng -l lossy_transparent -d "Remove colors behind alpha channel 0"
|
||||
complete -c zopflipng -l lossy_8bit -d "Convert PNG16 to PNG8"
|
||||
complete -c zopflipng -s d -d "Dry run"
|
||||
complete -c zopflipng -l always_zopflify -d "For benchmarking the algorithm"
|
||||
complete -c zopflipng -s q -d "Use quick"
|
||||
complete -c zopflipng -l iterations -d "Number of iterations"
|
||||
complete -c zopflipng -l splitting -d "Left for backwards compatibility"
|
||||
complete -x -c zopflipng -l filters -a "0 1 2 3 4 m e p b" -d "Filter strategies"
|
||||
complete -c zopflipng -l keepchunks -d "Keep metadata chunks"
|
||||
complete -c zopflipng -s h -l help -d "Show help"
|
|
@ -106,15 +106,6 @@ else if not contains -- $__fish_data_dir/completions $fish_complete_path
|
|||
set -a fish_complete_path $__fish_data_dir/completions
|
||||
end
|
||||
|
||||
# This cannot be in an autoload-file because `:.fish` is an invalid filename on windows.
|
||||
function : -d "no-op function"
|
||||
# for compatibility with sh, bash, and others.
|
||||
# Often used to insert a comment into a chain of commands without having
|
||||
# it eat up the remainder of the line, handy in Makefiles.
|
||||
# This command always succeeds
|
||||
true
|
||||
end
|
||||
|
||||
# Add a handler for when fish_user_path changes, so we can apply the same changes to PATH
|
||||
function __fish_reconstruct_path -d "Update PATH when fish_user_paths changes" --on-variable fish_user_paths
|
||||
set -l local_path $PATH
|
||||
|
@ -163,16 +154,6 @@ end
|
|||
# in UTF-8 (with non-ASCII characters).
|
||||
__fish_set_locale
|
||||
|
||||
# "." alias for source; deprecated
|
||||
function . -d 'Evaluate a file (deprecated, use "source")' --no-scope-shadowing --wraps source
|
||||
if [ (count $argv) -eq 0 ] && isatty 0
|
||||
echo "source: using source via '.' is deprecated, and stdin doesn't work."\n"Did you mean 'source' or './'?" >&2
|
||||
return 1
|
||||
else
|
||||
source $argv
|
||||
end
|
||||
end
|
||||
|
||||
# Upgrade pre-existing abbreviations from the old "key=value" to the new "key value" syntax.
|
||||
# This needs to be in share/config.fish because __fish_config_interactive is called after sourcing
|
||||
# config.fish, which might contain abbr calls.
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
function __fish_complete_gpg_user_id -d "Complete using gpg user ids" -a __fish_complete_gpg_command
|
||||
# gpg doesn't seem to like it when you use the whole key name as a
|
||||
# completion, so we skip the <EMAIL> part and use it as a
|
||||
# description.
|
||||
# It also replaces colons with \x3a
|
||||
$__fish_complete_gpg_command --list-keys --with-colon | cut -d : -f 10 | sed -ne 's/\\\x3a/:/g' -e 's/\(.*\) <\(.*\)>/\1'\t'\2/p'
|
||||
# completion, so we skip the <EMAIL> part and use it as a description.
|
||||
# It also replaces \x3a from gpg's output with colons.
|
||||
$__fish_complete_gpg_command --list-keys --with-colon | string split -a -f 10 : | string replace '\x3a' : | string replace -rf '(.*) <(.*)>' '$1\t$2'
|
||||
end
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
|
||||
function __fish_complete_groups --description "Print a list of local groups, with group members as the description"
|
||||
if command -sq getent
|
||||
getent group | cut -d ':' -f 1,4 | string replace : \t
|
||||
getent group | while read -l line
|
||||
string split -f 1,4 : -- $line | string join \t
|
||||
end
|
||||
else
|
||||
cut -d ':' -f 1,4 /etc/group | string replace : \t
|
||||
while read -l line
|
||||
string split -f 1,4 : -- $line | string join \t
|
||||
end </etc/group
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,16 +2,20 @@
|
|||
# The whatis database is non-existent, so apropos tries (and fails) to create it every time,
|
||||
# which takes about half a second.
|
||||
#
|
||||
# So we disable this entirely in that case.
|
||||
# So we disable this entirely in that case, unless the user has overridden the system
|
||||
# `apropos` with their own, which presumably doesn't have the same problem.
|
||||
if test (uname) = Darwin
|
||||
set -l darwin_version (uname -r | string split .)
|
||||
# macOS 15 is Darwin 19, this is an issue at least up to 10.15.3.
|
||||
# If this is fixed in later versions uncomment the second check.
|
||||
if test "$darwin_version[1]" = 19 # -a "$darwin_version[2]" -le 3
|
||||
function __fish_complete_man
|
||||
set -l apropos (command -s apropos)
|
||||
if test "$apropos" = /usr/bin/apropos
|
||||
function __fish_complete_man
|
||||
end
|
||||
# (remember: exit when `source`ing only exits the file, not the shell)
|
||||
exit
|
||||
end
|
||||
# (remember: exit when `source`ing only exits the file, not the shell)
|
||||
exit
|
||||
end
|
||||
end
|
||||
|
||||
|
|
83
share/functions/__fish_complete_netcat.fish
Normal file
83
share/functions/__fish_complete_netcat.fish
Normal file
|
@ -0,0 +1,83 @@
|
|||
function __fish_complete_netcat
|
||||
set -l nc $argv[1]
|
||||
set -l flavor $argv[-1]
|
||||
|
||||
switch $flavor
|
||||
case busybox
|
||||
complete -c $nc -s l -d "Listen mode, for inbound connects"
|
||||
complete -c $nc -s p -x -d "Local port"
|
||||
complete -c $nc -s w -x -d "Connect timeout"
|
||||
complete -c $nc -s i -x -d "Delay interval for lines sent"
|
||||
complete -c $nc -s f -r -d "Use file (ala /dev/ttyS0) instead of network"
|
||||
complete -c $nc -s e -r -d "Run PROG after connect"
|
||||
|
||||
case ncat
|
||||
complete -c $nc -w ncat
|
||||
|
||||
case nc.openbsd
|
||||
complete -c $nc -s 4 -d "Forces nc to use IPv4 addresses only"
|
||||
complete -c $nc -s 6 -d "Forces nc to use IPv6 addresses only"
|
||||
complete -c $nc -s b -d "Allow broadcast"
|
||||
complete -c $nc -s C -d "Send CRLF as line-ending"
|
||||
complete -c $nc -s D -d "Enable debugging on the socket"
|
||||
complete -c $nc -s d -d "Do not attempt to read from stdin"
|
||||
complete -c $nc -s F -d "Pass the first connected socket using sendmsg(2) to stdout and exit"
|
||||
complete -c $nc -s h -d "Prints out nc help"
|
||||
complete -c $nc -s I -x -d "Specifies the size of the TCP receive buffer"
|
||||
complete -c $nc -s i -x -d "Specifies a delay time interval between lines of text sent and received"
|
||||
complete -c $nc -s k -d "Forces nc to stay listening for another connection after its current connection is completed"
|
||||
complete -c $nc -s l -d "Used to specify that nc should listen for an incoming connection rather than initiate a connection to a remote host"
|
||||
complete -c $nc -s M -x -d "Set the TTL / hop limit of outgoing packets"
|
||||
complete -c $nc -s m -x -d "Ask the kernel to drop incoming packets whose TTL / hop limit is under minttl"
|
||||
complete -c $nc -s N -d "shutdown(2) the network socket after EOF on the input"
|
||||
complete -c $nc -s n -d "Do not do any DNS or service lookups on any specified addresses, hostnames or ports"
|
||||
complete -c $nc -s O -x -d "Specifies the size of the TCP send buffer"
|
||||
complete -c $nc -s P -x -d "Specifies a username to present to a proxy server that requires authentication"
|
||||
complete -c $nc -s p -x -d "Specifies the source port nc should use, subject to privilege restrictions and availability"
|
||||
complete -c $nc -s q -x -d "after EOF on stdin, wait the specified number of seconds and then quit"
|
||||
complete -c $nc -s r -d "Specifies that source and/or destination ports should be chosen randomly instead of sequentially within a range or in the order that the system assigns them"
|
||||
complete -c $nc -s S -d "Enables the RFC 2385 TCP MD5 signature option"
|
||||
complete -c $nc -s s -x -d "Specifies the IP of the interface which is used to send the packets"
|
||||
complete -c $nc -s T -x -a "critical inetcontrol lowcost lowdelay netcontrol throughput reliability ef af cs0 cs1 cs2 cs3 cs4 cs5 cs6 cs7" -d "Change IPv4 TOS value"
|
||||
complete -c $nc -s t -d "Causes nc to send RFC 854 DON'T and WON'T responses to RFC 854 DO and WILL requests"
|
||||
complete -c $nc -s U -d "Specifies to use UNIX-domain sockets"
|
||||
complete -c $nc -s u -d "Use UDP instead of the default option of TCP"
|
||||
complete -c $nc -s V -x -d "Set the routing table to be used"
|
||||
complete -c $nc -s v -d "Have nc give more verbose output"
|
||||
complete -c $nc -s W -x -d "Terminate after receiving recvlimit packets from the network"
|
||||
complete -c $nc -s w -x -d "Connections which cannot be established or are idle timeout after timeout seconds"
|
||||
function __fish_complete_nc-connect-openbsd
|
||||
printf "connect\tHTTPS proxy\n"
|
||||
printf "4\tSOCKS v.4\n"
|
||||
printf "5\tSOCKS v.5\n"
|
||||
end
|
||||
complete -c $nc -s X -x -a "(__fish_complete_nc-connect-openbsd)" -d "Requests that nc should use the specified protocol when talking to the proxy server"
|
||||
complete -c $nc -s x -x -a "(__fish_print_hostnames)" -d "Requests that nc should connect to destination using a proxy at proxy_address and port"
|
||||
complete -c $nc -s Z -d "DCCP mode"
|
||||
complete -c $nc -s z -d "Specifies that nc should just scan for listening daemons, without sending any data to them"
|
||||
|
||||
case nc.traditional '*' # fallback to the most restricted one
|
||||
complete -c $nc -s c -r -d "specify shell commands to exec after connect"
|
||||
complete -c $nc -s e -r -d "specify filename to exec after connect"
|
||||
complete -c $nc -s g -x -d "source-routing hop point[s], up to 8"
|
||||
complete -c $nc -s G -x -d "source-routing pointer: 4, 8, 12, ..."
|
||||
complete -c $nc -s h -d "display help"
|
||||
complete -c $nc -s i -x -d "delay interval for lines sent, ports scanned"
|
||||
complete -c $nc -s l -d "listen mode, for inbound connects"
|
||||
complete -c $nc -s n -d "numeric-only IP addresses, no DNS"
|
||||
complete -c $nc -s o -r -d "hex dump of traffic"
|
||||
complete -c $nc -s p -x -d "local port number (port numbers can be individual or ranges: lo-hi [inclusive])"
|
||||
complete -c $nc -s q -x -d "after EOF on stdin, wait the specified number of seconds and then quit"
|
||||
complete -c $nc -s b -d "allow UDP broadcasts"
|
||||
complete -c $nc -s r -d "randomize local and remote ports"
|
||||
complete -c $nc -s s -x -d "local source address"
|
||||
complete -c $nc -s t -d "enable telnet negotiation"
|
||||
complete -c $nc -s u -d "UDP mode"
|
||||
complete -c $nc -s v -d "verbose [use twice to be more verbose]"
|
||||
complete -c $nc -s w -x -d "timeout for connects and final net reads"
|
||||
complete -c $nc -s C -d "Send CRLF as line-ending"
|
||||
complete -c $nc -s z -d "zero-I/O mode [used for scanning]"
|
||||
complete -c $nc -s T -x -a "Minimize-Delay Maximize-Throughput Maximize-Reliability Minimize-Cost" -x -d "set TOS flag"
|
||||
end
|
||||
end
|
||||
|
|
@ -5,6 +5,6 @@ function __fish_complete_pids -d "Print a list of process identifiers along with
|
|||
|
||||
# Display the tty if available
|
||||
# But not if it's just question marks, meaning no tty
|
||||
ps axc -o pid,ucomm,tty | string match -r -v '^\s*'$fish_pid'\s' | tail -n +2 | string replace -r ' *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+) *$' '$1\t$2 [$3]' | string replace -r ' *\[\?*\] *$' ''
|
||||
__fish_ps -o pid,comm,tty | string match -r -v '^\s*'$fish_pid'\s' | tail -n +2 | string replace -r ' *([0-9]+) +([^ ].*[^ ]|[^ ]) +([^ ]+) *$' '$1\t$2 [$3]' | string replace -r ' *\[\?*\] *$' ''
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function __fish_complete_proc
|
||||
function __fish_complete_proc --inherit-variable ps
|
||||
# "comm=" means "print comm field with an empty name", which causes the header to be removed.
|
||||
# On many systems, comm is truncated (e.g. on Linux it's 15 chars),
|
||||
# but that's okay since commands that accept them as argument also only use those (e.g. pgrep).
|
||||
# String removes zombies (ones in parentheses) and padding (macOS adds some apparently).
|
||||
ps -axc -o comm= | string match -rv '\(.*\)' | string trim
|
||||
__fish_ps -o comm= | string match -rv '\(.*\)' | string trim
|
||||
end
|
||||
|
|
|
@ -4,11 +4,15 @@
|
|||
# only the first field, the relevant one, from the comma-separated list
|
||||
function __fish_complete_users --description "Print a list of local users, with the real user name as a description"
|
||||
if command -sq getent
|
||||
command getent passwd | cut -d : -f 1,5 | string replace -r ':' \t | string replace -r ',.*' ''
|
||||
command getent passwd | while read -l line
|
||||
string split -f 1,5 : -- $line | string join \t | string replace -r ',.*' ''
|
||||
end
|
||||
else if command -sq dscl
|
||||
# This is the "Directory Service command line utility" used on macOS in place of getent.
|
||||
command dscl . -list /Users RealName | string match -r -v '^_' | string replace -r ' {2,}' \t
|
||||
else if test -r /etc/passwd
|
||||
string match -v -r '^\s*#' </etc/passwd | cut -d : -f 1,5 | string replace ':' \t | string replace -r ',.*' ''
|
||||
string match -v -r '^\s*#' </etc/passwd | while read -l line
|
||||
string split -f 1,5 : -- $line | string join \t | string replace -r ',.*' ''
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -168,7 +168,7 @@ function __fish_config_interactive -d "Initializations that should be performed
|
|||
#
|
||||
# Only a few builtins take filenames; initialize the rest with no file completions
|
||||
#
|
||||
complete -c(builtin -n | string match -rv '(source|cd|exec|realpath|set|\\[|test|for)') --no-files
|
||||
complete -c(builtin -n | string match -rv '(\.|:|source|cd|contains|count|echo|exec|printf|random|realpath|set|\\[|test|for)') --no-files
|
||||
|
||||
# Reload key bindings when binding variable change
|
||||
function __fish_reload_key_bindings -d "Reload key bindings when binding variable change" --on-variable fish_key_bindings
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# a function to obtain a list of installed packages with CRUX pkgutils
|
||||
function __fish_crux_packages -d 'Obtain a list of installed packages'
|
||||
pkginfo -i | cut -d' ' -f1
|
||||
pkginfo -i | string split -f1 ' '
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ function __fish_md5
|
|||
# BSD systems
|
||||
if set -q argv[2]
|
||||
if test $argv[1] = -s
|
||||
md5 -s $argv[1]
|
||||
md5 -s $argv[2]
|
||||
else
|
||||
printf (_ "%s: Too many arguments %s\n") fish_md5 $argv
|
||||
end
|
||||
|
|
27
share/functions/__fish_preview_current_file.fish
Normal file
27
share/functions/__fish_preview_current_file.fish
Normal file
|
@ -0,0 +1,27 @@
|
|||
function __fish_preview_current_file --description "Open the file at the cursor in a pager"
|
||||
set -l pager less --
|
||||
set -q PAGER && echo $PAGER | read -at pager
|
||||
|
||||
# commandline -t will never return an empty list. However, the token
|
||||
# could comprise multiple lines, so join them into a single string.
|
||||
set -l file (commandline -t | string collect)
|
||||
|
||||
if test -z $file
|
||||
# $backslash will parsed as regex which may need additional escaping.
|
||||
set -l backslash '\\\\'
|
||||
not status test-feature regex-easyesc && set backslash $backslash$backslash
|
||||
set file (string replace -ra -- '([ ;#^<>&|()"\'])' "$backslash\$1" (commandline -oc)[-1])
|
||||
end
|
||||
|
||||
set -q file[1] || return
|
||||
|
||||
# strip -option= from token if present
|
||||
set file (string replace -r -- '^-[^\s=]*=' '' $file | string collect)
|
||||
|
||||
eval set -l files $file || return # Bail if $file does not tokenize.
|
||||
|
||||
if set -q files[1] && test -f $files[1]
|
||||
$pager $files
|
||||
commandline -f repaint
|
||||
end
|
||||
end
|
8
share/functions/__fish_ps.fish
Normal file
8
share/functions/__fish_ps.fish
Normal file
|
@ -0,0 +1,8 @@
|
|||
function __fish_ps
|
||||
switch (realpath (command -v ps) | string match -r '[^/]+$')
|
||||
case busybox
|
||||
command ps $argv
|
||||
case '*'
|
||||
command ps axc $argv
|
||||
end
|
||||
end
|
|
@ -84,6 +84,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
|
|||
bind --preset $argv \e. history-token-search-backward
|
||||
|
||||
bind --preset $argv \el __fish_list_current_token
|
||||
bind --preset $argv \eo __fish_preview_current_file
|
||||
bind --preset $argv \ew __fish_whatis_current_token
|
||||
# ncurses > 6.0 sends a "delete scrollback" sequence along with clear.
|
||||
# This string replace removes it.
|
||||
|
|
|
@ -74,12 +74,11 @@ function __fish_systemctl --description 'Call systemctl with some options from t
|
|||
# Output looks like
|
||||
# systemd-tmpfiles-clean.timer [more whitespace] loaded active waiting Daily Cleanup[...]
|
||||
# Use the last part as the description.
|
||||
# Note that in some cases this prints a "●" or "*" (with C locale) marker at the beginning of the line. We have to remove it.
|
||||
systemctl --no-legend --no-pager --all list-units $passflags | string trim -c ' *●' | string replace -r "(?: +(\S+)){4}" \t'$1'
|
||||
systemctl --full --no-legend --no-pager --plain --all list-units $passflags | string replace -r "(?: +(\S+)){4}" \t'$1'
|
||||
# We need this for disabled/static units. Also instance units without an active instance.
|
||||
# Output looks like
|
||||
# systemd-tmpfiles-clean.timer static
|
||||
# Just use the state as the description, since we won't get it here.
|
||||
# This is an issue for units that appear in both.
|
||||
systemctl --no-legend --no-pager --all list-unit-files $passflags | string trim -c ' *●' | string replace -r "(?: +(\S+)){1}" \t'$1'
|
||||
systemctl --full --no-legend --no-pager --plain --all list-unit-files $passflags | string replace -r "(?: +(\S+)){1}" \t'$1'
|
||||
end
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
function __fish_systemctl_services
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
systemctl --user list-unit-files --no-legend --type=service 2>/dev/null $argv | cut -f 1 -d ' '
|
||||
systemctl --user list-units --state=loaded --no-legend --type=service 2>/dev/null | cut -f 1 -d ' '
|
||||
systemctl --user list-unit-files --full --no-legend --no-pager --plain --type=service 2>/dev/null $argv | string split -f 1 ' '
|
||||
systemctl --user list-units --state=loaded --full --no-legend --no-pager --plain --type=service 2>/dev/null | string split -f 1 ' '
|
||||
else
|
||||
# list-unit-files will also show disabled units
|
||||
systemctl list-unit-files --no-legend --type=service 2>/dev/null $argv | cut -f 1 -d ' '
|
||||
systemctl list-unit-files --full --no-legend --no-pager --plain --type=service 2>/dev/null $argv | string split -f 1 ' '
|
||||
# list-units will not show disabled units but will show instances (like wpa_supplicant@wlan0.service)
|
||||
systemctl list-units --state=loaded --no-legend --type=service 2>/dev/null | cut -f 1 -d ' '
|
||||
systemctl list-units --state=loaded --full --no-legend --no-pager --plain --type=service 2>/dev/null | string split -f 1 ' '
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@ function alias --description 'Creates a function wrapping a command'
|
|||
if not set -q argv[1]
|
||||
# Print the known aliases.
|
||||
for func in (functions -n)
|
||||
set -l output (functions $func | string match -r -- "^function .* --description 'alias (.*)'")
|
||||
set -l output (functions $func | string match -r -- "^function .* --description (?:'alias (.*)'|alias\\\\ (.*))\$")
|
||||
if set -q output[2]
|
||||
set output (string replace -r -- '^'$func'[= ]' '' $output[2])
|
||||
echo alias $func (string escape -- $output[1])
|
||||
|
|
|
@ -3,14 +3,14 @@ function fish_clipboard_copy
|
|||
set -l cmdline (commandline --current-selection)
|
||||
test -n "$cmdline"; or set cmdline (commandline)
|
||||
if type -q pbcopy
|
||||
printf '%s\n' $cmdline | pbcopy
|
||||
printf '%s' $cmdline | pbcopy
|
||||
else if set -q WAYLAND_DISPLAY; and type -q wl-copy
|
||||
printf '%s\n' $cmdline | wl-copy
|
||||
printf '%s' $cmdline | wl-copy
|
||||
else if type -q xsel
|
||||
# Silence error so no error message shows up
|
||||
# if e.g. X isn't running.
|
||||
printf '%s\n' $cmdline | xsel --clipboard 2>/dev/null
|
||||
printf '%s' $cmdline | xsel --clipboard 2>/dev/null
|
||||
else if type -q xclip
|
||||
printf '%s\n' $cmdline | xclip -selection clipboard 2>/dev/null
|
||||
printf '%s' $cmdline | xclip -selection clipboard 2>/dev/null
|
||||
end
|
||||
end
|
||||
|
|
|
@ -414,7 +414,7 @@ function fish_git_prompt --description "Prompt function for Git"
|
|||
end
|
||||
|
||||
if set -q __fish_git_prompt_showstashstate
|
||||
and test -r $git_dir/refs/stash
|
||||
and test -r $git_dir/logs/refs/stash
|
||||
set s $___fish_git_prompt_char_stashstate
|
||||
end
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ function fish_hg_prompt --description 'Write out the hg prompt'
|
|||
end
|
||||
|
||||
set -l root (fish_print_hg_root)
|
||||
or return 0
|
||||
or return 1
|
||||
|
||||
# Read branch and bookmark
|
||||
set -l branch (cat $root/branch 2>/dev/null; or echo default)
|
||||
|
@ -62,7 +62,7 @@ function fish_hg_prompt --description 'Write out the hg prompt'
|
|||
|
||||
# Add a character for each file status if we have one
|
||||
# HACK: To allow this to work both with and without '?' globs
|
||||
set -l q '?'
|
||||
set -l dq '?'
|
||||
switch $line
|
||||
case 'A '
|
||||
set -a hg_statuses added
|
||||
|
|
|
@ -187,7 +187,7 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
|
|||
bind -s --preset -m insert ci backward-jump-till and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection repaint-mode
|
||||
bind -s --preset -m insert ca backward-jump and repeat-jump-reverse and begin-selection repeat-jump kill-selection end-selection repaint-mode
|
||||
|
||||
bind -s --preset '~' capitalize-word
|
||||
bind -s --preset '~' togglecase-char forward-char
|
||||
bind -s --preset gu downcase-word
|
||||
bind -s --preset gU upcase-word
|
||||
|
||||
|
@ -291,6 +291,7 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
|
|||
bind -s --preset -M visual -m default X kill-whole-line end-selection repaint-mode
|
||||
bind -s --preset -M visual -m default y kill-selection yank end-selection repaint-mode
|
||||
bind -s --preset -M visual -m default '"*y' "commandline -s | xsel -p; commandline -f end-selection repaint-mode"
|
||||
bind -s --preset -M visual -m default '~' togglecase-selection end-selection repaint-mode
|
||||
|
||||
bind -s --preset -M visual -m default \cc end-selection repaint-mode
|
||||
bind -s --preset -M visual -m default \e end-selection repaint-mode
|
||||
|
|
|
@ -162,7 +162,7 @@ function help --description 'Show help for the fish shell'
|
|||
end
|
||||
else
|
||||
# Go to the web. Only include one dot in the version string
|
||||
set -l version_string (echo $version| cut -d . -f 1,2)
|
||||
set -l version_string (string split . -f 1,2 -- $version | string join .)
|
||||
set page_url https://fishshell.com/docs/$version_string/$fish_help_page
|
||||
# We don't need a trampoline for a remote URL.
|
||||
set need_trampoline
|
||||
|
|
|
@ -16,7 +16,8 @@ Redistributions in binary form must reproduce the above copyright notice, this l
|
|||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
"""
|
||||
|
||||
import string, sys, re, os.path, bz2, gzip, traceback, getopt, errno, codecs
|
||||
import string, sys, re, os.path, bz2, gzip, traceback, errno, codecs
|
||||
import argparse
|
||||
from deroff import Deroffer
|
||||
|
||||
lzma_available = True
|
||||
|
@ -48,8 +49,8 @@ diagnostic_indent = 0
|
|||
VERY_VERBOSE, BRIEF_VERBOSE, NOT_VERBOSE = 2, 1, 0
|
||||
|
||||
# Pick some reasonable default values for settings
|
||||
global VERBOSITY, WRITE_TO_STDOUT, DEROFF_ONLY
|
||||
VERBOSITY, WRITE_TO_STDOUT, DEROFF_ONLY = NOT_VERBOSE, False, False
|
||||
global VERBOSITY, WRITE_TO_STDOUT, DEROFF_ONLY, KEEP_FILES
|
||||
VERBOSITY, WRITE_TO_STDOUT, DEROFF_ONLY, KEEP_FILES = NOT_VERBOSE, False, False, False
|
||||
|
||||
|
||||
def add_diagnostic(dgn, msg_verbosity=VERY_VERBOSE):
|
||||
|
@ -994,101 +995,88 @@ def get_paths_from_man_locations():
|
|||
return result
|
||||
|
||||
|
||||
def usage(script_name):
|
||||
print(
|
||||
"Usage: {0} [-v, --verbose] [-s, --stdout] [-d, --directory] [-p, --progress]"
|
||||
" [-c, --cleanup-in] [-z] files...".format(script_name)
|
||||
)
|
||||
print(
|
||||
"""Command options are:
|
||||
-h, --help\t\tShow this help message
|
||||
-v, --verbose [0, 1, 2]\tShow debugging output to stderr. Larger is more verbose.
|
||||
-s, --stdout\tWrite all completions to stdout (trumps the --directory option)
|
||||
-d, --directory [dir]\tWrite all completions to the given directory, instead of to ~/.local/share/fish/generated_completions
|
||||
-m, --manpath\tProcess all man1 and man8 files available in the manpath (as determined by manpath)
|
||||
-p, --progress\tShow progress
|
||||
-c, --cleanup-in\tRemove all .fish files out of a given directory.
|
||||
-z\t\tParse using only Deroff parser.
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
script_name = sys.argv[0]
|
||||
try:
|
||||
opts, file_paths = getopt.gnu_getopt(
|
||||
sys.argv[1:],
|
||||
"v:sd:hmpc:z",
|
||||
[
|
||||
"verbose=",
|
||||
"stdout",
|
||||
"directory=",
|
||||
"cleanup-in=",
|
||||
"help",
|
||||
"manpath",
|
||||
"progress",
|
||||
],
|
||||
)
|
||||
except getopt.GetoptError as err:
|
||||
print(err.msg) # will print something like "option -a not recognized"
|
||||
usage(script_name)
|
||||
sys.exit(2)
|
||||
parser = argparse.ArgumentParser(
|
||||
description="create_manpage_completions: Generate fish-shell completions from manpages"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-c",
|
||||
"--cleanup-in",
|
||||
type=str,
|
||||
help="Directories to clean up in",
|
||||
action="append",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-d", "--directory", type=str, help="The directory to save the completions in",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-k",
|
||||
"--keep",
|
||||
help="Whether to keep files in the target directory",
|
||||
action="store_true",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-m", "--manpath", help="Whether to use manpath", action="store_true",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-p", "--progress", help="Whether to show progress", action="store_true",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-s", "--stdout", help="Write the completions to stdout", action="store_true",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-v",
|
||||
"--verbose",
|
||||
type=int,
|
||||
choices=[0, 1, 2],
|
||||
help="The level of debug output to show",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-z", "--deroff-only", help="Whether to just deroff", action="store_true",
|
||||
)
|
||||
parser.add_argument("file_paths", type=str, nargs="*")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.verbose:
|
||||
VERBOSITY = args.verbose
|
||||
if args.stdout:
|
||||
WRITE_TO_STDOUT = True
|
||||
if args.deroff_only:
|
||||
DEROFF_ONLY = True
|
||||
if args.keep:
|
||||
KEEP_FILES = True
|
||||
if args.manpath:
|
||||
# Fetch all man1 and man8 files from the manpath or man.conf
|
||||
args.file_paths.extend(get_paths_from_man_locations())
|
||||
|
||||
# Directories within which we will clean up autogenerated completions
|
||||
# This script originally wrote completions into ~/.config/fish/completions
|
||||
# Now it writes them into a separate directory
|
||||
cleanup_directories = []
|
||||
|
||||
use_manpath, show_progress, custom_dir = False, False, False
|
||||
output_directory = ""
|
||||
for opt, value in opts:
|
||||
if opt in ("-v", "--verbose"):
|
||||
VERBOSITY = int(value)
|
||||
elif opt in ("-s", "--stdout"):
|
||||
WRITE_TO_STDOUT = True
|
||||
elif opt in ("-d", "--directory"):
|
||||
output_directory = value
|
||||
elif opt in ("-h", "--help"):
|
||||
usage(script_name)
|
||||
sys.exit(0)
|
||||
elif opt in ("-m", "--manpath"):
|
||||
use_manpath = True
|
||||
elif opt in ("-p", "--progress"):
|
||||
show_progress = True
|
||||
elif opt in ("-c", "--cleanup-in"):
|
||||
cleanup_directories.append(value)
|
||||
elif opt in ("-z",):
|
||||
DEROFF_ONLY = True
|
||||
else:
|
||||
assert False, "unhandled option"
|
||||
|
||||
if use_manpath:
|
||||
# Fetch all man1 and man8 files from the manpath or man.conf
|
||||
file_paths.extend(get_paths_from_man_locations())
|
||||
|
||||
if cleanup_directories:
|
||||
for cleanup_dir in cleanup_directories:
|
||||
if args.cleanup_in:
|
||||
for cleanup_dir in args.cleanup_in:
|
||||
cleanup_autogenerated_completions_in_directory(cleanup_dir)
|
||||
|
||||
if not file_paths:
|
||||
if not args.file_paths:
|
||||
print("No paths specified")
|
||||
sys.exit(0)
|
||||
|
||||
if not WRITE_TO_STDOUT and not output_directory:
|
||||
if not args.stdout and not args.directory:
|
||||
# Default to ~/.local/share/fish/generated_completions/
|
||||
# Create it if it doesn't exist
|
||||
xdg_data_home = os.getenv("XDG_DATA_HOME", "~/.local/share")
|
||||
output_directory = os.path.expanduser(
|
||||
args.directory = os.path.expanduser(
|
||||
xdg_data_home + "/fish/generated_completions/"
|
||||
)
|
||||
try:
|
||||
os.makedirs(output_directory)
|
||||
os.makedirs(args.directory)
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
if not WRITE_TO_STDOUT:
|
||||
if not args.stdout and not args.keep:
|
||||
# Remove old generated files
|
||||
cleanup_autogenerated_completions_in_directory(output_directory)
|
||||
cleanup_autogenerated_completions_in_directory(args.directory)
|
||||
|
||||
parse_and_output_man_pages(file_paths, output_directory, show_progress)
|
||||
parse_and_output_man_pages(args.file_paths, args.directory, args.progress)
|
||||
|
|
|
@ -141,7 +141,7 @@ maybe_t<autoloadable_file_t> autoload_file_cache_t::check(const wcstring &cmd, b
|
|||
autoload_t::autoload_t(wcstring env_var_name)
|
||||
: env_var_name_(std::move(env_var_name)), cache_(make_unique<autoload_file_cache_t>()) {}
|
||||
|
||||
autoload_t::autoload_t(autoload_t &&) = default;
|
||||
autoload_t::autoload_t(autoload_t &&) noexcept = default;
|
||||
autoload_t::~autoload_t() = default;
|
||||
|
||||
void autoload_t::invalidate_cache() {
|
||||
|
|
|
@ -137,7 +137,6 @@ int parse_help_only_cmd_opts(struct help_only_cmd_opts_t &opts, int *optind, int
|
|||
}
|
||||
default: {
|
||||
DIE("unexpected retval from wgetopt_long");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -317,20 +316,14 @@ static int builtin_breakpoint(parser_t &parser, io_streams_t &streams, wchar_t *
|
|||
int builtin_true(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
UNUSED(parser);
|
||||
UNUSED(streams);
|
||||
if (argv[1] != nullptr) {
|
||||
streams.err.append_format(BUILTIN_ERR_ARG_COUNT1, argv[0], 0, builtin_count_args(argv) - 1);
|
||||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
UNUSED(argv);
|
||||
return STATUS_CMD_OK;
|
||||
}
|
||||
|
||||
int builtin_false(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
UNUSED(parser);
|
||||
UNUSED(streams);
|
||||
if (argv[1] != nullptr) {
|
||||
streams.err.append_format(BUILTIN_ERR_ARG_COUNT1, argv[0], 0, builtin_count_args(argv) - 1);
|
||||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
UNUSED(argv);
|
||||
return STATUS_CMD_ERROR;
|
||||
}
|
||||
|
||||
|
@ -342,6 +335,8 @@ int builtin_false(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
|||
// Functions that are bound to builtin_generic are handled directly by the parser.
|
||||
// NOTE: These must be kept in sorted order!
|
||||
static const builtin_data_t builtin_datas[] = {
|
||||
{L".", &builtin_source, N_(L"Evaluate contents of file")},
|
||||
{L":", &builtin_true, N_(L"Return a successful result")},
|
||||
{L"[", &builtin_test, N_(L"Test a condition")},
|
||||
{L"and", &builtin_generic, N_(L"Execute command if previous command succeeded")},
|
||||
{L"argparse", &builtin_argparse, N_(L"Parse options in fish script")},
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue