1
Fork 0
mirror of https://github.com/Steffo99/config-fish.git synced 2024-12-22 23:04:22 +00:00

A few new functions

This commit is contained in:
Steffo 2022-01-01 19:52:43 +01:00
parent 254ecfb7b5
commit d11c3eaa27
Signed by: steffo
GPG key ID: 6965406171929D01
5 changed files with 282 additions and 0 deletions

199
completions/rustup.fish Normal file
View file

@ -0,0 +1,199 @@
complete -c rustup -n "__fish_use_subcommand" -s v -l verbose -d 'Enable verbose output'
complete -c rustup -n "__fish_use_subcommand" -s q -l quiet -d 'Disable progress output'
complete -c rustup -n "__fish_use_subcommand" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_use_subcommand" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_use_subcommand" -f -a "dump-testament" -d 'Dump information about the build'
complete -c rustup -n "__fish_use_subcommand" -f -a "show" -d 'Show the active and installed toolchains or profiles'
complete -c rustup -n "__fish_use_subcommand" -f -a "install" -d 'Update Rust toolchains'
complete -c rustup -n "__fish_use_subcommand" -f -a "uninstall" -d 'Uninstall Rust toolchains'
complete -c rustup -n "__fish_use_subcommand" -f -a "update" -d 'Update Rust toolchains and rustup'
complete -c rustup -n "__fish_use_subcommand" -f -a "check" -d 'Check for updates to Rust toolchains and rustup'
complete -c rustup -n "__fish_use_subcommand" -f -a "default" -d 'Set the default toolchain'
complete -c rustup -n "__fish_use_subcommand" -f -a "toolchain" -d 'Modify or query the installed toolchains'
complete -c rustup -n "__fish_use_subcommand" -f -a "target" -d 'Modify a toolchain\'s supported targets'
complete -c rustup -n "__fish_use_subcommand" -f -a "component" -d 'Modify a toolchain\'s installed components'
complete -c rustup -n "__fish_use_subcommand" -f -a "override" -d 'Modify directory toolchain overrides'
complete -c rustup -n "__fish_use_subcommand" -f -a "run" -d 'Run a command with an environment configured for a given toolchain'
complete -c rustup -n "__fish_use_subcommand" -f -a "which" -d 'Display which binary will be run for a given command'
complete -c rustup -n "__fish_use_subcommand" -f -a "doc" -d 'Open the documentation for the current toolchain'
complete -c rustup -n "__fish_use_subcommand" -f -a "man" -d 'View the man page for a given command'
complete -c rustup -n "__fish_use_subcommand" -f -a "self" -d 'Modify the rustup installation'
complete -c rustup -n "__fish_use_subcommand" -f -a "set" -d 'Alter rustup settings'
complete -c rustup -n "__fish_use_subcommand" -f -a "completions" -d 'Generate tab-completion scripts for your shell'
complete -c rustup -n "__fish_use_subcommand" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_seen_subcommand_from dump-testament" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from dump-testament" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from show" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from show" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from show" -f -a "active-toolchain" -d 'Show the active toolchain'
complete -c rustup -n "__fish_seen_subcommand_from show" -f -a "home" -d 'Display the computed value of RUSTUP_HOME'
complete -c rustup -n "__fish_seen_subcommand_from show" -f -a "profile" -d 'Show the current profile'
complete -c rustup -n "__fish_seen_subcommand_from show" -f -a "keys" -d 'Display the known PGP keys'
complete -c rustup -n "__fish_seen_subcommand_from show" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_seen_subcommand_from active-toolchain" -s v -l verbose -d 'Enable verbose output with rustc information'
complete -c rustup -n "__fish_seen_subcommand_from active-toolchain" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from active-toolchain" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from home" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from home" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from profile" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from profile" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from keys" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from keys" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from install" -l profile -r -f -a "minimal default complete"
complete -c rustup -n "__fish_seen_subcommand_from install" -l no-self-update -d 'Don\'t perform self-update when running the `rustup install` command'
complete -c rustup -n "__fish_seen_subcommand_from install" -l force -d 'Force an update, even if some components are missing'
complete -c rustup -n "__fish_seen_subcommand_from install" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from install" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from uninstall" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from uninstall" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from update" -l no-self-update -d 'Don\'t perform self update when running the `rustup update` command'
complete -c rustup -n "__fish_seen_subcommand_from update" -l force -d 'Force an update, even if some components are missing'
complete -c rustup -n "__fish_seen_subcommand_from update" -l force-non-host -d 'Install toolchains that require an emulator. See https://github.com/rust-lang/rustup/wiki/Non-host-toolchains'
complete -c rustup -n "__fish_seen_subcommand_from update" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from update" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from check" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from check" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from default" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from default" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from toolchain" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from toolchain" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from toolchain" -f -a "list" -d 'List installed toolchains'
complete -c rustup -n "__fish_seen_subcommand_from toolchain" -f -a "install" -d 'Install or update a given toolchain'
complete -c rustup -n "__fish_seen_subcommand_from toolchain" -f -a "uninstall" -d 'Uninstall a toolchain'
complete -c rustup -n "__fish_seen_subcommand_from toolchain" -f -a "link" -d 'Create a custom toolchain by symlinking to a directory'
complete -c rustup -n "__fish_seen_subcommand_from toolchain" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_seen_subcommand_from list" -s v -l verbose -d 'Enable verbose output with toolchain information'
complete -c rustup -n "__fish_seen_subcommand_from list" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from list" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from install" -l profile -r -f -a "minimal default complete"
complete -c rustup -n "__fish_seen_subcommand_from install" -s c -l component -d 'Add specific components on installation'
complete -c rustup -n "__fish_seen_subcommand_from install" -s t -l target -d 'Add specific targets on installation'
complete -c rustup -n "__fish_seen_subcommand_from install" -l no-self-update -d 'Don\'t perform self update when running the`rustup toolchain install` command'
complete -c rustup -n "__fish_seen_subcommand_from install" -l force -d 'Force an update, even if some components are missing'
complete -c rustup -n "__fish_seen_subcommand_from install" -l allow-downgrade -d 'Allow rustup to downgrade the toolchain to satisfy your component choice'
complete -c rustup -n "__fish_seen_subcommand_from install" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from install" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from uninstall" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from uninstall" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from link" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from link" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from target" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from target" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from target" -f -a "list" -d 'List installed and available targets'
complete -c rustup -n "__fish_seen_subcommand_from target" -f -a "add" -d 'Add a target to a Rust toolchain'
complete -c rustup -n "__fish_seen_subcommand_from target" -f -a "remove" -d 'Remove a target from a Rust toolchain'
complete -c rustup -n "__fish_seen_subcommand_from target" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_seen_subcommand_from list" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_seen_subcommand_from list" -l installed -d 'List only installed targets'
complete -c rustup -n "__fish_seen_subcommand_from list" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from list" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from add" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_seen_subcommand_from add" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from add" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from remove" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_seen_subcommand_from remove" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from remove" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from component" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from component" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from component" -f -a "list" -d 'List installed and available components'
complete -c rustup -n "__fish_seen_subcommand_from component" -f -a "add" -d 'Add a component to a Rust toolchain'
complete -c rustup -n "__fish_seen_subcommand_from component" -f -a "remove" -d 'Remove a component from a Rust toolchain'
complete -c rustup -n "__fish_seen_subcommand_from component" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_seen_subcommand_from list" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_seen_subcommand_from list" -l installed -d 'List only installed components'
complete -c rustup -n "__fish_seen_subcommand_from list" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from list" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from add" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_seen_subcommand_from add" -l target
complete -c rustup -n "__fish_seen_subcommand_from add" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from add" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from remove" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_seen_subcommand_from remove" -l target
complete -c rustup -n "__fish_seen_subcommand_from remove" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from remove" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from override" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from override" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from override" -f -a "list" -d 'List directory toolchain overrides'
complete -c rustup -n "__fish_seen_subcommand_from override" -f -a "set" -d 'Set the override toolchain for a directory'
complete -c rustup -n "__fish_seen_subcommand_from override" -f -a "unset" -d 'Remove the override toolchain for a directory'
complete -c rustup -n "__fish_seen_subcommand_from override" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_seen_subcommand_from list" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from list" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from set" -l path -d 'Path to the directory'
complete -c rustup -n "__fish_seen_subcommand_from set" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from set" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from unset" -l path -d 'Path to the directory'
complete -c rustup -n "__fish_seen_subcommand_from unset" -l nonexistent -d 'Remove override toolchain for all nonexistent directories'
complete -c rustup -n "__fish_seen_subcommand_from unset" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from unset" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from run" -l install -d 'Install the requested toolchain if needed'
complete -c rustup -n "__fish_seen_subcommand_from run" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from run" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from which" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_seen_subcommand_from which" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from which" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l path -d 'Only print the path to the documentation'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l alloc -d 'The Rust core allocation and collections library'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l book -d 'The Rust Programming Language book'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l cargo -d 'The Cargo Book'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l core -d 'The Rust Core Library'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l edition-guide -d 'The Rust Edition Guide'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l nomicon -d 'The Dark Arts of Advanced and Unsafe Rust Programming'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l proc_macro -d 'A support library for macro authors when defining new macros'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l reference -d 'The Rust Reference'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l rust-by-example -d 'A collection of runnable examples that illustrate various Rust concepts and standard libraries'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l rustc -d 'The compiler for the Rust programming language'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l rustdoc -d 'Generate documentation for Rust projects'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l std -d 'Standard library API documentation'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l test -d 'Support code for rustc\'s built in unit-test and micro-benchmarking framework'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l unstable-book -d 'The Unstable Book'
complete -c rustup -n "__fish_seen_subcommand_from doc" -l embedded-book -d 'The Embedded Rust Book'
complete -c rustup -n "__fish_seen_subcommand_from doc" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from doc" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from man" -l toolchain -d 'Toolchain name, such as \'stable\', \'nightly\', or \'1.8.0\'. For more information see `rustup help toolchain`'
complete -c rustup -n "__fish_seen_subcommand_from man" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from man" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from self" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from self" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from self" -f -a "update" -d 'Download and install updates to rustup'
complete -c rustup -n "__fish_seen_subcommand_from self" -f -a "uninstall" -d 'Uninstall rustup.'
complete -c rustup -n "__fish_seen_subcommand_from self" -f -a "upgrade-data" -d 'Upgrade the internal data format.'
complete -c rustup -n "__fish_seen_subcommand_from self" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_seen_subcommand_from update" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from update" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from uninstall" -s y
complete -c rustup -n "__fish_seen_subcommand_from uninstall" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from uninstall" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from upgrade-data" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from upgrade-data" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from set" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from set" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from set" -f -a "default-host" -d 'The triple used to identify toolchains when not specified'
complete -c rustup -n "__fish_seen_subcommand_from set" -f -a "profile" -d 'The default components installed'
complete -c rustup -n "__fish_seen_subcommand_from set" -f -a "auto-self-update" -d 'The rustup auto self update mode'
complete -c rustup -n "__fish_seen_subcommand_from set" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c rustup -n "__fish_seen_subcommand_from default-host" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from default-host" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from profile" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from profile" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from auto-self-update" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from auto-self-update" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from completions" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from completions" -s V -l version -d 'Prints version information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s h -l help -d 'Prints help information'
complete -c rustup -n "__fish_seen_subcommand_from help" -s V -l version -d 'Prints version information'

