Compare commits

...

34 Commits
3.7.0 ... 3.7.1

Author SHA1 Message Date
David Adam
80394ea4e3 Release 3.7.1 2024-03-19 11:40:45 +08:00
David Adam
445fba4464 CHANGELOG: work on 3.7.1 2024-03-18 22:53:13 +08:00
fortifiedhill
9cebf5c9b6 Update htop completions
Added and updated completions and updated htop link.

(cherry picked from commit 8678ad8ca0)
2024-03-18 22:34:55 +08:00
Xiretza
119d76bc0f Add completions for dmidecode
(cherry picked from commit 8271021fb6)
2024-03-18 22:34:55 +08:00
Felix Luciano Salomon
cc6df6d17f Added completion for ollama
Closes #10327

(cherry picked from commit 90b9bce174)
2024-03-18 22:34:55 +08:00
Mathis Chenuet
77e2fa343d Add completion for pstree (#10317)
* Add completion for pstree.fish

* use fish functions, much better

(cherry picked from commit 73d760560b)
2024-03-18 22:34:55 +08:00
QianChenglong
b864074288 add completion for mycli
Closes #10309

(cherry picked from commit b3c610feff)
2024-03-18 22:34:55 +08:00
Emily Grace Seville
c6f3b24dc5 feat: cobra-cli support (#10293)
* feat: cobra-cli support

* fix: cobra-cli completion

(cherry picked from commit 623f3463a5)
2024-03-18 22:34:55 +08:00
Daniel Kahn Gillmor
d24b1ef229 tab completions: avoid completing gpg --use-embedded-filename
gpg's --use-embedded-filename is a dangerous option that can cause gpg
to write arbitrary content to arbitrary files.

According to the GnuPG maintainer, this is not an option recommended
for use (https://dev.gnupg.org/T4500).  Fish shouldn't encourage users
to supply it.

I've offered https://dev.gnupg.org/T6972 to upstream to make it even
more clear that this option is a bad idea.

While removing it, we might as well also remove
--no-use-embedded-filename, since it is effectively a no-op.

(cherry picked from commit b265152fba)
2024-03-18 22:34:55 +08:00
Jason Nader
d655f40d43 completions: fix wg-quick interface completions
wg outputs space separated list

(cherry picked from commit 28d9f1878d)
2024-03-18 22:34:55 +08:00
Mark Huang
baf5102797 completions for apt and apt-get
(cherry picked from commit 65cf6ada56)
2024-03-18 22:34:55 +08:00
Ikko Eltociear Ashimine
7b595b2e2e Update iwctl.fish
colum -> column

(cherry picked from commit 1e925857f0)
2024-03-18 22:34:55 +08:00
Asuka Minato
f82e29d320 add more strace completion (#10227)
* Update strace.fish

* Update strace.fish

* upper case

(cherry picked from commit 0f97111290)
2024-03-18 22:34:55 +08:00
Damien Picard
d2e1ffc192 Completions: fix Blender completions when it prints to stderr
Some of the completions recently introduced called Blender itself to query some
arguments, and Blender sometimes prints messages to stderr. This output was not
filtered, resulting in the shell printing irrelevant messages during completion.

(cherry picked from commit 4f3e7ddef0)
2024-03-18 22:34:55 +08:00
mhmdanas
a6c00ee637 completions/xbps-query: complete package name after -X
(cherry picked from commit a67b089c89)
2024-03-18 22:34:55 +08:00
NextAlone
e2599545f2 completions/fastboot: fix flash completion
Signed-off-by: NextAlone <12210746+NextAlone@users.noreply.github.com>
(cherry picked from commit c587b2ffcc)
2024-03-18 22:34:55 +08:00
David Adam
98662ae076 CHANGELOG: work on 3.7.1 2024-03-18 22:26:49 +08:00
Mahmoud Al-Qudsi
72d372cca1 Fix unnecessary move warning 2024-03-14 17:05:58 -05:00
Mahmoud Al-Qudsi
e2df29447f Silence warning about unused variable 2024-03-14 17:04:56 -05:00
Fabian Boehm
9b9cfc207f CHANGELOG for 3.7.1 2024-03-13 18:24:01 +01:00
Mahmoud Al-Qudsi
b7b20e9fac Always source file after funced (#10318)
... even if the file hasn't changed. This addresses an oddity in the following
case:

* Shell is started,
* function `foo` is sourced from foo.fish
* foo.fish is *externally* edited and saved
* <Loaded definition of `foo` is now stale, but fish is unaware>
* `funced foo` loads `type -p foo` showing changed definition, user exits
  $EDITOR saving no changes (or with $status 0, more generally).
* Stale definition of `foo` remains

(cherry picked from commit 2c2ab0c1fa)
2024-03-13 18:16:34 +01:00
Jason Nader
fada4f2e01 completions: add ssh -D option
(cherry picked from commit fc58b9c68f)
2024-03-13 18:15:24 +01:00
Paul Gier
2655d9a3fa functions: handle hostname starting with dash
If a hostname starts with a dash `-` character, the prompt_hostname function
fails because the `string` function interprets it as an option instead
of an argument.

(cherry picked from commit 6c9c033126)
2024-03-13 18:15:24 +01:00
Jason Nader
c3aefc581f completions: update 'echo'
(cherry picked from commit 2f332f0019)
2024-03-13 18:15:24 +01:00
Fabian Boehm
36c8746870 docs/argparse: Add some more examples, something on -x
Fixes #10284

(cherry picked from commit 94d3307469)
2024-03-13 18:15:24 +01:00
Paul Ouellette
6cd1b23502 Remove share/completions/highlight.fish
Highlight ships its own completion script:
https://gitlab.com/saalen/highlight/-/blob/master/sh-completion/highlight.fish

(cherry picked from commit 2cb60bed10)
2024-03-13 18:15:24 +01:00
Peter Collingbourne
1f9226aaa4 completions/fastboot: declare -s as taking an argument, add argument completions
(cherry picked from commit 0b3e9609f1)
2024-03-13 18:15:24 +01:00
Nethum Lamahewage
6da36f4ae5 history: fix deleting last entry
(cherry picked from commit a36ff7d143)
2024-03-13 18:15:24 +01:00
zuisong
8ed052079f Add --url-query completion for curl (#10332)
Add missing completion for curl's `--url-query` option

(cherry picked from commit a1e46a94f6)
2024-03-13 18:15:24 +01:00
Fabian Boehm
95f6803241 docs/completions: Remove duplicated content
Fixes #fish-site/121
2024-02-14 21:54:02 +01:00
Johannes Altmanninger
47bb07eda3 __fish_anypager: prefer less over other pagers
This is our traditional behavior; "man" and "git" do the same.

(cherry picked from commit b83f3b0e98)

Proposing this for 3.7.1 because I think see this as regression in 3.7.0 -
a user might have installed bat for syntax highlighting only.
2024-01-21 17:31:24 +01:00
Fabian Boehm
c31e194120 Revert "wildcard: Remove useless access() call for trailing slash"
This reverts commit 6823f5e337.

Fixes #10205
2024-01-09 18:59:32 +01:00
ksyx
001f797f80 fix: crash when running ELF w/ interpreter missing
The function `stat` as defined in `include/x86_64-linux-gnu/sys/stat.h`
marks its arguments as nonnull as in below. This UB causes crash in
release builds with variable `interpreter` assumed to be nonnull. Along
with failing stat returning nonzero value, this ultimately causes
`strlen` to be called with NULL as argument.

Definition of `stat`:
```
extern int stat (const char *__restrict __file,
		 struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
```
Reproduce:
```
> # interp.c is any vaild single file C source
> gcc ./interp.c -Wl,--dynamic-linker=/bad -o interp
> echo './interp' > in.txt
> ./fish < in.txt
'./fish < in.txt' terminated by signal SIGSEGV (Address boundary error)
```

Co-authored-by: Moody Liu <mooodyhunter@outlook.com>
2024-01-09 13:23:52 +01:00
Asger Hautop Drewsen
b91723dab6 Log original exit code used when a builtin returns a negative exit code 2024-01-04 16:13:41 +01:00
33 changed files with 256 additions and 89 deletions

View File

@@ -1,3 +1,28 @@
fish 3.7.1 (released March 19, 2024)
====================================
This release of fish fixes the following problems identified in fish 3.7.0:
- Deleting the last history entry via ``history delete`` works again (:issue:`10190`).
- Wildcards (``*``) will no longer sometimes generate paths that did not exist (:issue:`10205`).
This release also contains some improvements:
- A crash when trying to run an ELF program with a missing interpreter has been fixed. This crashed in the process after fork, so did not affect the fish process that tried to start the program (:issue:`10199`).
- ``funced`` will now always ``source`` the file after it has written it, even if the contents did not change. This prevents issues if the file was otherwise modified (:issue:`10318`).
- The warning for when a builtin returns a negative exit code was improved, now mentioning the original status (:issue:`10187`).
- Added completions for
- ``cobra-cli`` (:issue:`10293`)
- ``dmidecode`` (:issue:`10368`)
- ``mycli`` (:issue:`10309`)
- ``ollama`` (:issue:`10327`)
- ``pstree`` (:issue:`10317`)
- Some improvements to documentation and completions.
--------------
fish 3.7.0 (released January 1, 2024)
=====================================

View File

@@ -32,6 +32,7 @@ The following ``argparse`` options are available. They must appear before all *O
**-x** or **--exclusive** *OPTIONS*
A comma separated list of options that are mutually exclusive. You can use this more than once to define multiple sets of mutually exclusive options.
You give either the short or long version of each option, and you still need to otherwise define the options.
**-N** or **--min-args** *NUMBER*
The minimum number of acceptable non-option arguments. The default is zero.
@@ -205,6 +206,37 @@ After parsing the arguments the ``argv`` variable is set with local scope to any
If an error occurs during argparse processing it will exit with a non-zero status and print error messages to stderr.
Examples
---------
A simple use::
argparse h/help -- $argv
or return
if set -q _flag_help
# TODO: Print help here
return 0
end
This just wants one option - ``-h`` / ``--help``. Any other option is an error. If it is given it prints help and exits.
How :doc:`fish_add_path` parses its args::
argparse -x g,U -x P,U -x a,p g/global U/universal P/path p/prepend a/append h/help m/move v/verbose n/dry-run -- $argv
There are a variety of boolean flags, all with long and short versions. A few of these cannot be used together, and that is what the ``-x`` flag is used for.
``-x g,U`` means that ``--global`` and ``--universal`` or their short equivalents conflict, and if they are used together you get an error.
In this case you only need to give the short or long flag, not the full option specification.
After this it figures out which variable it should operate on according to the ``--path`` flag::
set -l var fish_user_paths
set -q _flag_path
and set var PATH
Limitations
-----------

View File

@@ -11,48 +11,6 @@ To provide a list of possible completions for myprog, use the ``-a`` switch. If
complete -c myprog -s o -l output -a "yes no"
In the complete call above, the ``-a`` arguments apply when the option -o/--output has been given, so this offers them for::
> myprog -o<TAB>
> myprog --output=<TAB>
By default, option arguments are *optional*, so the candidates are only offered directly attached like that, so they aren't given in this case::
> myprog -o <TAB>
Usually options *require* a parameter, so you would give ``--require-parameter`` / ``-r``::
complete -c myprog -s o -l output -ra "yes no"
which offers yes/no in these cases::
> myprog -o<TAB>
> myprog --output=<TAB>
> myprog -o <TAB>
> myprog --output <TAB>
In the latter two cases, files will also be offered because file completion is enabled by default.
You would either inhibit file completion for a single option::
complete -c myprog -s o -l output --no-files -ra "yes no"
or with a specific condition::
complete -c myprog -f --condition '__fish_seen_subcommand_from somesubcommand'
or you can disable file completions globally for the command::
complete -c myprog -f
If you have disabled them globally, you can enable them just for a specific condition or option with the ``--force-files`` / ``-F`` option::
# Disable files by default
complete -c myprog -f
# but reenable them for --config-file
complete -c myprog -l config-file --force-files -r
In the complete call above, the ``-a`` arguments apply when the option -o/--output has been given, so this offers them for::
> myprog -o<TAB>

View File

@@ -36,6 +36,7 @@ complete -f -n __fish_apt_no_subcommand -c apt-get -a clean -d 'Clean local cach
complete -f -n __fish_apt_no_subcommand -c apt-get -a autoclean -d 'Clean packages no longer be downloaded'
complete -f -n __fish_apt_no_subcommand -c apt-get -a autoremove -d 'Remove automatically installed packages'
complete -c apt-get -l no-install-recommends -d 'Do not install recommended packages'
complete -c apt-get -l no-install-suggests -d 'Do not install suggested packages'
complete -c apt-get -s d -l download-only -d 'Download Only'
complete -c apt-get -s f -l fix-broken -d 'Correct broken dependencies'
complete -c apt-get -s m -l fix-missing -d 'Ignore missing packages'
@@ -43,10 +44,12 @@ complete -c apt-get -l no-download -d 'Disable downloading packages'
complete -c apt-get -s q -l quiet -d 'Quiet mode'
complete -c apt-get -s s -l simulate -l just-print -l dry-run -l recon -l no-act -d 'Perform a simulation'
complete -c apt-get -s y -l yes -l assume-yes -d 'Automatic yes to prompts'
complete -c apt-get -l assume-no -d 'Automatic no to prompts'
complete -c apt-get -s u -l show-upgraded -d 'Show upgraded packages'
complete -c apt-get -s V -l verbose-versions -d 'Show full versions for packages'
complete -c apt-get -s b -l compile -l build -d 'Compile source packages'
complete -c apt-get -l install-recommends -d 'Install recommended packages'
complete -c apt-get -l install-suggests -d 'Install suggested packages'
complete -c apt-get -l ignore-hold -d 'Ignore package Holds'
complete -c apt-get -l no-upgrade -d "Do not upgrade packages"
complete -c apt-get -l force-yes -d 'Force yes'

View File

@@ -37,7 +37,18 @@ complete -k -c apt -n "__fish_seen_subcommand_from $pkg_subcmds" -a '(__fish_pri
complete -c apt -n "__fish_seen_subcommand_from $installed_pkg_subcmds" -a '(__fish_print_apt_packages --installed | string match -re -- "(?:\\b|_)"(commandline -ct | string escape --style=regex) | head -n 250)'
complete -k -c apt -n "__fish_seen_subcommand_from $handle_file_pkg_subcmds" -a '(__fish_complete_suffix .deb)'
complete -c apt -n "__fish_seen_subcommand_from install" -l no-install-recommends
complete -c apt -n "__fish_seen_subcommand_from install" -l no-install-recommends -d 'Do not install recommended packages'
complete -c apt -n "__fish_seen_subcommand_from install" -l no-install-suggests -d 'Do not install suggested packages'
complete -c apt -n "__fish_seen_subcommand_from install" -s d -l download-only -d 'Download Only'
complete -c apt -n "__fish_seen_subcommand_from install" -s f -l fix-broken -d 'Correct broken dependencies'
complete -c apt -n "__fish_seen_subcommand_from install" -s m -l fix-missing -d 'Ignore missing packages'
complete -c apt -n "__fish_seen_subcommand_from install" -l no-download -d 'Disable downloading packages'
complete -c apt -n "__fish_seen_subcommand_from install" -s q -l quiet -d 'Quiet mode'
complete -c apt -n "__fish_seen_subcommand_from install" -s s -l simulate -l just-print -l dry-run -l recon -l no-act -d 'Perform a simulation'
complete -c apt -n "__fish_seen_subcommand_from install" -s y -l yes -l assume-yes -d 'Automatic yes to prompts'
complete -c apt -n "__fish_seen_subcommand_from install" -l assume-no -d 'Automatic no to prompts'
complete -c apt -n "__fish_seen_subcommand_from install" -l install-recommends -d 'Install recommended packages'
complete -c apt -n "__fish_seen_subcommand_from install" -l install-suggests -d 'Install suggested packages'
# This advanced flag is the safest way to upgrade packages that otherwise would have been kept back
complete -c apt -n "__fish_seen_subcommand_from upgrade" -l with-new-pkgs

View File

@@ -16,25 +16,25 @@ end
function __blender_list_scenes
blender --background (__blender_echo_input_file_name) --python-expr 'import bpy
for scene in bpy.data.scenes:
print(f"\t{scene.name}")' |
print(f"\t{scene.name}")' 2>/dev/null |
string replace -r -f '^\t' ''
end
function __blender_list_texts
blender --background (__blender_echo_input_file_name) --python-expr 'import bpy
for text in bpy.data.texts:
print(f"\t{text.name}")' |
print(f"\t{text.name}")' 2>/dev/null |
string replace -r -f '^\t' ''
end
function __blender_list_engines
blender --background --engine help | string replace -r -f '^\t' ''
blender --background --engine help 2>/dev/null | string replace -r -f '^\t' ''
end
function __blender_list_addons
blender --background --python-expr 'import addon_utils
for mod in addon_utils.modules():
print(f"\t{mod.__name__}")' |
print(f"\t{mod.__name__}")' 2>/dev/null |
string replace -r -f '^\t' ''
end

View File

@@ -0,0 +1 @@
cobra-cli completion fish | source

View File

@@ -231,3 +231,4 @@ complete -c curl -l eprt -l no-eprt -d 'for --disable-eprt'
complete -c curl -l epsv -l no-epsv -d 'for --disable-epsv'
complete -c curl -l max-redir -d 'Set maximum number of redirects'
complete -c curl -l xattr -d 'Store metadata in xattrs (like origin URL)'
complete -c curl -l url-query -d '(HTTP) Add a URL query part'

View File

@@ -0,0 +1,22 @@
function __fish_dmidecode_complete_keywords
dmidecode -s 2>&1 1>/dev/null | string match -rg '^\s+(.*)'
end
function __fish_dmidecode_complete_types
dmidecode -t 2>&1 1>/dev/null | string match -rg '^\s+(.*)'
end
complete -c dmidecode -f
complete -c dmidecode -s d -l dev-mem -r -d 'Memory device file'
complete -c dmidecode -s q -l quiet -d 'Be less verbose'
complete -c dmidecode -l no-quirks -d 'Decode everything exactly as it is'
complete -c dmidecode -s s -l string -xa '(__fish_dmidecode_complete_keywords)' -d 'Only display specified value'
complete -c dmidecode -s t -l type -xa '(__fish_dmidecode_complete_types)' -d 'Only display entries of specified type'
complete -c dmidecode -s H -l handle -x -d 'Only display specified handle'
complete -c dmidecode -s u -l dump -d 'Do not decode the entries'
complete -c dmidecode -l dump-bin -r -d 'Dump DMI data to a file'
complete -c dmidecode -l from-dump -r -d 'Read DMI data generated using --dump-bin'
complete -c dmidecode -l no-sysfs -d 'Do not attempt to read DMI data from sysfs files'
complete -c dmidecode -l oem-string -x -d 'Only display the value of the OEM string number N'
complete -c dmidecode -s h -l help -d 'Display usage information and exit'
complete -c dmidecode -s V -l version -d 'Display the version and exit'

View File

@@ -2,4 +2,3 @@ complete -c echo -s n -d "Do not output a newline"
complete -c echo -s s -d "Do not separate arguments with spaces"
complete -c echo -s E -d "Disable backslash escapes"
complete -c echo -s e -d "Enable backslash escapes"
complete -c echo -s h -l help -d "Display help and exit"

View File

@@ -1,15 +1,19 @@
set -l commands flashall getvar oem flashing reboot update erase format devices flash get_staged help stage boot fetch
function __fish_fastboot_list_partition_or_file
if __fish_seen_subcommand_from (__fish_fastboot_list_partition){_a,_b,}
__fish_complete_path
else
__fish_fastboot_list_partition
set -l tokens (commandline -opc)
# if last 2 token is flash, then list file
if test (count $tokens) -gt 2
if test $tokens[-2] = flash
__fish_complete_path
return
end
end
__fish_fastboot_list_partition
end
function __fish_fastboot_list_partition
set -l partitions boot bootloader dtbo modem odm odm_dlkm oem product pvmfw radio recovery system vbmeta vendor vendor_dlkm cache userdata system_ext
set -l partitions boot bootloader cache cust dtbo metadata misc modem odm odm_dlkm oem product pvmfw radio recovery system system_ext userdata vbmeta vendor vendor_dlkm vmbeta_system
for i in $partitions
echo $i
end
@@ -20,7 +24,7 @@ complete -c fastboot -s v -l verbose -d 'Verbose output'
complete -c fastboot -l version -d 'Display version'
complete -n "not __fish_seen_subcommand_from $commands" -c fastboot -s w -d 'Wipe userdata'
complete -n "not __fish_seen_subcommand_from $commands" -c fastboot -s s -d 'Specify a device'
complete -n "not __fish_seen_subcommand_from $commands" -c fastboot -s s -x -a "(fastboot devices)" -d 'Specify a device'
complete -n "not __fish_seen_subcommand_from $commands" -c fastboot -s S -d 'Break into sparse files no larger than SIZE'
complete -n "not __fish_seen_subcommand_from $commands" -c fastboot -l slot -d 'Use SLOT; \'all\' for both slots, \'other\' for non-current slot (default: current active slot)' -xa "all other a b"
complete -n "not __fish_seen_subcommand_from $commands" -c fastboot -l set-active -d 'Sets the active slot before rebooting' -xa "a b"
@@ -73,4 +77,3 @@ complete -n '__fish_seen_subcommand_from reboot' -c fastboot -xa 'bootloader fas
# oem
complete -n '__fish_seen_subcommand_from oem' -c fastboot -xa 'device-info lock unlock edl'

View File

@@ -1,8 +0,0 @@
complete -c highlight -s O -l out-format -d 'Output file in given format' -xa 'xterm256 latex tex rtf html xhtml ansi bbcode svg'
complete -c highlight -s t -l tab -d 'Specify tab length' -x
complete -c highlight -s i -l input -d 'Name of the input file' -r
complete -c highlight -s o -l output -d 'Name of the output file' -r
complete -c highlight -s d -l outdir -d 'Output directory' -r
complete -c highlight -s S -l syntax -d 'Set type of the source code' -xa "(highlight -p | sed -r 's/^(.*[^[:space:]])[[:space:]]+:[[:space:]]*([^[:space:]]+).*\$/\2\t\1/; /^\$/d')"
complete -c highlight -s s -l style -d 'Highlight style' -xa "(highlight --list-themes | sed '/^\$\| /d')"

View File

@@ -1,11 +1,22 @@
# htop is an interactive process viewer.
# See: http://hisham.hm/htop
# See: https://htop.dev
complete -c htop -l delay -s d -d 'Update interval' -x
complete -c htop -l no-color -s C -d 'Start htop in monochrome mode'
complete -c htop -l no-colour -d 'Start htop in monochrome mode'
complete -c htop -l filter -s F -d 'Filter processes by terms matching the commands' -x
complete -c htop -l help -s h -d 'Show help and exit'
complete -c htop -l pid -s p -d 'Show only given PIDs' -x -a '(__fish_append , (__fish_complete_pids))'
complete -c htop -l user -s u -d 'Monitor given user' -x -a '(__fish_complete_users)'
complete -c htop -l sort-key -d 'Sort column' -xa '(htop --sort-key help)'
complete -c htop -l version -s v -d 'Show version and exit'
complete -c htop -l pid -s p -d 'Show only given PIDs' -xa '(__fish_append , (__fish_complete_pids))'
complete -c htop -l sort-key -s s -d 'Sort column' -xa '(htop --sort-key help)'
complete -c htop -l user -s u -d 'Monitor given user' -xa '(__fish_complete_users)'
complete -c htop -l no-unicode -s U -d 'Do not use unicode but ASCII characters for graph meters'
complete -c htop -l no-mouse -s M -d 'Disable support of mouse control'
complete -c htop -l readonly -d 'Disable all system and process changing features'
complete -c htop -l version -s V -d 'Show version and exit'
complete -c htop -l tree -s t -d 'Show processes in tree view'
complete -c htop -l highlight-changes -s H -d 'Highlight new and old processes' -x
complete -c htop -l drop-capabilites -d 'Drop unneeded Linux capabilites (Requires libpcap support)' -xka "
off
basic
strict
"

View File

@@ -14,7 +14,7 @@ function __iwctl_filter -w iwctl
set -l results (iwctl $argv | string replace -ra '\e\[[\d;]+m' '')
# calculate column widths
set -l headers $results[3]
# We exploit the fact that all colum labels will have >2 space to the left, and inside column labels there is always only one space.
# We exploit the fact that all column labels will have >2 space to the left, and inside column labels there is always only one space.
set -l leading_ws (string match -r "^ *" -- $headers | string length)
set -l column_widths (string match -a -r '(?<= )\S.*?(?: (?=\S)|$)' -- $headers | string length)

View File

@@ -0,0 +1,8 @@
# fish completion for mycli -*- shell-script -*-
function __fish_mycli_dsn
mycli --list-dsn
end
complete -c mycli -s d -l dsn -x -d 'Use DSN configured into the [alias_dsn]' -a '(__fish_mycli_dsn)'
complete -c mycli -a '(__fish_mycli_dsn)'

View File

@@ -0,0 +1,20 @@
function __fish_ollama_list
ollama list 2>/dev/null | tail -n +2 | string replace --regex "\s.*" ""
end
complete -c ollama -a serve -d "Start ollama"
complete -c ollama -a create -d "Create a model from a Modelfile"
complete -c ollama -a show -d "Show information for a model"
complete -c ollama -a run -d "Run a model"
complete -c ollama -a pull -d "Pull a model from a registry"
complete -c ollama -a push -d "Push a model to a registry"
complete -c ollama -a list -d "List models"
complete -c ollama -a cp -d "Copy a model"
complete -c ollama -a rm -d "Remove a model"
complete -c ollama -a help -d "Help about any command"
complete -c ollama -s h -l help -d "help for ollama"
complete -c ollama -s v -l version -d "Show version information"
complete -c ollama -f -a "(__fish_ollama_list)" --condition '__fish_seen_subcommand_from show'
complete -c ollama -f -a "(__fish_ollama_list)" --condition '__fish_seen_subcommand_from run'
complete -c ollama -f -a "(__fish_ollama_list)" --condition '__fish_seen_subcommand_from cp'
complete -c ollama -f -a "(__fish_ollama_list)" --condition '__fish_seen_subcommand_from rm'

View File

@@ -0,0 +1,22 @@
complete -c pstree -f
complete -c pstree -s a -l arguments -d 'Show command line arguments'
complete -c pstree -s A -l ascii -d 'use ASCII line drawing characters'
complete -c pstree -s c -l compact -d 'don\'t compact identical subtrees'
complete -c pstree -s h -l highlight-all -d 'highlight current process and its ancestors'
complete -c pstree -s H -l highlight-pid -d 'highlight this process and its ancestors' -a '(__fish_complete_pids)'
complete -c pstree -s g -l show-pgids -d 'show process group ids; implies -c'
complete -c pstree -s G -l vt100 -d 'use VT100 line drawing characters'
complete -c pstree -s l -l long -d 'don\'t truncate long lines'
complete -c pstree -s n -l numeric-sort -d 'sort output by PID'
complete -c pstree -s N -l ns-sort -d 'sort by namespace type' -xa 'cgroup ipc mnt net pid user uts'
complete -c pstree -s p -l show-pids -d 'show PIDs; implies -c'
complete -c pstree -s s -l show-parents -d 'show parents of the selected process'
complete -c pstree -s S -l ns-changes -d 'show namespace transitions'
complete -c pstree -s t -l thread-names -d 'show full thread names'
complete -c pstree -s T -l hide-threads -d 'hide threads, show only processes'
complete -c pstree -s u -l uid-changes -d 'show uid transitions'
complete -c pstree -s U -l unicode -d 'use UTF-8 line drawing characters'
complete -c pstree -s V -l version -d 'display version information'
complete -c pstree -s Z -l security-context -d 'show SELinux security contexts'
complete -c pstree -a '(__fish_complete_pids)' -d PID
complete -c pstree -a '(__fish_complete_users)' -d USER

View File

@@ -13,6 +13,7 @@ complete -c ssh -n 'test (__fish_number_of_cmd_args_wo_opts) -ge 2' -d "Command
complete -c ssh -s a -d "Disables forwarding of the authentication agent"
complete -c ssh -s B -d "Bind to the address of that interface" -xa '(__fish_print_interfaces)'
complete -c ssh -s b -d "Local address to bind to" -xa '(__fish_print_addresses)'
complete -c ssh -s D -d "Specify dynamic port forwarding" -x
complete -c ssh -s E -d "Append debug logs to log_file" -rF
complete -c ssh -s e -d "Escape character" -xa "\^ none"
complete -c ssh -s f -d "Go to background"

View File

@@ -1,24 +1,74 @@
# Startup
complete -c strace -s E -l env -d 'Remove var from the inherited list of environment variables before passing it on to the command'
complete -c strace -s p -l attach -xa '(__fish_complete_pids)'
complete -c strace -s u -l user -xa '(__fish_complete_users)'
complete -c strace -l argv0 -d 'Set argv[0] of the command being executed to name'
# Tracing
complete -c strace -s b -l detach-on -d 'Detach when the specified syscall is reached'
complete -c strace -s D -l daemonize -d 'Run tracer process as a grandchild, not as the parent of the tracee'
complete -c strace -o DD -d "Run tracer process as tracee's grandchild in a separate process group."
complete -c strace -o DDD -d "Run tracer process as tracee's grandchild in a separate session"
complete -c strace -s f -l follow-forks
complete -c strace -l output-separately
complete -c strace -o ff -d 'Like --follow-forks --output-separately'
complete -c strace -s I -l interruptible -d 'When strace can be interrupted by signals'
complete -c strace -l syscall-limit -d 'Detach all tracees when LIMIT number of syscalls have been captured'
complete -c strace -l kill-on-exit -d 'Set PTRACE_O_EXITKILL ptrace option to all tracee processes'
# General/Filtering/Tampering
complete -c strace -s e -d 'Set expression which modifies which events to trace'
complete -c strace -s e -l trace -d 'Set expression which modifies which events to trace'
complete -c strace -s e -l trace-fds -d 'Set expression which modifies which events to trace'
complete -c strace -s e -l signal -d 'Set expression which modifies which events to trace'
complete -c strace -s e -l status -d 'Set expression which modifies which events to trace'
complete -c strace -s P -l trace-path -d 'Trace only system calls accessing path'
complete -c strace -s z -l successful-only -d 'Print only syscalls that returned without an error code'
complete -c strace -s Z -l failed-only -d 'Print only syscalls that returned with an error code'
# Output format
complete -c strace -s a -l columns -d 'Align output in columns'
complete -c strace -s e -l verbose -d 'Dereference structures for the specified set of system calls'
complete -c strace -l decode-pids -d 'Decode various information associated with process IDs'
complete -c strace -l silence -l silent -l quiet -d 'Suppress various information messages'
complete -c strace -l decode-fds -d 'Decode various information associated with file descriptors'
complete -c strace -l decode-pids -d 'Decode various information associated with process IDs'
complete -c strace -l kvm -d 'Print the exit reason of kvm vcpu'
complete -c strace -s i -l instruction-pointer -d 'Print the instruction pointer at the time of the system call'
complete -c strace -s n -l syscall-number -d 'Print the syscall number'
complete -c strace -s k -l stack-traces -d 'Print the execution stack trace of the traced processes after each system call'
complete -c strace -s o -l output -d 'Write the trace output to the file filename rather than to stderr'
complete -c strace -s A -l output-append-mode -d 'Open the file provided in the -o option in append mode'
complete -c strace -s q -l quiet
complete -c strace -o qq -l quiet
complete -c strace -o qqq -l quiet
complete -c strace -s r -l relative-timestamps -d 'Print a relative timestamp upon entry to each system call'
complete -c strace -s s -l string-limit -d 'Specify the maximum string size to print (the default is 32)'
complete -c strace -l absolute-timestamps -l timestamps -d 'Prefix each line of the trace with the wall clock time'
complete -c strace -s t -l absolute-timestamps -d 'Prefix each line of the trace with the wall clock time'
complete -c strace -o tt -l absolute-timestamps -d 'If given twice, the time printed will include the microseconds'
complete -c strace -o ttt -l absolute-timestamps
complete -c strace -s T -l syscall-times -d 'Show the time spent in system calls'
complete -c strace -s v -l no-abbrev -d 'Print unabbreviated versions of environment'
complete -c strace -l strings-in-hex -d 'Control usage of escape sequences with hexadecimal numbers in the printed strings'
complete -c strace -s x -d 'Print all non-ASCII strings in hex format'
complete -c strace -s xx -d 'Print all strings in hex format'
complete -c strace -o xx -d 'Print all strings in hex format'
complete -c strace -s X -l const-print-style -d 'Set the format for printing of named constants and flags'
complete -c strace -o yy -l decode-fds -d 'Print all available information associated with file descriptors'
complete -c strace -s y -l decode-fds -d 'Print paths associated with file descriptor arguments and with the AT_FDCWD constant'
complete -c strace -l pidns-translation -l decode-pids -d "print PIDs in strace's namespace"
complete -c strace -s Y -l decode-pids -d 'Print command names for PIDs'
# Statistics
complete -c strace -s c -l summary-only -d 'Suppress output and report summary on exit'
complete -c strace -s C -l summary -d 'Display output and report summary on exit'
complete -c strace -s O -l summary-syscall-overhead -d 'Set the overhead for tracing system calls to overhead'
complete -c strace -s S -l summary-sort-by -xa 'time time_total total_time calls count errors error name syscall syscall_name nothing none' -d 'Sort summary by the specified criterion'
complete -c strace -s U -l summary-columns -d 'Configure a set (and order) of columns being shown in the call summary'
complete -c strace -s w -l summary-wall-clock -d 'Summarise the time difference between the beginning and end of each system call'
# Miscellaneous
complete -c strace -s d -l debug -d 'Debug output'
complete -c strace -l seccomp-bpf -d 'Try to enable use of seccomp-bpf'
complete -c strace -l tips -d 'Show strace tips, tricks, and tweaks before exit'
complete -c strace -s h -l help -d 'Print help and exit'
complete -c strace -s V -l version -d 'Print version and exit'

View File

@@ -1,7 +1,7 @@
set -l valid_subcmds up down strip save
function __fish_wg_complete_interfaces
wg show interfaces
wg show interfaces | string split " "
end
complete -c wg-quick -f

View File

@@ -68,5 +68,6 @@ complete -c $progname -s S -d 'Shows information of an installed package' -x
complete -c $progname -s s -d 'Search for packages by matching PATTERN on pkgver or short_desc'
complete -c $progname -s f -d 'Show the package files for PKG' -x
complete -c $progname -s x -d 'Show the required dependencies for PKG. Only direct dependencies are shown' -x
complete -c $progname -s X -d 'Show the reverse dependencies for PKG' -x
complete -c $progname -s X -d 'Show the reverse dependencies for PKG' -xa "$listinstalled"
complete -c $progname -s X -d 'Show the reverse dependencies for PKG' -x -n "__fish_contains_opt -s R" -a "$listall"
complete -c $progname -l cat -d 'Prints the file FILE stored in binary package PKG to stdout' -F

View File

@@ -17,7 +17,7 @@ function __fish_anypager --description "Print a pager to use"
end
# Cheesy hardcoded list of pagers.
for cmd in bat lv most less more
for cmd in less bat lv most more
if command -q $cmd
echo -- $cmd
return 0

View File

@@ -264,9 +264,6 @@ function __fish_complete_gpg -d "Internal function for gpg completion code dedup
complete -c $__fish_complete_gpg_command -l for-your-eyes-only -d "Set the 'for your eyes only' flag in the message"
complete -c $__fish_complete_gpg_command -l no-for-your-eyes-only -d "Clear the 'for your eyes only' flag in the message"
complete -c $__fish_complete_gpg_command -l use-embedded-filename -d "Create file with name as given in data"
complete -c $__fish_complete_gpg_command -l no-use-embedded-filename -d "Don't create file with name as given in data"
complete -c $__fish_complete_gpg_command -l completes-needed -x -d "Number of completely trusted users to introduce a new key signer (defaults to 1)"
complete -c $__fish_complete_gpg_command -l marginals-needed -x -d "Number of marginally trusted users to introduce a new key signer (defaults to 3)"

View File

@@ -114,7 +114,9 @@ function funced --description 'Edit function definition'
set -l new_checksum (__funced_md5 "$tmpname")
if test "$new_checksum" = "$checksum"
echo (_ "Editor exited but the function was not modified")
# Don't source or save an unmodified file.
# Source but don't save an unmodified file.
# (Source in case the file changed externally since we first loaded it.)
source "$writepath"
break
end
end

View File

@@ -174,7 +174,7 @@ function history --description "display or manipulate interactive command histor
end
if string match -qr '^[1-9][0-9]*$' -- $i
and test $i -lt $found_items_count
and test $i -le $found_items_count
set -a choices $i
else
printf (_ "Ignoring invalid history entry ID \"%s\"\n") $i

View File

@@ -1,3 +1,3 @@
function prompt_hostname --description 'short hostname for the prompt'
string replace -r "\..*" "" $hostname
string replace -r -- "\..*" "" $hostname
end

View File

@@ -475,13 +475,13 @@ proc_status_t builtin_run(parser_t &parser, const wcstring_list_t &argv, io_stre
return proc_status_t::empty();
}
if (code < 0) {
FLOGF(warning, "builtin %ls returned invalid exit code %d", cmdname.c_str(), code);
// If the code is below 0, constructing a proc_status_t
// would assert() out, which is a terrible failure mode
// So instead, what we do is we get a positive code,
// and we avoid 0.
code = abs((256 + code) % 256);
if (code == 0) code = 255;
FLOGF(warning, "builtin %ls returned invalid exit code %d", cmdname.c_str(), code);
}
return proc_status_t::from_exit_code(code);
}

View File

@@ -262,7 +262,7 @@ static int abbr_add(const abbr_options_t &opts, io_streams_t &streams) {
abbrs_position_t position = opts.position ? *opts.position : abbrs_position_t::command;
// Note historically we have allowed overwriting existing abbreviations.
abbreviation_t abbr{std::move(name), std::move(key), std::move(replacement), position};
abbreviation_t abbr{name, std::move(key), std::move(replacement), position};
abbr.regex = std::move(regex);
abbr.replacement_is_function = opts.function.has_value();
abbr.set_cursor_marker = opts.set_cursor_marker;

View File

@@ -190,6 +190,7 @@ static int parse_cmd_opts(set_cmd_opts_t &opts, int *optind, //!OCLINT(high ncs
static int validate_cmd_opts(const wchar_t *cmd, const set_cmd_opts_t &opts, int argc,
const wchar_t *argv[], parser_t &parser, io_streams_t &streams) {
UNUSED(argv);
// Can't query and erase or list.
if (opts.query && (opts.erase || opts.list)) {
streams.err.append_format(BUILTIN_ERR_COMBO, cmd);

View File

@@ -463,7 +463,7 @@ void safe_report_exec_error(int err, const char *actual_cmd, const char *const *
const char *interpreter =
get_interpreter(actual_cmd, interpreter_buff, sizeof interpreter_buff);
struct stat buf;
auto statret = stat(interpreter, &buf);
auto statret = !interpreter || stat(interpreter, &buf);
if (interpreter && (0 != statret || access(interpreter, X_OK))) {
// Detect Windows line endings and complain specifically about them.
auto len = strlen(interpreter);

View File

@@ -646,8 +646,11 @@ void wildcard_expander_t::expand_trailing_slash(const wcstring &base_dir, const
}
if (!(flags & expand_flag::for_completions)) {
// Trailing slash and not accepting incomplete, e.g. `echo /xyz/`. Insert this file, we already know it exists!
this->add_expansion_result(wcstring{base_dir});
// Trailing slash and not accepting incomplete, e.g. `echo /xyz/`. Insert this file if it
// exists.
if (waccess(base_dir, F_OK) == 0) {
this->add_expansion_result(wcstring{base_dir});
}
} else {
// Trailing slashes and accepting incomplete, e.g. `echo /xyz/<tab>`. Everything is added.
dir_iter_t dir = open_dir(base_dir);

View File

@@ -26,22 +26,22 @@ echo $status
# CHECKERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~^
$fish -c 'exit -5'
# CHECKERR: warning: builtin exit returned invalid exit code 251
# CHECKERR: warning: builtin exit returned invalid exit code -5
echo $status
# CHECK: 251
$fish -c 'exit -1'
# CHECKERR: warning: builtin exit returned invalid exit code 255
# CHECKERR: warning: builtin exit returned invalid exit code -1
echo $status
# CHECK: 255
# (we avoid 0, so this is turned into 255 again)
$fish -c 'exit -256'
# CHECKERR: warning: builtin exit returned invalid exit code 255
# CHECKERR: warning: builtin exit returned invalid exit code -256
echo $status
# CHECK: 255
$fish -c 'exit -512'
# CHECKERR: warning: builtin exit returned invalid exit code 255
# CHECKERR: warning: builtin exit returned invalid exit code -512
echo $status
# CHECK: 255

View File

@@ -11,6 +11,10 @@ touch ./b/file.txt
set dirs ./a ./b
echo $dirs/*.txt # CHECK: ./b/file.txt
echo */foo/
# CHECKERR: checks/wildcard.fish (line {{\d+}}): No matches for wildcard '*/foo/'. See `help wildcards-globbing`.
# CHECKERR: echo */foo/
# CHECKERR: ^~~~~^
cd $oldpwd
rm -Rf $dir