mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 08:46:10 +08:00
Merge branch 'master' into completions-update
This commit is contained in:
commit
1792be096a
1
.gitignore
vendored
1
.gitignore
vendored
@ -67,6 +67,7 @@ messages.pot
|
||||
/toc.txt
|
||||
/version
|
||||
fish-build-version-witness.txt
|
||||
__pycache__
|
||||
|
||||
# File names that can appear below the project root that represent artifacts
|
||||
# from building and testing.
|
||||
|
@ -2,11 +2,13 @@
|
||||
|
||||
## 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
|
||||
|
||||
### Syntax changes and new commands
|
||||
|
||||
### Scripting improvements
|
||||
- Range limits in index range expansions like `$x[$start..$end]` may be omitted: `$start` and `$end` default to 1 and -1 (the last item) respectively.
|
||||
- `string sub` has a new `--end` option to specify the end index of a substring (#6765).
|
||||
|
||||
### Interactive improvements
|
||||
|
||||
@ -20,16 +22,19 @@
|
||||
|
||||
#### Completions
|
||||
- Added completions for
|
||||
- `gitk`
|
||||
- `wireshark`, `tshark`, and `dumpcap`
|
||||
- `dropdb`, `createdb`, `pg_restore`, `pg_dump` and `pg_dumpall`
|
||||
- `dhclient`
|
||||
- `tcpdump`
|
||||
- `tig`
|
||||
- `windscribe`
|
||||
|
||||
### 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)
|
||||
|
||||
---
|
||||
|
||||
|
@ -6,6 +6,7 @@ from __future__ import unicode_literals
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
from collections import deque
|
||||
import datetime
|
||||
import io
|
||||
import re
|
||||
@ -33,6 +34,8 @@ class Config(object):
|
||||
self.progress = False
|
||||
# How many after lines to print
|
||||
self.after = 5
|
||||
# How many before lines to print
|
||||
self.before = 5
|
||||
|
||||
def colors(self):
|
||||
""" Return a dictionary mapping color names to ANSI escapes """
|
||||
@ -118,13 +121,14 @@ class RunCmd(object):
|
||||
|
||||
|
||||
class TestFailure(object):
|
||||
def __init__(self, line, check, testrun, after=None):
|
||||
def __init__(self, line, check, testrun, before=None, after=None):
|
||||
self.line = line
|
||||
self.check = check
|
||||
self.testrun = testrun
|
||||
self.error_annotation_line = None
|
||||
# The output that comes *after* the failure.
|
||||
self.after = after
|
||||
self.before = before
|
||||
|
||||
def message(self):
|
||||
afterlines = self.testrun.config.after
|
||||
@ -181,7 +185,15 @@ class TestFailure(object):
|
||||
" additional output on stderr:{error_annotation_lineno}:",
|
||||
" {BOLD}{error_annotation}{RESET}",
|
||||
]
|
||||
if self.after:
|
||||
if self.before:
|
||||
fields["before_output"] = " ".join(self.before)
|
||||
fields["additional_output"] = " ".join(self.after[:afterlines])
|
||||
fmtstrs += [
|
||||
" Context:",
|
||||
" {BOLD}{before_output} {RED}{output_line}{RESET} <= does not match '{LIGHTBLUE}{input_line}{RESET}'",
|
||||
" {BOLD}{additional_output}{RESET}",
|
||||
]
|
||||
elif self.after:
|
||||
fields["additional_output"] = " ".join(self.after[:afterlines])
|
||||
fmtstrs += [" additional output:", " {BOLD}{additional_output}{RESET}"]
|
||||
fmtstrs += [" when running command:", " {subbed_command}"]
|
||||
@ -227,6 +239,8 @@ class TestRun(object):
|
||||
# Reverse our lines and checks so we can pop off the end.
|
||||
lineq = lines[::-1]
|
||||
checkq = checks[::-1]
|
||||
# We keep the last couple of lines in a deque so we can show context.
|
||||
before = deque(maxlen=self.config.before)
|
||||
while lineq and checkq:
|
||||
line = lineq[-1]
|
||||
check = checkq[-1]
|
||||
@ -234,6 +248,7 @@ class TestRun(object):
|
||||
# This line matched this checker, continue on.
|
||||
lineq.pop()
|
||||
checkq.pop()
|
||||
before.append(line.text)
|
||||
elif line.is_empty_space():
|
||||
# Skip all whitespace input lines.
|
||||
lineq.pop()
|
||||
@ -245,6 +260,7 @@ class TestRun(object):
|
||||
line,
|
||||
check,
|
||||
self,
|
||||
before=before,
|
||||
after=[
|
||||
line.text for line in lineq[::-1] if not line.is_empty_space()
|
||||
],
|
||||
@ -459,6 +475,14 @@ def get_argparse():
|
||||
action="store",
|
||||
default=5,
|
||||
)
|
||||
parser.add_argument(
|
||||
"-B",
|
||||
"--before",
|
||||
type=int,
|
||||
help="How many non-empty lines of output before a failure to print (default: 5)",
|
||||
action="store",
|
||||
default=5,
|
||||
)
|
||||
return parser
|
||||
|
||||
|
||||
@ -474,6 +498,12 @@ def main():
|
||||
config.progress = args.progress
|
||||
fields = config.colors()
|
||||
config.after = args.after
|
||||
config.before = args.before
|
||||
if config.before < 0:
|
||||
raise ValueError("Before must be at least 0")
|
||||
if config.after < 0:
|
||||
raise ValueError("After must be at least 0")
|
||||
|
||||
for path in args.file:
|
||||
fields["path"] = path
|
||||
if config.progress:
|
||||
|
@ -9,16 +9,27 @@ set(MAC_INJECT_GET_TASK_ALLOW ON CACHE BOOL "Inject get-task-allow on Mac")
|
||||
|
||||
function(CODESIGN_ON_MAC target)
|
||||
if(APPLE)
|
||||
execute_process(COMMAND sw_vers "-productVersion" OUTPUT_VARIABLE OSX_VERSION)
|
||||
if(MAC_INJECT_GET_TASK_ALLOW)
|
||||
set(ENTITLEMENTS "--entitlements" "${CMAKE_SOURCE_DIR}/osx/fish_debug.entitlements")
|
||||
else()
|
||||
set(ENTITLEMENTS "")
|
||||
endif(MAC_INJECT_GET_TASK_ALLOW)
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND codesign --force --deep --options runtime ${ENTITLEMENTS} --sign "${MAC_CODESIGN_ID}" $<TARGET_FILE:${target}>
|
||||
VERBATIM
|
||||
)
|
||||
if(OSX_VERSION VERSION_LESS "10.13.6")
|
||||
# `-options runtime` is only available in OS X from 10.13.6 and up
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND codesign --force --deep ${ENTITLEMENTS} --sign "${MAC_CODESIGN_ID}" $<TARGET_FILE:${target}>
|
||||
VERBATIM
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND codesign --force --deep --options runtime ${ENTITLEMENTS} --sign "${MAC_CODESIGN_ID}" $<TARGET_FILE:${target}>
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endfunction(CODESIGN_ON_MAC target)
|
||||
|
@ -135,7 +135,7 @@ Some OPTION_SPEC examples:
|
||||
|
||||
- ``n-name=+`` means that only ``--name`` is valid. It requires a value and can be used more than once. If the flag is seen then ``_flag_n`` and ``_flag_name`` will be set with the values associated with each occurrence of the flag.
|
||||
|
||||
- ``x`` means that only ``-x`` is valid. It is a boolean can can be used more than once. If it is seen then ``_flag_x`` will be set to the count of how many times the flag was seen.
|
||||
- ``x`` means that only ``-x`` is valid. It is a boolean that can be used more than once. If it is seen then ``_flag_x`` will be set to the count of how many times the flag was seen.
|
||||
|
||||
- ``x=``, ``x=?``, and ``x=+`` are similar to the n/name examples above but there is no long flag alternative to the short flag ``-x``.
|
||||
|
||||
|
@ -8,7 +8,7 @@ Synopsis
|
||||
|
||||
::
|
||||
|
||||
string sub [(-s | --start) START] [(-l | --length) LENGTH] [(-q | --quiet)] [STRING...]
|
||||
string sub [(-s | --start) START] [(-e | --end) END] [(-l | --length) LENGTH] [(-q | --quiet)] [STRING...]
|
||||
|
||||
.. END SYNOPSIS
|
||||
|
||||
@ -17,7 +17,7 @@ Description
|
||||
|
||||
.. BEGIN DESCRIPTION
|
||||
|
||||
``string sub`` prints a substring of each string argument. The start of the substring can be specified with ``-s`` or ``--start`` followed by a 1-based index value. Positive index values are relative to the start of the string and negative index values are relative to the end of the string. The default start value is 1. The length of the substring can be specified with ``-l`` or ``--length``. If the length is not specified, the substring continues to the end of each STRING. Exit status: 0 if at least one substring operation was performed, 1 otherwise.
|
||||
``string sub`` prints a substring of each string argument. The start/end of the substring can be specified with ``-s``/``-e`` or ``--start``/``--end`` followed by a 1-based index value. Positive index values are relative to the start of the string and negative index values are relative to the end of the string. The default start value is 1. The length of the substring can be specified with ``-l`` or ``--length``. If the length or end is not specified, the substring continues to the end of each STRING. Exit status: 0 if at least one substring operation was performed, 1 otherwise. ``--length`` is mutually exclusive with ``--end``.
|
||||
|
||||
.. END DESCRIPTION
|
||||
|
||||
@ -37,4 +37,16 @@ Examples
|
||||
>_ string sub --start=-2 abcde
|
||||
de
|
||||
|
||||
>_ string sub --end=3 abcde
|
||||
abc
|
||||
|
||||
>_ string sub -e -1 abcde
|
||||
abcd
|
||||
|
||||
>_ string sub -s 2 -e -1 abcde
|
||||
bcd
|
||||
|
||||
>_ string sub -s -3 -e -2 abcde
|
||||
c
|
||||
|
||||
.. END EXAMPLES
|
||||
|
@ -248,6 +248,26 @@ In fish versions prior to 2.5.0 it was possible to create a function named ``-``
|
||||
|
||||
abbr -a -- - 'cd -'
|
||||
|
||||
.. _faq-unicode:
|
||||
|
||||
I'm getting weird graphical glitches (a staircase effect, ghost characters,...)?
|
||||
--------------------------------------------------------------------------------
|
||||
In a terminal, the application running inside it and the terminal itself need to agree on the width of characters in order to handle cursor movement.
|
||||
|
||||
This is more important to fish than other shells because features like syntax highlighting and autosuggestions are implemented by moving the cursor.
|
||||
|
||||
Sometimes, there is disagreement on the width. There are numerous causes and fixes for this:
|
||||
|
||||
- It is possible the character is simply too new for your system to know - in this case you need to refrain from using it.
|
||||
- Fish or your terminal might not know about the character or handle it wrong - in this case fish or your terminal needs to be fixed, or you need to update to a fixed version.
|
||||
- The character has an "ambiguous" width and fish thinks that means a width of X while your terminal thinks it's Y. In this case you either need to change your terminal's configuration or set $fish_ambiguous_width to the correct value.
|
||||
- The character is an emoji and the host system only supports Unicode 8, while you are running the terminal on a system that uses Unicode >= 9. In this case set $fish_emoji_width to 2.
|
||||
|
||||
This also means that a few things are unsupportable:
|
||||
|
||||
- Non-monospace fonts - there is *no way* for fish to figure out what width a specific character has as it has no influence on the terminal's font rendering.
|
||||
- Different widths for multiple ambiguous width characters - there is no way for fish to know which width you assign to each character.
|
||||
|
||||
.. _faq-uninstalling:
|
||||
|
||||
Uninstalling fish
|
||||
|
@ -212,8 +212,8 @@ Some characters can not be written directly on the command line. For these chara
|
||||
- ``\}`` escapes the right curly bracket character
|
||||
- ``\[`` escapes the left bracket character
|
||||
- ``\]`` escapes the right bracket character
|
||||
- ``\\<`` escapes the less than character
|
||||
- ``\\>`` escapes the more than character
|
||||
- ``\<`` escapes the less than character
|
||||
- ``\>`` escapes the more than character
|
||||
- ``\^`` escapes the circumflex character
|
||||
- ``\&`` escapes the ampersand character
|
||||
- ``\|`` escapes the vertical bar character
|
||||
|
@ -374,7 +374,7 @@ Unlike other shells, fish does not split command substitutions on any whitespace
|
||||
|
||||
> printf '%s\n' (pkg-config --libs gio-2.0)
|
||||
-lgio-2.0 -lgobject-2.0 -lglib-2.0
|
||||
> printf '%s\n' (pkg-config --libs gio-2.0 | string split " ")
|
||||
> printf '%s\n' (pkg-config --libs gio-2.0 | string split -n " ")
|
||||
-lgio-2.0
|
||||
-lgobject-2.0
|
||||
-lglib-2.0
|
||||
|
@ -1,21 +1,29 @@
|
||||
|
||||
function __fish_complete_apropos
|
||||
if test (commandline -ct)
|
||||
set str (commandline -ct)
|
||||
apropos $str 2>/dev/null | sed -e "s/^\(.*$str\([^ ]*\).*\)\$/$str\2"\t"\1/"
|
||||
switch $str
|
||||
case '-**'
|
||||
|
||||
case '*'
|
||||
apropos $str 2>/dev/null | string replace -rf -- "^(.*$str([^ ]*).*)" "$str\$2\t\$1"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
complete -xc apropos -a '(__fish_complete_apropos)' -d "whatis entry"
|
||||
|
||||
complete -c apropos -s h -l help -d "Display help and exit"
|
||||
complete -f -c apropos -s '?' -l help -d "Display help and exit"
|
||||
complete -f -c apropos -l usage -d "Display short usage message"
|
||||
complete -f -c apropos -s d -l debug -d "Print debugging info"
|
||||
complete -f -c apropos -s v -l verbose -d "Verbose mode"
|
||||
complete -f -c apropos -s r -l regex -d "Keyword as regex"
|
||||
complete -f -c apropos -s r -l regex -d "Keyword as regex (default)"
|
||||
complete -f -c apropos -s w -l wildcard -d "Keyword as wildcards"
|
||||
complete -f -c apropos -s e -l exact -d "Keyword as exactly match"
|
||||
complete -x -c apropos -s m -l system -d "Search for other system"
|
||||
complete -x -c apropos -s M -l manpath -a '(echo $MANPATH)' -d "Specify man path"
|
||||
complete -x -c apropos -s C -l config-file -d "Specify a configuration file"
|
||||
complete -x -c apropos -s M -l manpath -a "(__fish_complete_directories (commandline -ct))" -d Manpath
|
||||
complete -r -c apropos -s C -l config-file -d "Specify a configuration file"
|
||||
complete -f -c apropos -s V -l version -d "Display version and exit"
|
||||
|
||||
complete -f -c apropos -s a -l and -d "Match all keywords"
|
||||
complete -f -c apropos -s l -l long -d "Do not trim output to terminal width"
|
||||
complete -x -c apropos -s s -l sections -l section -d "Search only these sections (colon-separated)"
|
||||
complete -x -c apropos -s L -l locale -a "(command -sq locale; and locale -a)" -d "Set locale"
|
||||
|
@ -26,7 +26,7 @@ for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
end
|
||||
|
||||
complete -c gcc -s o -d 'Place output in file' -r
|
||||
complete -c gcc -o aux-info -d 'Output to the given filename prototyped declarations for all functions declared and/or defined in a translation unit, including those in header files' -r
|
||||
complete -c gcc -o aux-info -d 'Output to given file prototyped declarations for all functions from a translation unit' -r
|
||||
complete -c gcc -o fabi-version -d 'Use specified version of the C++ ABI' -xa "0 1"
|
||||
complete -c gcc -l sysroot -x -a '(__fish_complete_directories)' -d 'Use dir as the logical root directory for headers and libraries'
|
||||
|
||||
@ -37,72 +37,71 @@ complete -c gcc -l sysroot -x -a '(__fish_complete_directories)' -d 'Use dir as
|
||||
|
||||
complete -c gcc -o pass-exit-codes -d 'Return the highest error returned by any phase'
|
||||
complete -c gcc -s c -d 'Compile or assemble the source files, but do not link'
|
||||
complete -c gcc -s S -d 'Stop after the stage of compilation proper; do not assemble'
|
||||
complete -c gcc -s E -d 'Stop after the preprocessing stage; do not run the compiler proper'
|
||||
complete -c gcc -s v -d 'Print (on standard error output) the commands executed to run the stages of compilation'
|
||||
complete -c gcc -o \#\#\# -d 'Like -v except the commands are not executed and all command arguments are quoted'
|
||||
complete -c gcc -o pipe -d 'Use pipes rather than temporary files for communication between the various stages of compilation'
|
||||
complete -c gcc -o combine -d 'If you are compiling multiple source files, this option tells the driver to pass all the source files to the compiler at once (for those languages for which the compiler can handle this)'
|
||||
complete -c gcc -l help -d 'Print a description of the command line options understood by gcc'
|
||||
complete -c gcc -l target-help -d 'Print a description of target specific command line options for each tool'
|
||||
complete -c gcc -l version -d 'Display the version number and copyrights of the invoked GCC'
|
||||
complete -c gcc -o ansi -d 'In C mode, support all ISO C90 programs'
|
||||
complete -c gcc -o fno-asm -d 'Do not recognize "asm", "inline" or "typeof" as a keyword, so that code can use these words as identifiers'
|
||||
complete -c gcc -o fno-builtin -d 'Don’t recognize built-in functions that do not begin with __builtin_ as prefix'
|
||||
complete -c gcc -s S -d 'Do not assemble'
|
||||
complete -c gcc -s E -d 'Stop after preprocessing'
|
||||
complete -c gcc -s v -d 'Print to stderr the commands executed to run compilation'
|
||||
complete -c gcc -o \#\#\# -d 'Like -v except commands are not executed and all command arguments are quoted'
|
||||
complete -c gcc -o pipe -d 'Use pipes not temp files for communication'
|
||||
complete -c gcc -o combine -d 'Pass all the source files to the compiler at once'
|
||||
complete -c gcc -l help -d 'Print help'
|
||||
complete -c gcc -l target-help -d 'Print a description of target specific options for each tool'
|
||||
complete -c gcc -l version -d 'Display the version number and copyrights'
|
||||
complete -c gcc -o ansi -d 'Support all ISO C90 programs'
|
||||
complete -c gcc -o fno-asm -d 'No "asm", "inline" or "typeof" as keyword, so code can use these as identifiers'
|
||||
complete -c gcc -o fno-builtin -d 'Don’t recognize built-in functions without __builtin_ prefix'
|
||||
complete -c gcc -o fno-builtin-function -d 'Don’t recognize built-in functions that do not begin with __builtin_ as prefix'
|
||||
complete -c gcc -o fhosted -d 'Assert that compilation takes place in a hosted environment'
|
||||
complete -c gcc -o ffreestanding -d 'Assert that compilation takes place in a freestanding environment'
|
||||
complete -c gcc -o fms-extensions -d 'Accept some non-standard constructs used in Microsoft header files'
|
||||
complete -c gcc -o trigraphs -d 'Support ISO C trigraphs'
|
||||
complete -c gcc -o no-integrated-cpp -d 'Performs a compilation in two passes: preprocessing and compiling'
|
||||
complete -c gcc -o traditional -d 'Formerly, these options caused GCC to attempt to emulate a prestandard C compiler'
|
||||
complete -c gcc -o traditional-cpp -d 'Formerly, these options caused GCC to attempt to emulate a prestandard C compiler'
|
||||
complete -c gcc -o fcond-mismatch -d 'Allow conditional expressions with mismatched types in the second and third arguments'
|
||||
complete -c gcc -o funsigned-char -d 'Let the type "char" be unsigned, like "unsigned char"'
|
||||
complete -c gcc -o fsigned-char -d 'Let the type "char" be signed, like "signed char"'
|
||||
complete -c gcc -o traditional -o traditional-cpp -d 'Try to imitate pre-standard C preprocessors'
|
||||
complete -c gcc -o fcond-mismatch -d 'Allow conditional expressions with mismatched types'
|
||||
complete -c gcc -o funsigned-char -d 'Let "char" be unsigned, like "unsigned char"'
|
||||
complete -c gcc -o fsigned-char -d 'Let "char" be signed, like "signed char"'
|
||||
complete -c gcc -o fsigned-bitfields -d 'Treat bitfields as signed by default'
|
||||
complete -c gcc -o funsigned-bitfields -d 'Treat bitfields as unsigned by default'
|
||||
complete -c gcc -o fno-signed-bitfields -d 'Remove fsigned-bitfields'
|
||||
complete -c gcc -o fno-unsigned-bitfields -d 'Remove funsinged-bitfields'
|
||||
complete -c gcc -o fno-access-control -d 'Turn off all access checking'
|
||||
complete -c gcc -o fcheck-new -d 'Check that the pointer returned by "operator new" is non-null before attempting to modify the storage allocated'
|
||||
complete -c gcc -o fcheck-new -d 'Check pointer returned by "operator new" is non-null before attempting to modify allocated storage'
|
||||
complete -c gcc -o fconserve-space -d 'Put uninitialized or runtime-initialized global variables into the common segment, as C does'
|
||||
complete -c gcc -o ffriend-injection -d 'Inject friend functions into the enclosing namespace, so that they are visible outside the scope of the class in which they are declared'
|
||||
complete -c gcc -o fno-const-strings -d 'Give string constants type "char *" instead of type "const char *"'
|
||||
complete -c gcc -o fno-elide-constructors -d 'The C++ standard allows an implementation to omit creating a temporary which is only used to initialize another object of the same type'
|
||||
complete -c gcc -o ffriend-injection -d 'Inject friend functions into enclosing namespace'
|
||||
complete -c gcc -o fno-const-strings -d 'Give string constants type "char *" without const'
|
||||
complete -c gcc -o fno-elide-constructors -d "Don't elide temporaries used to construct objects"
|
||||
complete -c gcc -o fno-enforce-eh-specs -d 'Don’t generate code to check for violation of exception specifications at runtime'
|
||||
complete -c gcc -o ffor-scope -d 'If -ffor-scope is specified, the scope of variables declared in a for-init-statement is limited to the for loop itself, as specified by the C++ standard'
|
||||
complete -c gcc -o fno-for-scope -d 'If -ffor-scope is specified, the scope of variables declared in a for-init-statement is limited to the for loop itself, as specified by the C++ standard'
|
||||
complete -c gcc -o fno-gnu-keywords -d 'Do not recognize "typeof" as a keyword, so that code can use this word as an identifier'
|
||||
complete -c gcc -o fno-implicit-templates -d 'Never emit code for non-inline templates which are instantiated implicitly (i'
|
||||
complete -c gcc -o ffor-scope -d 'Limit scope of variables declared in a for-init-statement to the for loop itself, as specified by the C++ standard'
|
||||
complete -c gcc -o fno-for-scope -d "Don't limit scope of vars declared in for loop to the for loop"
|
||||
complete -c gcc -o fno-gnu-keywords -d 'Do not recognize "typeof" as a keyword, so code can use it as an identifier'
|
||||
complete -c gcc -o fno-implicit-templates -d 'Never emit code for non-inline templates which are instantiated implicitly'
|
||||
complete -c gcc -o fno-implicit-inline-templates -d 'Don’t emit code for implicit instantiations of inline templates, either'
|
||||
complete -c gcc -o fno-implement-inlines -d 'To save space, do not emit out-of-line copies of inline functions controlled by #pragma implementation'
|
||||
complete -c gcc -o fms-extensions -d 'Disable pedantic warnings about constructs used in MFC, such as implicit int and getting a pointer to member function via non-standard syntax'
|
||||
complete -c gcc -o fno-implement-inlines -d 'Do not emit out-of-line copies of inline functions controlled by #pragma implementation'
|
||||
complete -c gcc -o fms-extensions -d 'Disable pedantic warnings about constructs used in MFC'
|
||||
complete -c gcc -o fno-nonansi-builtins -d 'Disable built-in declarations of functions that are not mandated by ANSI/ISO C'
|
||||
complete -c gcc -o fno-operator-names -d 'Do not treat the operator name keywords "and", "bitand", "bitor", "compl", "not", "or" and "xor" as synonyms as keywords'
|
||||
complete -c gcc -o fno-optional-diags -d 'Disable diagnostics that the standard says a compiler does not need to issue'
|
||||
complete -c gcc -o fpermissive -d 'Downgrade some diagnostics about nonconformant code from errors to warnings'
|
||||
complete -c gcc -o frepo -d 'Enable automatic template instantiation at link time'
|
||||
complete -c gcc -o fno-rtti -d 'Disable generation of information about every class with virtual functions for use by the C++ runtime type identification features (dynamic_cast and typeid)'
|
||||
complete -c gcc -o fno-rtti -d 'Disable generation of information about classes with virtual functions for use by dynamic_cast and typeid'
|
||||
complete -c gcc -o fstats -d 'Emit statistics about front-end processing at the end of the compilation'
|
||||
complete -c gcc -o fno-threadsafe-statics -d 'Do not emit the extra code to use the routines specified in the C++ ABI for thread-safe initialization of local statics'
|
||||
complete -c gcc -o fuse-cxa-atexit -d 'Register destructors for objects with static storage duration with the "__cxa_atexit" function rather than the "atexit" function'
|
||||
complete -c gcc -o fvisibility-inlines-hidden -d 'Causes all inlined methods to be marked with "__attribute__ ((visibility ("hidden")))" so that they do not appear in the export table of a DSO and do not require a PLT indirection when used within the DSO'
|
||||
complete -c gcc -o fno-weak -d 'Do not use weak symbol support, even if it is provided by the linker'
|
||||
complete -c gcc -o nostdinc++ -d 'Do not search for header files in the standard directories specific to C++, but do still search the other standard directories'
|
||||
complete -c gcc -o fvisibility-inlines-hidden -d 'Mark inlined methods with "__attribute__ ((visibility ("hidden")))"'
|
||||
complete -c gcc -o fno-weak -d 'Do not use weak symbol support'
|
||||
complete -c gcc -o nostdinc++ -d 'Do not search for header files in the standard directories specific to C++'
|
||||
complete -c gcc -o fno-default-inline -d 'Do not assume inline for functions defined inside a class scope'
|
||||
complete -c gcc -o Wabi -d '(C++ only) Warn when G++ generates code that is probably not compatible with the vendor-neutral C++ ABI'
|
||||
complete -c gcc -o Wctor-dtor-privacy -d '(C++ only) Warn when a class seems unusable because all the constructors or destructors in that class are private, and it has neither friends nor public static member functions'
|
||||
complete -c gcc -o Wnon-virtual-dtor -d '(C++ only) Warn when a class appears to be polymorphic, thereby requiring a virtual destructor, yet it declares a non-virtual one'
|
||||
complete -c gcc -o Wreorder -d '(C++ only) Warn when the order of member initializers given in the code does not match the order in which they must be executed'
|
||||
complete -c gcc -o Weffc++ -d '(C++ only) Warn about violations of the following style guidelines from Scott Meyers’ Effective C++ book: * Item 11: Define a copy constructor and an assignment operator for classes with dynamically allocated memory'
|
||||
complete -c gcc -o Wabi -d 'Warn when code is probably incompatible with the vendor-neutral C++ ABI'
|
||||
complete -c gcc -o Wctor-dtor-privacy -d 'Warn when a class has no usable con/destructors'
|
||||
complete -c gcc -o Wnon-virtual-dtor -d 'Warn when a class requires a virtual destructor but declares a non-virtual one'
|
||||
complete -c gcc -o Wreorder -d 'Warn when the order of member initializers does not match the order in which they must be executed'
|
||||
complete -c gcc -o Weffc++ -d 'Warn about violations of style guidelines from Scott Meyers’ Effective C++ book'
|
||||
complete -c gcc -o Wno-deprecated -d '(C++ only) Do not warn about usage of deprecated features'
|
||||
complete -c gcc -o Wstrict-null-sentinel -d '(C++ only) Warn also about the use of an uncasted "NULL" as sentinel'
|
||||
complete -c gcc -o Wno-non-template-friend -d '(C++ only) Disable warnings when non-templatized friend functions are declared within a template'
|
||||
complete -c gcc -o Wold-style-cast -d '(C++ only) Warn if an old-style (C-style) cast to a non-void type is used within a C++ program'
|
||||
complete -c gcc -o Wold-style-cast -d 'Warn if an C-style cast to a non-void type is used in a C++ program'
|
||||
complete -c gcc -o Woverloaded-virtual -d '(C++ only) Warn when a function declaration hides virtual functions from a base class'
|
||||
complete -c gcc -o Wno-pmf-conversions -d '(C++ only) Disable the diagnostic for converting a bound pointer to member function to a plain pointer'
|
||||
complete -c gcc -o Wsign-promo -d '(C++ only) Warn when overload resolution chooses a promotion from unsigned or enumerated type to a signed type, over a conversion to an unsigned type of the same size'
|
||||
complete -c gcc -o Wsign-promo -d '(C++ only) Warn when overload resolution promotes from unsigned or enumerated type to a signed type'
|
||||
complete -c gcc -o fconstant-string-class -d 'Use class-name as the name of the class to instantiate for each literal string specified with the syntax "@"'
|
||||
complete -c gcc -o name -d 'Use class-name as the name of the class to instantiate for each literal string specified with the syntax "@"'
|
||||
complete -c gcc -o fgnu-runtime -d 'Generate object code compatible with the standard GNU Objective-C runtime'
|
||||
@ -127,21 +126,21 @@ complete -c gcc -o line -d 'Only meaningful in line-wrapping mode'
|
||||
complete -c gcc -o fdiagnostics-show-options -d 'This option instructs the diagnostic machinery to add text to each diagnostic emitted, which indicates which command line option directly controls that diagnostic, when such an option is known to the diagnostic machinery'
|
||||
complete -c gcc -o Wno- -d 'to turn off warnings; for example, -Wno-implicit'
|
||||
complete -c gcc -o fsyntax-only -d 'Check the code for syntax errors, but don’t do anything beyond that'
|
||||
complete -c gcc -o pedantic -d 'Issue all the warnings demanded by strict ISO C and ISO C++; reject all programs that use forbidden extensions, and some other programs that do not follow ISO C and ISO C++'
|
||||
complete -c gcc -o pedantic -d 'Issue all the warnings demanded by strict ISO C and ISO C++; reject all programs that use forbidden extensions'
|
||||
complete -c gcc -o pedantic-errors -d 'Like -pedantic, except that errors are produced rather than warnings'
|
||||
complete -c gcc -s w -d 'Inhibit all warning messages'
|
||||
complete -c gcc -o Wno-import -d 'Inhibit warning messages about the use of #import'
|
||||
complete -c gcc -o Wchar-subscripts -d 'Warn if an array subscript has type "char"'
|
||||
complete -c gcc -o Wcomment -d 'Warn whenever a comment-start sequence /* appears in a /* comment, or whenever a Backslash-Newline appears in a // comment'
|
||||
complete -c gcc -o Wfatal-errors -d 'This option causes the compiler to abort compilation on the first error occurred rather than trying to keep going and printing further error messages'
|
||||
complete -c gcc -o Wcomment -d 'Warn whenever a comment-start sequence appears in a comment'
|
||||
complete -c gcc -o Wfatal-errors -d 'Abort compilation on the first error'
|
||||
complete -c gcc -o Wformat -d 'Check calls to "printf" and "scanf", etc'
|
||||
complete -c gcc -o Wformat-y2k -d 'If -Wformat is specified, also warn about "strftime" formats which may yield only a two-digit year'
|
||||
complete -c gcc -o Wno-format-extra-args -d 'If -Wformat is specified, do not warn about excess arguments to a "printf" or "scanf" format function'
|
||||
complete -c gcc -o Wno-format-zero-length -d 'If -Wformat is specified, do not warn about zero-length formats'
|
||||
complete -c gcc -o Wformat-nonliteral -d 'If -Wformat is specified, also warn if the format string is not a string literal and so cannot be checked, unless the format function takes its format arguments as a "va_list"'
|
||||
complete -c gcc -o Wformat-security -d 'If -Wformat is specified, also warn about uses of format functions that represent possible security problems'
|
||||
complete -c gcc -o Wnonnull -d 'Warn about passing a null pointer for arguments marked as requiring a non-null value by the "nonnull" function attribute'
|
||||
complete -c gcc -o Winit-self -d '(C, C++, Objective-C and Objective-C++ only) Warn about uninitialized variables which are initialized with themselves'
|
||||
complete -c gcc -o Wformat-y2k -d 'With -Wformat, also warn about "strftime" formats which may yield only a two-digit year'
|
||||
complete -c gcc -o Wno-format-extra-args -d 'With -Wformat, do not warn about excess arguments to "printf" or "scanf"'
|
||||
complete -c gcc -o Wno-format-zero-length -d 'With -Wformat, do not warn about zero-length formats'
|
||||
complete -c gcc -o Wformat-nonliteral -d 'With -Wformat, also warn if the format string is not a string literal'
|
||||
complete -c gcc -o Wformat-security -d 'With -Wformat, also warn about uses of potentially insecure format functions'
|
||||
complete -c gcc -o Wnonnull -d 'Warn about passing a null pointer for arguments marked as requiring non-null'
|
||||
complete -c gcc -o Winit-self -d 'Warn about uninitialized variables which are initialized with themselves'
|
||||
complete -c gcc -o Wimplicit-int -d 'Warn when a declaration does not specify a type'
|
||||
complete -c gcc -o Wimplicit-function-declaration -d 'Give a warning (or error) whenever a function is used before being declared'
|
||||
complete -c gcc -o Werror-implicit-function-declaration -d 'Give a warning (or error) whenever a function is used before being declared'
|
||||
@ -149,25 +148,24 @@ complete -c gcc -o Wimplicit -d 'Same as -Wimplicit-int and -Wimplicit-function-
|
||||
complete -c gcc -o Wmain -d 'Warn if the type of main is suspicious'
|
||||
complete -c gcc -o Wmissing-braces -d 'Warn if an aggregate or union initializer is not fully bracketed'
|
||||
complete -c gcc -o Wmissing-include-dirs -d '(C, C++, Objective-C and Objective-C++ only) Warn if a user-supplied include directory does not exist'
|
||||
complete -c gcc -o Wparentheses -d 'Warn if parentheses are omitted in certain contexts, such as when there is an assignment in a context where a truth value is expected, or when operators are nested whose precedence people often get confused about'
|
||||
complete -c gcc -o Wsequence-point -d 'Warn about code that may have undefined semantics because of violations of sequence point rules in the C standard'
|
||||
complete -c gcc -o Wparentheses -d 'Warn if parentheses are omitted where confusing'
|
||||
complete -c gcc -o Wsequence-point -d 'Warn about undefined semantics because of violations of sequence point rules in the C standard'
|
||||
complete -c gcc -o Wreturn-type -d 'Warn whenever a function is defined with a return-type that defaults to "int"'
|
||||
complete -c gcc -o Wswitch -d 'Warn whenever a "switch" statement has an index of enumerated type and lacks a "case" for one or more of the named codes of that enumeration'
|
||||
complete -c gcc -o Wswitch -o Wswitch-enum -d 'Warn whenever a "switch" statement lacks a "case" for a member of an enum'
|
||||
complete -c gcc -o Wswitch-default -d 'Warn whenever a "switch" statement does not have a "default" case'
|
||||
complete -c gcc -o Wswitch-enum -d 'Warn whenever a "switch" statement has an index of enumerated type and lacks a "case" for one or more of the named codes of that enumeration'
|
||||
complete -c gcc -o Wtrigraphs -d 'Warn if any trigraphs are encountered that might change the meaning of the program (trigraphs within comments are not warned about)'
|
||||
complete -c gcc -o Wunused-function -d 'Warn whenever a static function is declared but not defined or a non-inline static function is unused'
|
||||
complete -c gcc -o Wunused-label -d 'Warn whenever a label is declared but not used'
|
||||
complete -c gcc -o Wunused-parameter -d 'Warn whenever a function parameter is unused aside from its declaration'
|
||||
complete -c gcc -o Wunused-variable -d 'Warn whenever a local variable or non-constant static variable is unused aside from its declaration'
|
||||
complete -c gcc -o Wunused-function -d 'Warn about unused functions'
|
||||
complete -c gcc -o Wunused-label -d 'Warn about unused labels'
|
||||
complete -c gcc -o Wunused-parameter -d 'Warn about unused function parameters'
|
||||
complete -c gcc -o Wunused-variable -d 'Warn about unused variables'
|
||||
complete -c gcc -o Wunused-value -d 'Warn whenever a statement computes a result that is explicitly not used'
|
||||
complete -c gcc -o Wunused -d 'All the above -Wunused options combined'
|
||||
complete -c gcc -o Wuninitialized -d 'Warn if an automatic variable is used without first being initialized or if a variable may be clobbered by a "setjmp" call'
|
||||
complete -c gcc -o Wunknown-pragmas -d 'Warn when a #pragma directive is encountered which is not understood by GCC'
|
||||
complete -c gcc -o Wno-pragmas -d 'Do not warn about misuses of pragmas, such as incorrect parameters, invalid syntax, or conflicts between pragmas'
|
||||
complete -c gcc -o Wstrict-aliasing -d 'This option is only active when -fstrict-aliasing is active' -a 2
|
||||
complete -c gcc -o Wunused -d 'All the -Wunused options combined'
|
||||
complete -c gcc -o Wuninitialized -d 'Warn if an automatic variable is used without being initialized'
|
||||
complete -c gcc -o Wunknown-pragmas -d 'Warn when an unknown #pragma directive is encountered'
|
||||
complete -c gcc -o Wno-pragmas -d 'Do not warn about misuses of pragmas'
|
||||
complete -c gcc -o Wstrict-aliasing -d 'Warn about strict aliasing rules' -a 2
|
||||
complete -c gcc -o Wall -d 'All of the above -W options combined'
|
||||
complete -c gcc -o Wextra -d '(This option used to be called -W'
|
||||
complete -c gcc -o Wextra -d 'Enable warnings not enabled by -Wall'
|
||||
complete -c gcc -o Wno-div-by-zero -d 'Do not warn about compile-time integer division by zero'
|
||||
complete -c gcc -o Wsystem-headers -d 'Print warning messages for constructs found in system header files'
|
||||
complete -c gcc -o Wfloat-equal -d 'Warn if floating point values are used in equality comparisons'
|
||||
@ -175,7 +173,7 @@ complete -c gcc -o Wtraditional -d '(C only) Warn about certain constructs that
|
||||
complete -c gcc -o Wdeclaration-after-statement -d '(C only) Warn when a declaration is found after a statement in a block'
|
||||
complete -c gcc -o Wundef -d 'Warn if an undefined identifier is evaluated in an #if directive'
|
||||
complete -c gcc -o Wno-endif-labels -d 'Do not warn whenever an #else or an #endif are followed by text'
|
||||
complete -c gcc -o Wshadow -d 'Warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed'
|
||||
complete -c gcc -o Wshadow -d 'Warn if a local variable shadows another variable or if a built-in function is shadowed'
|
||||
complete -c gcc -o Wlarger-than-len -d 'Warn whenever an object of larger than len bytes is defined'
|
||||
complete -c gcc -o Wunsafe-loop-optimizations -d 'Warn if the loop cannot be optimized because the compiler could not assume anything on the bounds of the loop indices'
|
||||
complete -c gcc -o Wpointer-arith -d 'Warn about anything that depends on the "size of" a function type or of "void"'
|
||||
@ -1424,5 +1422,5 @@ complete -c gcc -o fargument-noalias -d 'Specify the possible relationships amon
|
||||
complete -c gcc -o fargument-noalias-global -d 'Specify the possible relationships among parameters and between parameters and global data'
|
||||
complete -c gcc -o fleading-underscore -d 'This option and its counterpart, -fno-leading-underscore, forcibly change the way C symbols are represented in the object file'
|
||||
complete -c gcc -o ftls-model -d '=model Alter the thread-local storage model to be used'
|
||||
complete -c gcc -o fvisibility -d '=default│internal│hidden│protected Set the default ELF image symbol visibility to the specified option---all symbols will be marked with this unless overridden within the code'
|
||||
complete -c gcc -o fvisibility -a 'default internal hidden protected' -d 'Set the default ELF image symbol visibility'
|
||||
complete -c gcc -o fopenmp -d 'Enable handling of OpenMP directives "#pragma omp" in C/C++ and "!$omp" in Fortran'
|
||||
|
@ -515,7 +515,7 @@ function __fish_git_ranges
|
||||
|
||||
set -l to $both[2]
|
||||
# Remove description from the from-ref, not the to-ref.
|
||||
for from_ref in (__fish_git_refs | string match "$from" | string replace -r \t'.*$' '')
|
||||
for from_ref in (__fish_git_refs | string match -e "$from" | string replace -r \t'.*$' '')
|
||||
for to_ref in (__fish_git_refs | string match "*$to*") # if $to is empty, this correctly matches everything
|
||||
printf "%s..%s\n" $from_ref $to_ref
|
||||
end
|
||||
|
26
share/completions/gitk.fish
Normal file
26
share/completions/gitk.fish
Normal file
@ -0,0 +1,26 @@
|
||||
# gitk - The Git repository browser
|
||||
|
||||
source $__fish_data_dir/completions/git.fish
|
||||
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -l all -d 'Show all refs (branches, tags, etc.)'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -l since=YYYY-MM-DD -x -d 'Show commits more recent that a specific date'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -l until=YYYY-MM-DD -x -d 'Show commits older than a specific date'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -l date-order -d 'Sort commits by date when possible'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -l merge -d 'On a merge conflict, show commits that modify conflicting files'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -l left-right -d 'Mark which side of a symmetric difference a commit is reachable from'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -l full-history -d 'When filtering history with -- path..., do not prune some history'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -l simplify-merges -d 'Hide needless merges from history'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -l ancestry-path -d 'Only display commits that exist directly on the ancestry chain between the given range'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -l argscmd= -d 'Command to be run to determine th revision range to show'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -l select-commit= -d 'Select the specified commit after loading the graph, instead of HEAD'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -l select-commit=HEAD -d 'Select the specified commit after loading the graph, instead of HEAD'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc) && string match -rq -- "^--select-commit=" (commandline -ct)' -xa '(printf -- "--select-commit=%s\n" (__fish_git_refs))'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -s n -l max-count -x -d 'Limit the number of commits to output'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -xa -L1 -d '-L<start>,<end>:<file> trace the evolution of a line range'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc)' -xa -L. -d '-L<funcname>:<file> trace the evolution of a function name regex'
|
||||
complete -c gitk -n 'not contains -- -- (commandline -opc) && string match -rq -- "^-L[^:]*": (commandline -ct)' -xa '(
|
||||
set -l tok (string split -m 1 -- : (commandline -ct))
|
||||
printf -- "$tok[1]:%s\n" (complete -C": $tok[2]")
|
||||
)'
|
||||
complete -c gitk -f -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_ranges)'
|
||||
complete -c gitk -F -n 'contains -- -- (commandline -opc)'
|
@ -4,58 +4,43 @@ function __fish_print_make_targets --argument-names directory file
|
||||
# text will be using the correct locale.
|
||||
set -lx LC_ALL C
|
||||
|
||||
if test -z "$directory"
|
||||
set directory '.'
|
||||
set -l makeflags -C $directory
|
||||
if test -n "$file"
|
||||
set -a makeflags -f $file
|
||||
end
|
||||
|
||||
if test -z "$file"
|
||||
for standard_file in $directory/{GNUmakefile,Makefile,makefile}
|
||||
if test -f $standard_file
|
||||
set file $standard_file
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set -l bsd_make
|
||||
if make --version 2>/dev/null | string match -q 'GNU*'
|
||||
set bsd_make 0
|
||||
else
|
||||
set bsd_make 1
|
||||
end
|
||||
|
||||
if test "$bsd_make" = 0
|
||||
# https://stackoverflow.com/a/26339924
|
||||
make -C "$directory" -f "$file" -pRrq : 2>/dev/null | awk -v RS= -F: '/^# Files/,/^# Finished Make data base/ {if ($1 !~ "^[#.]") {print $1}}' 2>/dev/null
|
||||
make $makeflags -pRrq : 2>/dev/null |
|
||||
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
|
||||
else
|
||||
make -C "$directory" -f "$file" -d g1 -rn >/dev/null 2>| awk -F, '/^#\*\*\* Input graph:/,/^$/ {if ($1 !~ "^#... ") {gsub(/# /,"",$1); print $1}}' 2>/dev/null
|
||||
# BSD make
|
||||
make $makeflags -d g1 -rn >/dev/null 2>| awk -F, '/^#\*\*\* Input graph:/,/^$/ {if ($1 !~ "^#... ") {gsub(/# /,"",$1); print $1}}' 2>/dev/null
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_complete_make_targets
|
||||
set directory (string replace -r '^make .*(-C ?|--directory(=| +))([^ ]*) .*$' '$3' -- $argv)
|
||||
if not test $status -eq 0 -a -d $directory
|
||||
set directory ''
|
||||
end
|
||||
set file (string replace -r '^make .*(-f ?|--file(=| +))([^ ]*) .*$' '$3' -- $argv)
|
||||
if not test $status -eq 0 -a -f $file
|
||||
set file ''
|
||||
end
|
||||
__fish_print_make_targets "$directory" "$file"
|
||||
set -l directory (string replace -rf '^make .*(-C ?|--directory(=| +))([^ ]*) .*$' '$3' -- $argv)
|
||||
or set directory .
|
||||
set -l file (string replace -rf '^make .*(-f ?|--file(=| +))([^ ]*) .*$' '$3' -- $argv)
|
||||
__fish_print_make_targets $directory $file
|
||||
end
|
||||
|
||||
# This completion reenables file completion on
|
||||
# assignments, so e.g. 'make foo FILES=<tab>' will receive standard
|
||||
# filename completion.
|
||||
complete -c make -n 'commandline -ct | string match -q "*=*"' -a "(__fish_complete_make_targets (commandline -c))" -d Target
|
||||
complete -f -c make -n 'commandline -ct | not string match -q "*=*"' -a "(__fish_complete_make_targets (commandline -c))" -d Target
|
||||
complete -c make -n 'commandline -ct | string match -q "*=*"' -a "(__fish_complete_make_targets (commandline -p))" -d Target
|
||||
complete -f -c make -n 'commandline -ct | not string match -q "*=*"' -a "(__fish_complete_make_targets (commandline -p))" -d Target
|
||||
complete -c make -s f -d "Use file as makefile" -r
|
||||
complete -x -c make -s C -l directory -x -a "(__fish_complete_directories (commandline -ct))" -d "Change directory"
|
||||
complete -c make -s d -d "Debug mode"
|
||||
complete -c make -s e -d "Environment before makefile"
|
||||
complete -c make -s i -d "Ignore errors"
|
||||
complete -x -c make -s I -d "Search directory for makefile" -a "(__fish_complete_directories (commandline -ct))"
|
||||
complete -x -c make -s j -d "Number of concurrent jobs"
|
||||
complete -f -c make -s j -d "Number of concurrent jobs (default: 1 per CPU)"
|
||||
complete -c make -s k -d "Continue after an error"
|
||||
complete -c make -s l -d "Start when load drops"
|
||||
complete -c make -s n -d "Do not execute commands"
|
||||
|
87
share/completions/mysql.fish
Normal file
87
share/completions/mysql.fish
Normal file
@ -0,0 +1,87 @@
|
||||
complete -c mysql -f
|
||||
|
||||
complete -c mysql -s I -s \? -l help -d 'Display a help message'
|
||||
complete -c mysql -l abort-source-on-error -d 'Abort source filename operations in case of errors'
|
||||
complete -c mysql -l auto-rehash -d 'Enable automatic rehashing'
|
||||
complete -c mysql -l auto-vertical-output -d 'Automatically switch to vertical output'
|
||||
complete -c mysql -s B -l batch -d 'Batch mode results'
|
||||
complete -c mysql -l binary-mode -d 'Binary input mode'
|
||||
complete -c mysql -l character-sets-dir -x -a "(__fish_complete_directories)" -d 'Set directory where character sets are installed'
|
||||
complete -c mysql -l column-names -d 'Write column names in results'
|
||||
complete -c mysql -s m -l column-type-info -d 'Display result set metadata'
|
||||
complete -c mysql -s c -l comments -d 'Preserve comments in statements'
|
||||
complete -c mysql -l skip-comments -d 'Discard comments in statements'
|
||||
complete -c mysql -s C -l compress -d 'Compress all information'
|
||||
complete -c mysql -l connect-timeout -x -d 'Set the number of seconds before connection timeout'
|
||||
complete -c mysql -s D -l database -x -d 'The database to use'
|
||||
complete -c mysql -s \# -l debug -d 'Write a debugging log'
|
||||
complete -c mysql -l debug-check -d 'Print some debugging information'
|
||||
complete -c mysql -s T -l debug-info -d 'Prints debugging information and memory and CPU usage'
|
||||
complete -c mysql -l default-auth -x -d 'Default authentication client-side plugin'
|
||||
complete -c mysql -l default-character-set -x -d 'Use charset_name as the default character set'
|
||||
complete -c mysql -l defaults-extra-file -F -d 'Read default options from file after global defaults'
|
||||
complete -c mysql -l defaults-file -F -d 'Read default options from file overriding global defaults'
|
||||
complete -c mysql -l defaults-group-suffix -x -d 'Read groups that have the given suffix'
|
||||
complete -c mysql -l delimiter -x -d 'Set the statement delimiter'
|
||||
complete -c mysql -l disable-named-commands -d 'Disable named commands'
|
||||
complete -c mysql -s e -l execute -x -d 'Execute the statement'
|
||||
complete -c mysql -s f -l force -d 'Continue even if an SQL error occurs'
|
||||
complete -c mysql -s h -l host -x -a "(__fish_print_hostnames)" -d 'Connect to the server on the given host'
|
||||
complete -c mysql -s H -l html -d 'Produce HTML output'
|
||||
complete -c mysql -s i -l ignore-spaces -d 'Ignore spaces after function names'
|
||||
complete -c mysql -l init-command -x -d 'SQL Command to execute when connecting to the server'
|
||||
complete -c mysql -l line-numbers -d 'Write line numbers for errors'
|
||||
complete -c mysql -l local-infile -a '0 1' -d 'Enable or disable LOCAL capability for LOAD DATA INFILE'
|
||||
complete -c mysql -l max-allowed-packet -x -d 'Set the maximum packet length'
|
||||
complete -c mysql -l max-join-size -x -d 'Set the automatic limit for rows in a join'
|
||||
complete -c mysql -s G -l named-commands -d 'Enable named mysql commands'
|
||||
complete -c mysql -l skip-named-commands -d 'Disable named commands'
|
||||
complete -c mysql -l net-buffer-length -x -d 'Set the buffer size for TCP/IP and socket communication'
|
||||
complete -c mysql -s A -l no-auto-rehash -l skip-auto-rehash -l disable-auto-rehash -d 'Disable automatic rehashing'
|
||||
complete -c mysql -s b -l no-beep -d 'Do not beep when errors occur'
|
||||
complete -c mysql -l no-defaults -d 'Do not read default options from any option file'
|
||||
complete -c mysql -s o -l one-database -d 'Ignore statements for other databases than the chosen one'
|
||||
complete -c mysql -l pager -d 'Use the given command for paging query output'
|
||||
complete -c mysql -l skip-pager -d 'Disable paging'
|
||||
complete -c mysql -s p -l password -d 'Password to use when connecting (empty for prompt)'
|
||||
complete -c mysql -s W -l pipe -d 'Connect to the server via a named pipe'
|
||||
complete -c mysql -l plugin-dir -x -a "(__fish_complete_directories)" -d 'Directory for client-side plugins'
|
||||
complete -c mysql -s P -l port -x -d 'The port to use for the connection'
|
||||
complete -c mysql -l print-defaults -d 'Print the program argument list'
|
||||
complete -c mysql -l progress-reports -d 'Get progress reports for long running commands'
|
||||
complete -c mysql -l skip-progress-reports -d 'Disable progress reports for long running commands'
|
||||
complete -c mysql -l prompt -x -d 'Set the prompt to the specified format'
|
||||
complete -c mysql -l protocol -x -a 'TCP SOCKET PIPE MEMORY' -d 'The connection protocol to use'
|
||||
complete -c mysql -s q -l quick -d 'Print each row as it is received'
|
||||
complete -c mysql -s r -l raw -d 'Disables character escaping'
|
||||
complete -c mysql -l reconnect -d 'Try to reconnect when connection gets lost'
|
||||
complete -c mysql -l skip-reconnect -l disable-reconnect -d 'Do not try to reconnect when connection gets lost'
|
||||
complete -c mysql -s U -l safe-updates -l i-am-a-dummy -d 'Allow only those statements that specify which rows to modify'
|
||||
complete -c mysql -l secure-auth -d 'Do not send passwords to the server in old format'
|
||||
complete -c mysql -l select-limit -x -d 'Set automatic limit for SELECT when using --safe-updates'
|
||||
complete -c mysql -l server-arg -x -d 'Send a parameter to the embedded server'
|
||||
complete -c mysql -l show-warnings -d 'Cause warnings to be shown'
|
||||
complete -c mysql -l sigint-ignore -d 'Ignore SIGINT signals'
|
||||
complete -c mysql -s s -l silent -d 'Silent mode'
|
||||
complete -c mysql -s N -l skip-column-names -d 'Do not write column names in results'
|
||||
complete -c mysql -s L -l skip-line-numbers -d 'Do not write line numbers for errors'
|
||||
complete -c mysql -s S -l socket -F -d 'For connections to localhost the socket file or named pipe'
|
||||
complete -c mysql -l ssl -d 'Enable SSL for connection'
|
||||
complete -c mysql -l skip-ssl -d 'Disable SSL for connection'
|
||||
complete -c mysql -l ssl-ca -F -d 'CA file in PEM format'
|
||||
complete -c mysql -l ssl-capath -x -a "(__fish_complete_directories)" -d 'CA directory'
|
||||
complete -c mysql -l ssl-cert -F -d 'X509 cert in PEM format'
|
||||
complete -c mysql -l ssl-cipher -x -d 'SSL cipher to use'
|
||||
complete -c mysql -l ssl-key -F -d 'X509 key in PEM format'
|
||||
complete -c mysql -l ssl-crl -F -d 'Certificate revocation list'
|
||||
complete -c mysql -l ssl-crlpath -x -a "(__fish_complete_directories)" -d 'Certificate revocation list path'
|
||||
complete -c mysql -l ssl-verify-server-cert -d 'Verify server\'s "Common Name"'
|
||||
complete -c mysql -s t -l table -d 'Display output in table format'
|
||||
complete -c mysql -l tee -F -d 'Append a copy of output to the given file'
|
||||
complete -c mysql -s n -l unbuffered -d 'Flush the buffer after each query'
|
||||
complete -c mysql -s u -l user -x -d 'User name to use when connecting'
|
||||
complete -c mysql -s v -l verbose -d 'Verbose mode'
|
||||
complete -c mysql -s V -l version -d 'Display version information'
|
||||
complete -c mysql -s E -l vertical -d 'Print query output rows vertically'
|
||||
complete -c mysql -s w -l wait -d 'If the connection cannot be established, wait and retry'
|
||||
complete -c mysql -s X -l xml -d 'Produce XML output'
|
@ -1,25 +1,51 @@
|
||||
# NetCat completions for fish
|
||||
# By James Stanley
|
||||
complete -c nc -d "Remote hostname" -x -a "(__fish_print_hostnames)"
|
||||
|
||||
complete -r -c nc -d "Remote hostname" -a "(__fish_print_hostnames)"
|
||||
complete -r -c nc -s c -d "Same as -e, but use /bin/sh"
|
||||
complete -r -c nc -s e -d "Program to execute after connection"
|
||||
complete -c nc -s b -d "Allow broadcasts"
|
||||
complete -r -c nc -s g -d "Source-routing hop points"
|
||||
complete -r -c nc -s G -d "Source-routing pointer"
|
||||
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 -r -c nc -s i -d "Delay interval for lines sent, ports scaned"
|
||||
complete -c nc -s k -d "Set keepalive option"
|
||||
complete -c nc -s l -d "Listen mode, acts as a server"
|
||||
complete -c nc -s n -d "Numeric-only IP addresses, no DNS"
|
||||
complete -r -c nc -s o -d "Hex dump of traffic"
|
||||
complete -r -c nc -s p -d "Local port number"
|
||||
complete -c nc -s r -d "Randomize local and remote ports"
|
||||
complete -r -c nc -s q -d "Quit after EOF on stdin and delay of secs"
|
||||
complete -r -c nc -s s -d "Local source address"
|
||||
complete -c nc -s t -d "Answer Telnet negotiation"
|
||||
complete -c nc -s u -d "UDP Mode"
|
||||
complete -c nc -s v -d "Verbose, use twice to be more verbose"
|
||||
complete -r -c nc -s w -d "Timeout for connects and final net reads"
|
||||
complete -r -c nc -s x -d "Set Type of Service"
|
||||
complete -c nc -s z -d "No I/O - used for scanning"
|
||||
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"
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Completion for builtin read
|
||||
complete -c read -s h -l help -d "Display help and exit"
|
||||
complete -c read -s p -l prompt -d "Set prompt command" -x
|
||||
complete -c read -s P -l prompt-str -d "Set prompt using provided string" -x
|
||||
complete -c read -s x -l export -d "Export variable to subprocess"
|
||||
complete -c read -s g -l global -d "Make variable scope global"
|
||||
complete -c read -s l -l local -d "Make variable scope local"
|
||||
|
@ -8,6 +8,7 @@ complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a upper
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a length
|
||||
complete -f -c string -n "test (count (commandline -opc)) -lt 2" -a sub
|
||||
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub" -s s -l start -xa "(seq 1 10)"
|
||||
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub" -s e -l end -xa "(seq 1 10)"
|
||||
complete -x -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub" -s l -l length -xa "(seq 1 10)"
|
||||
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
|
||||
|
@ -45,6 +45,13 @@ complete -f -c terraform -n '__fish_seen_subcommand_from env' -a select -d 'Sele
|
||||
complete -f -c terraform -n '__fish_seen_subcommand_from env' -a new -d 'Create a new environment'
|
||||
complete -f -c terraform -n '__fish_seen_subcommand_from env' -a delete -d 'Delete an existing environment'
|
||||
|
||||
### workspace
|
||||
complete -f -c terraform -n __fish_use_subcommand -a workspace -d 'Workspace management'
|
||||
complete -f -c terraform -n '__fish_seen_subcommand_from workspace' -a list -d 'List workspaces'
|
||||
complete -f -c terraform -n '__fish_seen_subcommand_from workspace' -a select -d 'Select an workspace'
|
||||
complete -f -c terraform -n '__fish_seen_subcommand_from workspace' -a new -d 'Create a new workspace'
|
||||
complete -f -c terraform -n '__fish_seen_subcommand_from workspace' -a delete -d 'Delete an existing workspace'
|
||||
|
||||
### fmt
|
||||
complete -f -c terraform -n __fish_use_subcommand -a fmt -d 'Rewrite config files to canonical format'
|
||||
complete -f -c terraform -n '__fish_seen_subcommand_from fmt' -o list -d 'List files whose formatting differs'
|
||||
|
28
share/completions/tig.fish
Normal file
28
share/completions/tig.fish
Normal file
@ -0,0 +1,28 @@
|
||||
# tig - text-mode interface for Git
|
||||
|
||||
not functions -q __fish_git && source $__fish_data_dir/completions/git.fish
|
||||
|
||||
set -l subcommands log show reflog blame grep refs statsh status
|
||||
complete -c tig -n "not contains -- -- (commandline -opc) && not __fish_seen_subcommand_from $subcommands" -xa 'show\t"Open diff view using the given git-show(1) options"
|
||||
blame\t"Annotate the given file, takes git-blame(1) options"
|
||||
status\t"Start up in status view"
|
||||
log\t"Start up in log view view, displaying git-log(1) output"
|
||||
reflog\t"Start up in reflog view"
|
||||
refs\t"Start up in refs view"
|
||||
stash\t"Start up in stash view"
|
||||
grep\t"Open the grep view. Supports the same options as git-grep(1)"
|
||||
'
|
||||
complete -c tig -n 'not contains -- -- (commandline -opc)' -l stdin -d 'Read git commit IDs from stdin'
|
||||
complete -c tig -n 'not contains -- -- (commandline -opc)' -l pretty=raw -d 'Read git log output from stdin'
|
||||
complete -c tig -n 'not contains -- -- (commandline -opc)' -o C. -d 'Run as if Tig was started in .'
|
||||
complete -c tig -n 'not contains -- -- (commandline -opc)' -s v -l version -d 'Show version and exit'
|
||||
complete -c tig -n 'not contains -- -- (commandline -opc)' -s h -l help -d 'Show help message and exit'
|
||||
|
||||
complete -c tig -n 'not contains -- -- (commandline -opc) && __fish_seen_subcommand_from show' -xa '(set -l t (commandline -ct); complete -C"git show $t")'
|
||||
complete -c tig -n 'not contains -- -- (commandline -opc) && __fish_seen_subcommand_from blame' -xa '(set -l t (commandline -ct); complete -C"git blame $t")'
|
||||
complete -c tig -n 'not contains -- -- (commandline -opc) && __fish_seen_subcommand_from log' -xa '(set -l t (commandline -ct); complete -C"git log $t")'
|
||||
complete -c tig -n 'not contains -- -- (commandline -opc) && __fish_seen_subcommand_from grep' -xa '(set -l t (commandline -ct); complete -C"git grep $t")'
|
||||
|
||||
complete -c tig -f -n 'not contains -- -- (commandline -opc)' -a '(__fish_git_ranges)'
|
||||
complete -c tig -n 'contains -- -- (commandline -opc)' -F
|
||||
|
10
share/completions/tracepath.fish
Normal file
10
share/completions/tracepath.fish
Normal file
@ -0,0 +1,10 @@
|
||||
complete -c tracepath -x -a "(__fish_print_hostnames)"
|
||||
|
||||
complete -c tracepath -s 4 -d 'Use IPv4 only'
|
||||
complete -c tracepath -s 6 -d 'Use IPv6 only'
|
||||
complete -c tracepath -s n -d 'Print IP addresses numerically'
|
||||
complete -c tracepath -s b -d 'Print host names and IP addresses'
|
||||
complete -c tracepath -s l -x -d 'Sets the initial packet length'
|
||||
complete -c tracepath -s m -x -d 'Set maximum hops'
|
||||
complete -c tracepath -s p -x -d 'Sets the initial destination port'
|
||||
complete -c tracepath -s V -d 'Print version and exit'
|
36
share/completions/traceroute.fish
Normal file
36
share/completions/traceroute.fish
Normal file
@ -0,0 +1,36 @@
|
||||
complete -c traceroute -x -a "(__fish_print_hostnames)"
|
||||
|
||||
complete -c traceroute -l help -d 'Print help info and exit'
|
||||
complete -c traceroute -s 4 -d 'Force IPv4 tracerouting'
|
||||
complete -c traceroute -s 6 -d 'Force IPv6 tracerouting'
|
||||
complete -c traceroute -s I -l icmp -d 'Use ICMP ECHO for probes'
|
||||
complete -c traceroute -s T -l tcp -d 'Use TCP SYN for probes'
|
||||
complete -c traceroute -s d -l debug -d 'Enable socket level debugging'
|
||||
complete -c traceroute -s F -l dont-fragment -d 'Do not fragment probe packets'
|
||||
complete -c traceroute -s f -l first -x -d 'Specifies with what TTL to start'
|
||||
complete -c traceroute -s g -l gateway -x -d 'Route the packet through the specified gateway'
|
||||
complete -c traceroute -s i -l interface -x -a "(__fish_print_interfaces)" -d 'Specify network interface'
|
||||
complete -c traceroute -s m -l max-hops -x -d 'Maximum number of hops'
|
||||
complete -c traceroute -s N -l sim-queries -x -d 'Number of probe packets sent out simultaneously'
|
||||
complete -c traceroute -s n -d 'Do not map IP addresses to host names'
|
||||
complete -c traceroute -s p -l port -x -d 'Destination port'
|
||||
complete -c traceroute -s t -l tos -x -d 'Set Type of Service or Traffic Control value'
|
||||
complete -c traceroute -s l -l flowlabel -x -d 'Use specified flow_label for IPv6'
|
||||
complete -c traceroute -s w -l wait -x -d 'How long to wait for a response'
|
||||
complete -c traceroute -s q -l queries -x -d 'Number of probe packets per hop'
|
||||
complete -c traceroute -s r -d 'Bypass the normal routing tables'
|
||||
complete -c traceroute -s s -l source -x -d 'Chooses an alternative source address'
|
||||
complete -c traceroute -s z -l sendwait -x -d 'Minimal time interval between probes'
|
||||
complete -c traceroute -s e -l extensions -d 'Show ICMP extensions'
|
||||
complete -c traceroute -s A -l as-path-lookups -d 'Perform AS path lookups'
|
||||
complete -c traceroute -s V -l version -d 'Print the version and exit'
|
||||
complete -c traceroute -l sport -x -d 'Chooses the source port'
|
||||
complete -c traceroute -l fwmark -x -d 'Set the firewall mark for outgoing packets'
|
||||
complete -c traceroute -s M -l module -x -a "default icmp tcp tcpconn udp udplite dccp raw" -d 'Use specified method for traceroute'
|
||||
complete -c traceroute -s O -l options -x -d 'Specifies some method-specific options'
|
||||
complete -c traceroute -s U -l udp -d 'Use UDP to particular destination port'
|
||||
complete -c traceroute -o UL -d 'Use UDPLITE for tracerouting'
|
||||
complete -c traceroute -s D -l dccp -d 'Use DCCP requests for probes'
|
||||
complete -c traceroute -s P -l protocol -x -d 'Use raw packet of specified protocol for tracerouting'
|
||||
complete -c traceroute -l mtu -d 'Discover MTU along the path'
|
||||
complete -c traceroute -l back -d 'Print the number of backward hops'
|
@ -246,9 +246,7 @@ __fish_reconstruct_path
|
||||
function __fish_expand_pid_args
|
||||
for arg in $argv
|
||||
if string match -qr '^%\d+$' -- $arg
|
||||
# set newargv $newargv (jobs -p $arg)
|
||||
jobs -p $arg
|
||||
if not test $status -eq 0
|
||||
if not jobs -p $arg
|
||||
return 1
|
||||
end
|
||||
else
|
||||
|
@ -1,3 +1,3 @@
|
||||
function __fish_complete_external_command
|
||||
command find $PATH/ -maxdepth 1 -perm -u+x 2>&- | string match -r '[^/]*$'
|
||||
complete -C "$argv[1]"
|
||||
end
|
||||
|
@ -49,7 +49,7 @@ function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowin
|
||||
end
|
||||
|
||||
if test $allow_functions_and_builtins = false && test (count $subcommand) -eq 1
|
||||
__fish_complete_external_command
|
||||
__fish_complete_external_command "$subcommand"
|
||||
else
|
||||
printf "%s\n" (complete -C "$subcommand")
|
||||
end
|
||||
|
@ -120,15 +120,13 @@ function __fish_config_interactive -d "Initializations that should be performed
|
||||
# Print a greeting.
|
||||
# fish_greeting can be a function (preferred) or a variable.
|
||||
#
|
||||
if status --is-interactive
|
||||
if functions -q fish_greeting
|
||||
fish_greeting
|
||||
else
|
||||
# The greeting used to be skipped when fish_greeting was empty (not just undefined)
|
||||
# Keep it that way to not print superfluous newlines on old configuration
|
||||
test -n "$fish_greeting"
|
||||
and echo $fish_greeting
|
||||
end
|
||||
if functions -q fish_greeting
|
||||
fish_greeting
|
||||
else
|
||||
# The greeting used to be skipped when fish_greeting was empty (not just undefined)
|
||||
# Keep it that way to not print superfluous newlines on old configuration
|
||||
test -n "$fish_greeting"
|
||||
and echo $fish_greeting
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -1,6 +1,6 @@
|
||||
function help --description 'Show help for the fish shell'
|
||||
set -l options h/help
|
||||
argparse -n help --max-args=1 $options -- $argv
|
||||
argparse -n help $options -- $argv
|
||||
or return
|
||||
|
||||
if set -q _flag_help
|
||||
@ -9,6 +9,15 @@ function help --description 'Show help for the fish shell'
|
||||
end
|
||||
|
||||
set -l fish_help_item $argv[1]
|
||||
if test (count $argv) -gt 1
|
||||
if string match -q string $argv[1]
|
||||
set fish_help_item (string join '-' $argv[1] $argv[2])
|
||||
else
|
||||
echo "help: Expected at most 1 args, got 2"
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
set -l help_topics syntax completion editor job-control todo bugs history killring help
|
||||
set -a help_topics color prompt title variables builtin-overview changes expand
|
||||
set -a help_topics expand-variable expand-home expand-brace expand-wildcard
|
||||
@ -76,7 +85,8 @@ function help --description 'Show help for the fish shell'
|
||||
#
|
||||
# We use this instead of xdg-open because that's useless without a backend
|
||||
# like wsl-open which we'll check in a minute.
|
||||
if not type -q cygstart
|
||||
if test -f /proc/version
|
||||
and string match -riq 'Microsoft|WSL' </proc/version
|
||||
and set -l cmd (command -s cmd.exe /mnt/c/Windows/System32/cmd.exe)
|
||||
# Use the first of these.
|
||||
set fish_browser $cmd[1]
|
||||
|
@ -996,9 +996,8 @@ def get_paths_from_man_locations():
|
||||
|
||||
def usage(script_name):
|
||||
print(
|
||||
"Usage: {0} [-v, --verbose] [-s, --stdout] [-d, --directory] [-p, --progress] files...".format(
|
||||
script_name
|
||||
)
|
||||
"Usage: {0} [-v, --verbose] [-s, --stdout] [-d, --directory] [-p, --progress]"
|
||||
" [-c, --cleanup-in] [-z] files...".format(script_name)
|
||||
)
|
||||
print(
|
||||
"""Command options are:
|
||||
@ -1008,6 +1007,8 @@ def usage(script_name):
|
||||
-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.
|
||||
"""
|
||||
)
|
||||
|
||||
|
@ -75,6 +75,31 @@ function fish_prompt
|
||||
# Date
|
||||
_nim_prompt_wrapper $retc '' (date +%X)
|
||||
|
||||
# Vi-mode
|
||||
# The default mode prompt would be prefixed, which ruins our alignment.
|
||||
function fish_mode_prompt
|
||||
end
|
||||
if test "$fish_key_bindings" = fish_vi_key_bindings
|
||||
or test "$fish_key_bindings" = fish_hybrid_key_bindings
|
||||
set -l mode
|
||||
switch $fish_bind_mode
|
||||
case default
|
||||
set mode (set_color --bold red)N
|
||||
case insert
|
||||
set mode (set_color --bold green)I
|
||||
case replace_one
|
||||
set mode (set_color --bold green)R
|
||||
echo '[R]'
|
||||
case replace
|
||||
set mode (set_color --bold cyan)R
|
||||
case visual
|
||||
set mode (set_color --bold magenta)V
|
||||
end
|
||||
set mode $mode(set_color normal)
|
||||
_nim_prompt_wrapper $retc '' $mode
|
||||
end
|
||||
|
||||
|
||||
# Virtual Environment
|
||||
set -q VIRTUAL_ENV_DISABLE_PROMPT
|
||||
or set -g VIRTUAL_ENV_DISABLE_PROMPT true
|
||||
|
@ -209,7 +209,9 @@ int builtin_jobs(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
|
||||
builtin_jobs_print(j, mode, false, streams);
|
||||
found = true;
|
||||
} else {
|
||||
streams.err.append_format(_(L"%ls: No suitable job: %ls\n"), cmd, argv[i]);
|
||||
if (mode != JOBS_PRINT_NOTHING) {
|
||||
streams.err.append_format(_(L"%ls: No suitable job: %ls\n"), cmd, argv[i]);
|
||||
}
|
||||
return STATUS_CMD_ERROR;
|
||||
}
|
||||
}
|
||||
|
@ -151,6 +151,7 @@ typedef struct { //!OCLINT(too many fields)
|
||||
bool regex_valid = false;
|
||||
bool right_valid = false;
|
||||
bool start_valid = false;
|
||||
bool end_valid = false;
|
||||
bool style_valid = false;
|
||||
bool no_empty_valid = false;
|
||||
bool no_trim_newlines_valid = false;
|
||||
@ -174,8 +175,9 @@ typedef struct { //!OCLINT(too many fields)
|
||||
long length = 0;
|
||||
long max = 0;
|
||||
long start = 0;
|
||||
long end = 0;
|
||||
|
||||
const wchar_t *chars_to_trim = L" \f\n\r\t";
|
||||
const wchar_t *chars_to_trim = L" \f\n\r\t\v";
|
||||
const wchar_t *arg1 = nullptr;
|
||||
const wchar_t *arg2 = nullptr;
|
||||
|
||||
@ -242,7 +244,17 @@ static int handle_flag_c(wchar_t **argv, parser_t &parser, io_streams_t &streams
|
||||
|
||||
static int handle_flag_e(wchar_t **argv, parser_t &parser, io_streams_t &streams,
|
||||
const wgetopter_t &w, options_t *opts) {
|
||||
if (opts->entire_valid) {
|
||||
if (opts->end_valid) {
|
||||
opts->end = fish_wcstol(w.woptarg);
|
||||
if (opts->end == 0 || opts->end == LONG_MIN || errno == ERANGE) {
|
||||
string_error(streams, _(L"%ls: Invalid end value '%ls'\n"), argv[0], w.woptarg);
|
||||
return STATUS_INVALID_ARGS;
|
||||
} else if (errno) {
|
||||
string_error(streams, BUILTIN_ERR_NOT_NUMBER, argv[0], w.woptarg);
|
||||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
return STATUS_CMD_OK;
|
||||
} else if (opts->entire_valid) {
|
||||
opts->entire = true;
|
||||
return STATUS_CMD_OK;
|
||||
}
|
||||
@ -408,6 +420,7 @@ static wcstring construct_short_opts(options_t *opts) { //!OCLINT(high npath co
|
||||
if (opts->regex_valid) short_opts.append(L"r");
|
||||
if (opts->right_valid) short_opts.append(L"r");
|
||||
if (opts->start_valid) short_opts.append(L"s:");
|
||||
if (opts->end_valid) short_opts.append(L"e:");
|
||||
if (opts->no_empty_valid) short_opts.append(L"n");
|
||||
if (opts->no_trim_newlines_valid) short_opts.append(L"N");
|
||||
return short_opts;
|
||||
@ -420,6 +433,7 @@ static const struct woption long_options[] = {{L"all", no_argument, nullptr, 'a'
|
||||
{L"chars", required_argument, nullptr, 'c'},
|
||||
{L"count", required_argument, nullptr, 'n'},
|
||||
{L"entire", no_argument, nullptr, 'e'},
|
||||
{L"end", required_argument, nullptr, 'e'},
|
||||
{L"filter", no_argument, nullptr, 'f'},
|
||||
{L"ignore-case", no_argument, nullptr, 'i'},
|
||||
{L"index", no_argument, nullptr, 'n'},
|
||||
@ -1201,21 +1215,31 @@ static int string_repeat(parser_t &parser, io_streams_t &streams, int argc, wcha
|
||||
}
|
||||
|
||||
static int string_sub(parser_t &parser, io_streams_t &streams, int argc, wchar_t **argv) {
|
||||
wchar_t *cmd = argv[0];
|
||||
|
||||
options_t opts;
|
||||
opts.length_valid = true;
|
||||
opts.quiet_valid = true;
|
||||
opts.start_valid = true;
|
||||
opts.end_valid = true;
|
||||
opts.length = -1;
|
||||
int optind;
|
||||
int retval = parse_opts(&opts, &optind, 0, argc, argv, parser, streams);
|
||||
if (retval != STATUS_CMD_OK) return retval;
|
||||
|
||||
if (opts.length != -1 && opts.end != 0) {
|
||||
streams.err.append_format(BUILTIN_ERR_COMBO2, cmd,
|
||||
_(L"--end and --length are mutually exclusive"));
|
||||
return STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
int nsub = 0;
|
||||
arg_iterator_t aiter(argv, optind, streams);
|
||||
while (const wcstring *s = aiter.nextstr()) {
|
||||
using size_type = wcstring::size_type;
|
||||
size_type pos = 0;
|
||||
size_type count = wcstring::npos;
|
||||
|
||||
if (opts.start > 0) {
|
||||
pos = static_cast<size_type>(opts.start - 1);
|
||||
} else if (opts.start < 0) {
|
||||
@ -1223,12 +1247,23 @@ static int string_sub(parser_t &parser, io_streams_t &streams, int argc, wchar_t
|
||||
size_type n = static_cast<size_type>(-opts.start);
|
||||
pos = n > s->length() ? 0 : s->length() - n;
|
||||
}
|
||||
|
||||
if (pos > s->length()) {
|
||||
pos = s->length();
|
||||
}
|
||||
|
||||
if (opts.length >= 0) {
|
||||
count = static_cast<size_type>(opts.length);
|
||||
} else if (opts.end != 0) {
|
||||
size_type n;
|
||||
if (opts.end > 0) {
|
||||
n = static_cast<size_type>(opts.end);
|
||||
} else {
|
||||
assert(opts.end != LONG_MIN); // checked above
|
||||
n = static_cast<size_type>(-opts.end);
|
||||
n = n > s->length() ? 0 : s->length() - n;
|
||||
}
|
||||
count = n < pos ? 0 : n - pos;
|
||||
}
|
||||
|
||||
// Note that std::string permits count to extend past end of string.
|
||||
|
@ -670,7 +670,8 @@ static bool parse_number(const wcstring &arg, number_t *number, wcstring_list_t
|
||||
// Break the floating point value into base and delta. Ensure that base is <= the floating
|
||||
// point value.
|
||||
//
|
||||
// Note that a non-finite number like infinity or NaN doesn't work for us, so we checked above.
|
||||
// Note that a non-finite number like infinity or NaN doesn't work for us, so we checked
|
||||
// above.
|
||||
double intpart = std::floor(floating);
|
||||
double delta = floating - intpart;
|
||||
*number = number_t{static_cast<long long>(intpart), delta};
|
||||
|
@ -1453,16 +1453,16 @@ static bool unescape_string_internal(const wchar_t *const input, const size_t in
|
||||
switch (c) {
|
||||
case L'\\': {
|
||||
if (!ignore_backslashes) {
|
||||
// Backslashes (escapes) are complicated and may result in errors, or appending
|
||||
// INTERNAL_SEPARATORs, so we have to handle them specially.
|
||||
auto escape_chars = read_unquoted_escape(input + input_position, &result,
|
||||
allow_incomplete, unescape_special);
|
||||
// Backslashes (escapes) are complicated and may result in errors, or
|
||||
// appending INTERNAL_SEPARATORs, so we have to handle them specially.
|
||||
auto escape_chars = read_unquoted_escape(
|
||||
input + input_position, &result, allow_incomplete, unescape_special);
|
||||
if (!escape_chars) {
|
||||
// A none() return indicates an error.
|
||||
errored = true;
|
||||
} else {
|
||||
// Skip over the characters we read, minus one because the outer loop will
|
||||
// increment it.
|
||||
// Skip over the characters we read, minus one because the outer loop
|
||||
// will increment it.
|
||||
assert(*escape_chars > 0);
|
||||
input_position += *escape_chars - 1;
|
||||
}
|
||||
|
@ -119,9 +119,9 @@ enum escape_string_style_t {
|
||||
|
||||
// Flags for unescape_string functions.
|
||||
enum {
|
||||
UNESCAPE_DEFAULT = 0, // default behavior
|
||||
UNESCAPE_SPECIAL = 1 << 0, // escape special fish syntax characters like the semicolon
|
||||
UNESCAPE_INCOMPLETE = 1 << 1, // allow incomplete escape sequences
|
||||
UNESCAPE_DEFAULT = 0, // default behavior
|
||||
UNESCAPE_SPECIAL = 1 << 0, // escape special fish syntax characters like the semicolon
|
||||
UNESCAPE_INCOMPLETE = 1 << 1, // allow incomplete escape sequences
|
||||
UNESCAPE_NO_BACKSLASHES = 1 << 2, // don't handle backslash escapes
|
||||
};
|
||||
typedef unsigned int unescape_flags_t;
|
||||
|
@ -207,20 +207,19 @@ void prettifier_t::prettify_node(const parse_node_tree_t &tree, node_offset_t no
|
||||
if (dump_parse_tree) dump_node(node_indent, node, source);
|
||||
|
||||
// Prepend any escaped newline, but only for certain cases.
|
||||
// We allow it to split arguments (including at the end - this is like trailing commas in lists, makes for better diffs),
|
||||
// to separate pipelines (but it has to be *before* the pipe, so the pipe symbol is the first thing on the new line after the indent)
|
||||
// and to separate &&/|| job lists (`and` and `or` are handled separately below, as they *allow* semicolons)
|
||||
// We allow it to split arguments (including at the end - this is like trailing commas in
|
||||
// lists, makes for better diffs), to separate pipelines (but it has to be *before* the
|
||||
// pipe, so the pipe symbol is the first thing on the new line after the indent) and to
|
||||
// separate &&/|| job lists (`and` and `or` are handled separately below, as they *allow*
|
||||
// semicolons)
|
||||
// TODO: Handle
|
||||
// foo | \
|
||||
// bar
|
||||
// so it just removes the escape - pipes don't need it. This was changed in some fish version, figure out which it was and if
|
||||
// it is worth supporting.
|
||||
if (prev_node_type == symbol_arguments_or_redirections_list
|
||||
|| prev_node_type == symbol_argument_list
|
||||
|| node_type == parse_token_type_andand
|
||||
|| node_type == parse_token_type_pipe
|
||||
|| node_type == parse_token_type_end
|
||||
) {
|
||||
// so it just removes the escape - pipes don't need it. This was changed in some fish
|
||||
// version, figure out which it was and if it is worth supporting.
|
||||
if (prev_node_type == symbol_arguments_or_redirections_list ||
|
||||
prev_node_type == symbol_argument_list || node_type == parse_token_type_andand ||
|
||||
node_type == parse_token_type_pipe || node_type == parse_token_type_end) {
|
||||
maybe_prepend_escaped_newline(node);
|
||||
}
|
||||
|
||||
@ -282,7 +281,9 @@ void prettifier_t::prettify_node(const parse_node_tree_t &tree, node_offset_t no
|
||||
// This can be extended to other characters, but giving the precise list is tough,
|
||||
// can change over time (see "^", "%" and "?", in some cases "{}") and it just makes
|
||||
// people feel more at ease.
|
||||
auto goodchars = [](wchar_t ch) { return fish_iswalnum(ch) || ch == L'_' || ch == L'-' || ch == L'/'; };
|
||||
auto goodchars = [](wchar_t ch) {
|
||||
return fish_iswalnum(ch) || ch == L'_' || ch == L'-' || ch == L'/';
|
||||
};
|
||||
if (std::find_if_not(unescaped.begin(), unescaped.end(), goodchars) ==
|
||||
unescaped.end() &&
|
||||
!unescaped.empty()) {
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iterator> // for std::begin/end
|
||||
#include <iterator> // for std::begin/end
|
||||
|
||||
static void become_foreground_then_print_stderr() {
|
||||
if (tcsetpgrp(STDOUT_FILENO, getpgrp()) < 0) {
|
||||
|
@ -3228,11 +3228,11 @@ static void test_autosuggest_suggest_special() {
|
||||
__LINE__);
|
||||
|
||||
// Don't crash on ~ (issue #2696). Note this is cwd dependent.
|
||||
if (system("mkdir -p '~hahaha/path1/path2/'")) err(L"mkdir failed");
|
||||
perform_one_autosuggestion_cd_test(L"cd ~haha", L"ha/path1/path2/", vars, __LINE__);
|
||||
perform_one_autosuggestion_cd_test(L"cd ~hahaha/", L"path1/path2/", vars, __LINE__);
|
||||
perform_one_completion_cd_test(L"cd ~haha", L"ha/", vars, __LINE__);
|
||||
perform_one_completion_cd_test(L"cd ~hahaha/", L"path1/", vars, __LINE__);
|
||||
if (system("mkdir -p '~absolutelynosuchuser/path1/path2/'")) err(L"mkdir failed");
|
||||
perform_one_autosuggestion_cd_test(L"cd ~absolutelynosuchus", L"er/path1/path2/", vars, __LINE__);
|
||||
perform_one_autosuggestion_cd_test(L"cd ~absolutelynosuchuser/", L"path1/path2/", vars, __LINE__);
|
||||
perform_one_completion_cd_test(L"cd ~absolutelynosuchus", L"er/", vars, __LINE__);
|
||||
perform_one_completion_cd_test(L"cd ~absolutelynosuchuser/", L"path1/", vars, __LINE__);
|
||||
|
||||
parser_t::principal_parser().vars().remove(L"HOME", ENV_LOCAL | ENV_EXPORT);
|
||||
popd();
|
||||
@ -5671,7 +5671,7 @@ Executed in 500.00 micros fish external
|
||||
// (c) carry to the next unit when the larger one exceeds 1000
|
||||
std::wstring actual = timer_snapshot_t::print_delta(t1, t2, true);
|
||||
if (actual != expected) {
|
||||
err(L"Failed to format timer snapshot\n\Expected: %ls\nActual:%ls\n", expected,
|
||||
err(L"Failed to format timer snapshot\nExpected: %ls\nActual:%ls\n", expected,
|
||||
actual.c_str());
|
||||
}
|
||||
setlocale(LC_NUMERIC, saved_locale);
|
||||
|
@ -52,7 +52,8 @@ class category_list_t {
|
||||
category_t debug{L"debug", L"Debugging aid (on by default)", true};
|
||||
|
||||
category_t warning{L"warning", L"Warnings (on by default)", true};
|
||||
category_t warning_path{L"warning-path", L"Warnings about unusable paths for config/history (on by default)", true};
|
||||
category_t warning_path{
|
||||
L"warning-path", L"Warnings about unusable paths for config/history (on by default)", true};
|
||||
|
||||
category_t config{L"config", L"Finding and reading configuration"};
|
||||
|
||||
|
@ -212,7 +212,6 @@ bool is_potential_path(const wcstring &potential_path_fragment, const wcstring_l
|
||||
const bool require_dir = static_cast<bool>(flags & PATH_REQUIRE_DIR);
|
||||
wcstring clean_potential_path_fragment;
|
||||
int has_magic = 0;
|
||||
bool result = false;
|
||||
|
||||
wcstring path_with_magic(potential_path_fragment);
|
||||
if (flags & PATH_EXPAND_TILDE) expand_tilde(path_with_magic, ctx.vars);
|
||||
@ -242,7 +241,7 @@ bool is_potential_path(const wcstring &potential_path_fragment, const wcstring_l
|
||||
}
|
||||
|
||||
if (has_magic || clean_potential_path_fragment.empty()) {
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't test the same path multiple times, which can happen if the path is absolute and the
|
||||
@ -265,7 +264,7 @@ bool is_potential_path(const wcstring &potential_path_fragment, const wcstring_l
|
||||
if (must_be_full_dir) {
|
||||
struct stat buf;
|
||||
if (0 == wstat(abs_path, &buf) && S_ISDIR(buf.st_mode)) {
|
||||
result = true;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// We do not end with a slash; it does not have to be a directory.
|
||||
@ -274,7 +273,7 @@ bool is_potential_path(const wcstring &potential_path_fragment, const wcstring_l
|
||||
const wcstring filename_fragment = wbasename(abs_path);
|
||||
if (dir_name == L"/" && filename_fragment == L"/") {
|
||||
// cd ///.... No autosuggestion.
|
||||
result = true;
|
||||
return true;
|
||||
} else if ((dir = wopendir(dir_name))) {
|
||||
cleanup_t cleanup_dir([&] { closedir(dir); });
|
||||
|
||||
@ -282,8 +281,6 @@ bool is_potential_path(const wcstring &potential_path_fragment, const wcstring_l
|
||||
const bool do_case_insensitive =
|
||||
fs_is_case_insensitive(dir_name, dirfd(dir), case_sensitivity_cache);
|
||||
|
||||
wcstring matched_file;
|
||||
|
||||
// We opened the dir_name; look for a string where the base name prefixes it Don't
|
||||
// ask for the is_dir value unless we care, because it can cause extra filesystem
|
||||
// access.
|
||||
@ -300,17 +297,14 @@ bool is_potential_path(const wcstring &potential_path_fragment, const wcstring_l
|
||||
if (string_prefixes_string(filename_fragment, ent) ||
|
||||
(do_case_insensitive &&
|
||||
string_prefixes_string_case_insensitive(filename_fragment, ent))) {
|
||||
matched_file = ent; // we matched
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
result = !matched_file.empty(); // we succeeded if we found a match
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Given a string, return whether it prefixes a path that we could cd into. Return that path in
|
||||
|
@ -273,14 +273,16 @@ static void maybe_issue_path_warning(const wcstring &which_dir, const wcstring &
|
||||
FLOG(error, custom_error_msg.c_str());
|
||||
if (path.empty()) {
|
||||
FLOGF(warning_path, _(L"Unable to locate the %ls directory."), which_dir.c_str());
|
||||
FLOGF(warning_path, _(L"Please set the %ls or HOME environment variable before starting fish."),
|
||||
FLOGF(warning_path,
|
||||
_(L"Please set the %ls or HOME environment variable before starting fish."),
|
||||
xdg_var.c_str());
|
||||
} else {
|
||||
const wchar_t *env_var = using_xdg ? xdg_var.c_str() : L"HOME";
|
||||
FLOGF(warning_path, _(L"Unable to locate %ls directory derived from $%ls: '%ls'."),
|
||||
which_dir.c_str(), env_var, path.c_str());
|
||||
FLOGF(warning_path, _(L"The error was '%s'."), std::strerror(saved_errno));
|
||||
FLOGF(warning_path, _(L"Please set $%ls to a directory where you have write access."), env_var);
|
||||
FLOGF(warning_path, _(L"Please set $%ls to a directory where you have write access."),
|
||||
env_var);
|
||||
}
|
||||
ignore_result(write(STDERR_FILENO, "\n", 1));
|
||||
}
|
||||
|
@ -321,11 +321,21 @@ void safe_report_exec_error(int err, const char *actual_cmd, const char *const *
|
||||
arg_max = sysconf(_SC_ARG_MAX);
|
||||
|
||||
if (arg_max > 0) {
|
||||
format_size_safe(sz2, static_cast<unsigned long long>(arg_max));
|
||||
debug_safe(0,
|
||||
"The total size of the argument and environment lists %s exceeds the "
|
||||
"operating system limit of %s.",
|
||||
sz1, sz2);
|
||||
if (sz >= static_cast<unsigned long long>(arg_max)) {
|
||||
format_size_safe(sz2, static_cast<unsigned long long>(arg_max));
|
||||
debug_safe(
|
||||
0,
|
||||
"The total size of the argument and environment lists %s exceeds the "
|
||||
"operating system limit of %s.",
|
||||
sz1, sz2);
|
||||
} else {
|
||||
// MAX_ARG_STRLEN, a linux thing that limits the size of one argument. It's
|
||||
// defined in binfmt.h, but we don't want to include that just to be able to
|
||||
// print the real limit.
|
||||
debug_safe(0,
|
||||
"One of your arguments exceeds the operating system's argument "
|
||||
"length limit.");
|
||||
}
|
||||
} else {
|
||||
debug_safe(0,
|
||||
"The total size of the argument and environment lists (%s) exceeds the "
|
||||
|
22
src/proc.cpp
22
src/proc.cpp
@ -248,6 +248,8 @@ static void handle_child_status(process_t *proc, proc_status_t status) {
|
||||
proc->status = status;
|
||||
if (status.stopped()) {
|
||||
proc->stopped = true;
|
||||
} else if (status.continued()) {
|
||||
proc->stopped = false;
|
||||
} else {
|
||||
proc->completed = true;
|
||||
}
|
||||
@ -396,7 +398,7 @@ static void process_mark_finished_children(parser_t &parser, bool block_ok) {
|
||||
|
||||
// We got some changes. Since we last checked we received SIGCHLD, and or HUP/INT.
|
||||
// Update the hup/int generations and reap any reapable processes.
|
||||
for (const auto &j : parser.jobs()) {
|
||||
for (auto &j : parser.jobs()) {
|
||||
for (const auto &proc : j->processes) {
|
||||
if (auto mtopic = j->reap_topic_for_process(proc.get())) {
|
||||
// Update the signal hup/int gen.
|
||||
@ -417,13 +419,23 @@ static void process_mark_finished_children(parser_t &parser, bool block_ok) {
|
||||
} else if (proc->pid > 0) {
|
||||
// Try reaping an external process.
|
||||
int status = -1;
|
||||
auto pid = waitpid(proc->pid, &status, WNOHANG | WUNTRACED);
|
||||
auto pid = waitpid(proc->pid, &status, WNOHANG | WUNTRACED | WCONTINUED);
|
||||
if (pid > 0) {
|
||||
assert(pid == proc->pid && "Unexpcted waitpid() return");
|
||||
handle_child_status(proc.get(), proc_status_t::from_waitpid(status));
|
||||
FLOGF(proc_reap_external,
|
||||
"Reaped external process '%ls' (pid %d, status %d)",
|
||||
proc->argv0(), pid, proc->status.status_value());
|
||||
if (proc->status.stopped()) {
|
||||
j->mut_flags().foreground = 0;
|
||||
}
|
||||
if (proc->status.normal_exited() || proc->status.signal_exited()) {
|
||||
FLOGF(proc_reap_external,
|
||||
"Reaped external process '%ls' (pid %d, status %d)",
|
||||
proc->argv0(), pid, proc->status.status_value());
|
||||
} else {
|
||||
assert(proc->status.stopped() || proc->status.continued());
|
||||
FLOGF(proc_reap_external,
|
||||
"External process '%ls' (pid %d, %s)",
|
||||
proc->argv0(), pid, proc->status.stopped() ? "stopped" : "continued");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
assert(0 && "Don't know how to reap this process");
|
||||
|
@ -82,6 +82,9 @@ class proc_status_t {
|
||||
/// \return if we are stopped (as in SIGSTOP).
|
||||
bool stopped() const { return WIFSTOPPED(status_); }
|
||||
|
||||
/// \return if we are continued (as in SIGCONT).
|
||||
bool continued() const { return WIFCONTINUED(status_); }
|
||||
|
||||
/// \return if we exited normally (not a signal).
|
||||
bool normal_exited() const { return WIFEXITED(status_); }
|
||||
|
||||
|
@ -299,11 +299,11 @@ if begin
|
||||
end
|
||||
#CHECK: implicit cd complete works
|
||||
if complete -C"command $dir" | grep "^$dir/.*Directory" >/dev/null
|
||||
echo "implicit cd complete incorrect after 'command'"
|
||||
echo "implicit cd complete after 'command'"
|
||||
else
|
||||
echo "no implicit cd complete after 'command'"
|
||||
end
|
||||
#CHECK: no implicit cd complete after 'command'
|
||||
#CHECK: implicit cd complete after 'command'
|
||||
popd
|
||||
if begin
|
||||
set -l PATH $PWD/test6.tmp.dir $PATH 2>/dev/null
|
||||
|
@ -268,7 +268,7 @@ set tmpdir $PWD
|
||||
cd $saved
|
||||
mkdir $tmpdir/realhome
|
||||
ln -s $tmpdir/realhome $tmpdir/linkhome
|
||||
set expandedtilde (env HOME=$tmpdir/linkhome ../test/root/bin/fish -c 'echo ~')
|
||||
set expandedtilde (env HOME=$tmpdir/linkhome $fish -c 'echo ~')
|
||||
if test $expandedtilde != $tmpdir/linkhome
|
||||
echo '~ expands to' $expandedtilde ' - expected ' $tmpdir/linkhome
|
||||
end
|
||||
|
@ -24,6 +24,21 @@ jobs -c
|
||||
#CHECK: Command
|
||||
#CHECK: sleep
|
||||
#CHECK: sleep
|
||||
jobs 1
|
||||
echo $status
|
||||
#CHECK: 1
|
||||
#CHECKERR: jobs: No suitable job: 1
|
||||
jobs foo
|
||||
echo $status
|
||||
#CHECK: 2
|
||||
#CHECKERR: jobs: 'foo' is not a valid process id
|
||||
jobs -q 1
|
||||
echo $status
|
||||
#CHECK: 1
|
||||
jobs -q foo
|
||||
echo $status
|
||||
#CHECK: 2
|
||||
#CHECKERR: jobs: 'foo' is not a valid process id
|
||||
disown foo
|
||||
#CHECKERR: disown: 'foo' is not a valid job specifier
|
||||
disown (jobs -p)
|
||||
|
@ -51,6 +51,30 @@ string sub -s 2 -l 2 abcde
|
||||
string sub --start=-2 abcde
|
||||
# CHECK: de
|
||||
|
||||
string sub --end=3 abcde
|
||||
# CHECK: abc
|
||||
|
||||
string sub --end=-4 abcde
|
||||
# CHECK: a
|
||||
|
||||
string sub --start=2 --end=-2 abcde
|
||||
# CHECK: bc
|
||||
|
||||
string sub -s -5 -e -2 abcdefgh
|
||||
# CHECK: def
|
||||
|
||||
string sub -s -100 -e -2 abcde
|
||||
# CHECK: abc
|
||||
|
||||
string sub -s -5 -e 2 abcde
|
||||
# CHECK: ab
|
||||
|
||||
string sub -s -50 -e -100 abcde
|
||||
# CHECK:
|
||||
|
||||
string sub -s 2 -e -5 abcde
|
||||
# CHECK:
|
||||
|
||||
string split . example.com
|
||||
# CHECK: example
|
||||
# CHECK: com
|
||||
|
@ -58,7 +58,7 @@ function test_file
|
||||
set -l err_status $status
|
||||
|
||||
if test $out_status -eq 0 -a $err_status -eq 0 -a $exit_status -eq 0
|
||||
say green "ok ($test_duration $unit)"
|
||||
printf '%s\n' (set_color green)ok(set_color normal)" ($test_duration $unit)"
|
||||
# clean up tmp files
|
||||
rm -f $file.tmp.{err,out,log}
|
||||
return 0
|
||||
@ -99,7 +99,7 @@ end
|
||||
|
||||
set failed (count $failed)
|
||||
if test $failed -eq 0
|
||||
say green "All tests completed successfully"
|
||||
say green "All interactive tests completed successfully"
|
||||
exit 0
|
||||
else
|
||||
set plural (test $failed -eq 1; or echo s)
|
||||
|
@ -11,9 +11,9 @@ set -x FISH_UNIT_TESTS_RUNNING 1
|
||||
# Change to directory containing this script
|
||||
cd (dirname (status -f))
|
||||
|
||||
# Test files specified on commandline, or all *.in files
|
||||
# Test files specified on commandline, or all checks.
|
||||
if set -q argv[1]
|
||||
set files_to_test $argv.in
|
||||
set files_to_test checks/$argv.fish
|
||||
else
|
||||
set files_to_test checks/*.fish
|
||||
end
|
||||
@ -44,7 +44,7 @@ if set -q littlecheck_files[1]
|
||||
end
|
||||
|
||||
if test $failed -eq 0
|
||||
say green "All tests completed successfully"
|
||||
say green "All high level script tests completed successfully"
|
||||
exit 0
|
||||
else
|
||||
set plural (test $failed -eq 1; or echo s)
|
||||
|
@ -58,6 +58,9 @@ expect_prompt
|
||||
send_line "jobs"
|
||||
expect_prompt "jobs: There are no jobs" {} unmatched { puts stderr $error_msg }
|
||||
|
||||
send_line "sleep .3 &; kill -STOP %1; kill -CONT %1; jobs | string match -r running; wait"
|
||||
expect_prompt "running" {} unmatched { puts stderr "continued job should be running: Fail" }
|
||||
|
||||
# return immediately when no jobs
|
||||
set error_msg "return immediately when no jobs: Fail"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user