74
functions/alias.fish Normal file
View file

@ -0,0 +1,74 @@
function alias --description 'Creates a function wrapping a command'
set -l options h/help s/save
argparse -n alias --max-args=2 $options -- $argv
or return
if set -q _flag_help
__fish_print_help alias
return 0
end
set -l name
set -l body
set -l prefix
if not set -q argv[1]
# Print the known aliases.
for func in (functions -n)
set -l output (functions $func | string match -r -- "^function .* --description (?:'alias (.*)'|alias\\\\ (.*))\$")
if set -q output[2]
set output (string replace -r -- '^'$func'[= ]' '' $output[2])
echo alias $func (string escape -- $output[1])
end
end
return 0
else if not set -q argv[2]
# Alias definition of the form "name=value".
set -l tmp (string split -m 1 "=" -- $argv) ""
set name $tmp[1]
set body $tmp[2]
else
# Alias definition of the form "name value".
set name $argv[1]
set body $argv[2]
end
# sanity check
if test -z "$name"
printf ( _ "%s: Name cannot be empty\n") alias >&2
return 1
else if test -z "$body"
printf ( _ "%s: Body cannot be empty\n") alias >&2
return 1
end
# Extract the first command from the body.
printf '%s\n' $body | read -l --list words
set -l first_word $words[1]
set -l last_word $words[-1]
# Prevent the alias from immediately running into an infinite recursion if
# $body starts with the same command as $name.
if test $first_word = $name
if contains $name (builtin --names)
set prefix builtin
else
set prefix command
end
end
set -l cmd_string (string escape -- "alias $argv")
# Do not define wrapper completion if we have "alias foo 'foo xyz'" or "alias foo 'sudo foo'"
# This is to prevent completions from recursively calling themselves (#7389).
# The latter will have rare false positives but it's more important to
# prevent recursion for this high-level command.
set -l wraps
if test $first_word != $name; and test $last_word != $name
set wraps --wraps (string escape -- $body)
end
echo "function $name $wraps --description $cmd_string; $prefix $body \$argv; end" | source
if set -q _flag_save
funcsave $name
end
end

3
functions/cp.fish Normal file
View file

@ -0,0 +1,3 @@
function cp --description 'alias cp cp -i'
command cp -i $argv;
end

3
functions/mv.fish Normal file
View file

@ -0,0 +1,3 @@
function mv --description 'alias mv mv -i'
command mv -i $argv;
end

3
functions/rm.fish Normal file
View file

@ -0,0 +1,3 @@
function rm --description 'alias rm rm -i'
command rm -i $argv;
end