Added Fish terminal configuration
This commit is contained in:
5
.bashrc
5
.bashrc
@@ -1,5 +1,3 @@
|
|||||||
# Fig pre block. Keep at the top of this file.
|
|
||||||
[[ -f "$HOME/.fig/shell/bashrc.pre.bash" ]] && builtin source "$HOME/.fig/shell/bashrc.pre.bash"
|
|
||||||
#
|
#
|
||||||
# ~/.bashrc
|
# ~/.bashrc
|
||||||
#
|
#
|
||||||
@@ -199,6 +197,3 @@ export NVM_DIR="$HOME/.nvm"
|
|||||||
export SDKMAN_DIR="/home/plague/.sdkman"
|
export SDKMAN_DIR="/home/plague/.sdkman"
|
||||||
[[ -s "/home/plague/.sdkman/bin/sdkman-init.sh" ]] && source "/home/plague/.sdkman/bin/sdkman-init.sh"
|
[[ -s "/home/plague/.sdkman/bin/sdkman-init.sh" ]] && source "/home/plague/.sdkman/bin/sdkman-init.sh"
|
||||||
. "$HOME/.cargo/env"
|
. "$HOME/.cargo/env"
|
||||||
|
|
||||||
# Fig post block. Keep at the bottom of this file.
|
|
||||||
[[ -f "$HOME/.fig/shell/bashrc.post.bash" ]] && builtin source "$HOME/.fig/shell/bashrc.post.bash"
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export GRAALVM_HOME="${SDKMAN_DIR}/candidates/java/22.3.1.r19-grl"
|
export GRAALVM_HOME="${SDKMAN_CANDIDATES_DIR}/java/21.0.1-graal"
|
||||||
|
|||||||
1
.zshenv
1
.zshenv
@@ -9,6 +9,7 @@ function appendpath() {
|
|||||||
|
|
||||||
appendpath "$GOPATH/bin"
|
appendpath "$GOPATH/bin"
|
||||||
appendpath "$HOME/.local/bin"
|
appendpath "$HOME/.local/bin"
|
||||||
|
appendpath "$GRAALVM_HOME/bin"
|
||||||
appendpath $HOME/.local/share/gem/ruby/3.0.0/bin
|
appendpath $HOME/.local/share/gem/ruby/3.0.0/bin
|
||||||
|
|
||||||
unset appendpath
|
unset appendpath
|
||||||
|
|||||||
15
.zshrc
15
.zshrc
@@ -1,6 +1,3 @@
|
|||||||
# Fig pre block. Keep at the top of this file.
|
|
||||||
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.pre.zsh"
|
|
||||||
|
|
||||||
# If you come from bash you might have to change your $PATH.
|
# If you come from bash you might have to change your $PATH.
|
||||||
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
||||||
|
|
||||||
@@ -109,7 +106,6 @@ plugins=(
|
|||||||
web-search
|
web-search
|
||||||
zsh-completions
|
zsh-completions
|
||||||
zsh-navigation-tools
|
zsh-navigation-tools
|
||||||
#zsh_reload
|
|
||||||
)
|
)
|
||||||
|
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
@@ -131,6 +127,8 @@ source $ZSH/oh-my-zsh.sh
|
|||||||
# Compilation flags
|
# Compilation flags
|
||||||
# export ARCHFLAGS="-arch x86_64"
|
# export ARCHFLAGS="-arch x86_64"
|
||||||
|
|
||||||
|
[[ ! -f ~/.zshenv ]] || source ~/.zshenv
|
||||||
|
|
||||||
# Set personal aliases, overriding those provided by oh-my-zsh libs,
|
# Set personal aliases, overriding those provided by oh-my-zsh libs,
|
||||||
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
|
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
|
||||||
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
|
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
|
||||||
@@ -143,15 +141,19 @@ source $ZSH/oh-my-zsh.sh
|
|||||||
# Setup emacs keymap
|
# Setup emacs keymap
|
||||||
bindkey -e
|
bindkey -e
|
||||||
|
|
||||||
|
fpath=(~/.zsh $fpath)
|
||||||
|
|
||||||
unalias run-help
|
unalias run-help
|
||||||
autoload run-help
|
autoload run-help
|
||||||
autoload -U compinit && compinit
|
autoload -Uz compinit && compinit -u
|
||||||
|
|
||||||
source "$ZSH_HIGHLIGHT_DIR/zsh-syntax-highlighting.zsh"
|
source "$ZSH_HIGHLIGHT_DIR/zsh-syntax-highlighting.zsh"
|
||||||
|
|
||||||
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
||||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||||
|
|
||||||
|
source <(kind completion zsh)
|
||||||
|
|
||||||
# pyenv configuration
|
# pyenv configuration
|
||||||
eval "$(pyenv init -)"
|
eval "$(pyenv init -)"
|
||||||
eval "$(pyenv virtualenv-init -)"
|
eval "$(pyenv virtualenv-init -)"
|
||||||
@@ -162,6 +164,3 @@ test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell
|
|||||||
export NVM_DIR="$HOME/.nvm"
|
export NVM_DIR="$HOME/.nvm"
|
||||||
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
|
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
|
||||||
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
|
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
|
||||||
|
|
||||||
# Fig post block. Keep at the bottom of this file.
|
|
||||||
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh"
|
|
||||||
|
|||||||
7
fish/completions/fisher.fish
Normal file
7
fish/completions/fisher.fish
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
complete --command fisher --exclusive --long help --description "Print help"
|
||||||
|
complete --command fisher --exclusive --long version --description "Print version"
|
||||||
|
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments install --description "Install plugins"
|
||||||
|
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments update --description "Update installed plugins"
|
||||||
|
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments remove --description "Remove installed plugins"
|
||||||
|
complete --command fisher --exclusive --condition __fish_use_subcommand --arguments list --description "List installed plugins matching regex"
|
||||||
|
complete --command fisher --exclusive --condition "__fish_seen_subcommand_from update remove" --arguments "(fisher list)"
|
||||||
169
fish/completions/fnm.fish
Normal file
169
fish/completions/fnm.fish
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
complete -c fnm -n "__fish_use_subcommand" -l node-dist-mirror -d 'https://nodejs.org/dist/ mirror' -r
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -l fnm-dir -d 'The root directory of fnm installations' -r -F
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -l multishell-path -d 'Where the current node version link is stored. This value will be populated automatically by evaluating `fnm env` in your shell profile. Read more about it using `fnm help env`' -r -F
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -l log-level -d 'The log level of fnm commands' -r -f -a "{quiet ,error ,info }"
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -l arch -d 'Override the architecture of the installed Node binary. Defaults to arch of fnm binary' -r
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -l version-file-strategy -d 'A strategy for how to resolve the Node version. Used whenever `fnm use` or `fnm install` is called without a version, or when `--use-on-cd` is configured on evaluation' -r -f -a "{local Use the local version of Node defined within the current directory,recursive Use the version of Node defined within the current directory and all parent directories}"
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -l corepack-enabled -d 'Enable corepack support for each new installation. This will make fnm call `corepack enable` on every Node.js installation. For more information about corepack see https://nodejs.org/api/corepack.html'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -l resolve-engines -d 'Resolve `engines.node` field in `package.json` whenever a `.node-version` or `.nvmrc` file is not present.
|
||||||
|
Experimental: This feature is subject to change.
|
||||||
|
Note: `engines.node` can be any semver range, with the latest satisfying version being resolved.'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -s h -l help -d 'Print help (see more with \'--help\')'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -s V -l version -d 'Print version'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -f -a "list-remote" -d 'List all remote Node.js versions'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -f -a "list" -d 'List all locally installed Node.js versions'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -f -a "install" -d 'Install a new Node.js version'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -f -a "use" -d 'Change Node.js version'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -f -a "env" -d 'Print and set up required environment variables for fnm'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -f -a "completions" -d 'Print shell completions to stdout'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -f -a "alias" -d 'Alias a version to a common name'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -f -a "unalias" -d 'Remove an alias definition'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -f -a "default" -d 'Set a version as the default version'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -f -a "current" -d 'Print the current Node.js version'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -f -a "exec" -d 'Run a command within fnm context'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -f -a "uninstall" -d 'Uninstall a Node.js version'
|
||||||
|
complete -c fnm -n "__fish_use_subcommand" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list-remote" -l node-dist-mirror -d 'https://nodejs.org/dist/ mirror' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list-remote" -l fnm-dir -d 'The root directory of fnm installations' -r -F
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list-remote" -l log-level -d 'The log level of fnm commands' -r -f -a "{quiet ,error ,info }"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list-remote" -l arch -d 'Override the architecture of the installed Node binary. Defaults to arch of fnm binary' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list-remote" -l version-file-strategy -d 'A strategy for how to resolve the Node version. Used whenever `fnm use` or `fnm install` is called without a version, or when `--use-on-cd` is configured on evaluation' -r -f -a "{local Use the local version of Node defined within the current directory,recursive Use the version of Node defined within the current directory and all parent directories}"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list-remote" -l corepack-enabled -d 'Enable corepack support for each new installation. This will make fnm call `corepack enable` on every Node.js installation. For more information about corepack see https://nodejs.org/api/corepack.html'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list-remote" -l resolve-engines -d 'Resolve `engines.node` field in `package.json` whenever a `.node-version` or `.nvmrc` file is not present.
|
||||||
|
Experimental: This feature is subject to change.
|
||||||
|
Note: `engines.node` can be any semver range, with the latest satisfying version being resolved.'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list-remote" -s h -l help -d 'Print help (see more with \'--help\')'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list" -l node-dist-mirror -d 'https://nodejs.org/dist/ mirror' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list" -l fnm-dir -d 'The root directory of fnm installations' -r -F
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list" -l log-level -d 'The log level of fnm commands' -r -f -a "{quiet ,error ,info }"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list" -l arch -d 'Override the architecture of the installed Node binary. Defaults to arch of fnm binary' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list" -l version-file-strategy -d 'A strategy for how to resolve the Node version. Used whenever `fnm use` or `fnm install` is called without a version, or when `--use-on-cd` is configured on evaluation' -r -f -a "{local Use the local version of Node defined within the current directory,recursive Use the version of Node defined within the current directory and all parent directories}"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list" -l corepack-enabled -d 'Enable corepack support for each new installation. This will make fnm call `corepack enable` on every Node.js installation. For more information about corepack see https://nodejs.org/api/corepack.html'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list" -l resolve-engines -d 'Resolve `engines.node` field in `package.json` whenever a `.node-version` or `.nvmrc` file is not present.
|
||||||
|
Experimental: This feature is subject to change.
|
||||||
|
Note: `engines.node` can be any semver range, with the latest satisfying version being resolved.'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from list" -s h -l help -d 'Print help (see more with \'--help\')'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from install" -l node-dist-mirror -d 'https://nodejs.org/dist/ mirror' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from install" -l fnm-dir -d 'The root directory of fnm installations' -r -F
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from install" -l log-level -d 'The log level of fnm commands' -r -f -a "{quiet ,error ,info }"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from install" -l arch -d 'Override the architecture of the installed Node binary. Defaults to arch of fnm binary' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from install" -l version-file-strategy -d 'A strategy for how to resolve the Node version. Used whenever `fnm use` or `fnm install` is called without a version, or when `--use-on-cd` is configured on evaluation' -r -f -a "{local Use the local version of Node defined within the current directory,recursive Use the version of Node defined within the current directory and all parent directories}"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from install" -l lts -d 'Install latest LTS'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from install" -l latest -d 'Install latest version'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from install" -l corepack-enabled -d 'Enable corepack support for each new installation. This will make fnm call `corepack enable` on every Node.js installation. For more information about corepack see https://nodejs.org/api/corepack.html'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from install" -l resolve-engines -d 'Resolve `engines.node` field in `package.json` whenever a `.node-version` or `.nvmrc` file is not present.
|
||||||
|
Experimental: This feature is subject to change.
|
||||||
|
Note: `engines.node` can be any semver range, with the latest satisfying version being resolved.'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from install" -s h -l help -d 'Print help (see more with \'--help\')'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from use" -l node-dist-mirror -d 'https://nodejs.org/dist/ mirror' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from use" -l fnm-dir -d 'The root directory of fnm installations' -r -F
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from use" -l log-level -d 'The log level of fnm commands' -r -f -a "{quiet ,error ,info }"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from use" -l arch -d 'Override the architecture of the installed Node binary. Defaults to arch of fnm binary' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from use" -l version-file-strategy -d 'A strategy for how to resolve the Node version. Used whenever `fnm use` or `fnm install` is called without a version, or when `--use-on-cd` is configured on evaluation' -r -f -a "{local Use the local version of Node defined within the current directory,recursive Use the version of Node defined within the current directory and all parent directories}"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from use" -l install-if-missing -d 'Install the version if it isn\'t installed yet'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from use" -l silent-if-unchanged -d 'Don\'t output a message identifying the version being used if it will not change due to execution of this command'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from use" -l corepack-enabled -d 'Enable corepack support for each new installation. This will make fnm call `corepack enable` on every Node.js installation. For more information about corepack see https://nodejs.org/api/corepack.html'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from use" -l resolve-engines -d 'Resolve `engines.node` field in `package.json` whenever a `.node-version` or `.nvmrc` file is not present.
|
||||||
|
Experimental: This feature is subject to change.
|
||||||
|
Note: `engines.node` can be any semver range, with the latest satisfying version being resolved.'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from use" -s h -l help -d 'Print help (see more with \'--help\')'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from env" -l shell -d 'The shell syntax to use. Infers when missing' -r -f -a "{bash ,zsh ,fish ,power-shell }"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from env" -l node-dist-mirror -d 'https://nodejs.org/dist/ mirror' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from env" -l fnm-dir -d 'The root directory of fnm installations' -r -F
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from env" -l log-level -d 'The log level of fnm commands' -r -f -a "{quiet ,error ,info }"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from env" -l arch -d 'Override the architecture of the installed Node binary. Defaults to arch of fnm binary' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from env" -l version-file-strategy -d 'A strategy for how to resolve the Node version. Used whenever `fnm use` or `fnm install` is called without a version, or when `--use-on-cd` is configured on evaluation' -r -f -a "{local Use the local version of Node defined within the current directory,recursive Use the version of Node defined within the current directory and all parent directories}"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from env" -l json -d 'Print JSON instead of shell commands'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from env" -l multi -d 'Deprecated. This is the default now'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from env" -l use-on-cd -d 'Print the script to change Node versions every directory change'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from env" -l corepack-enabled -d 'Enable corepack support for each new installation. This will make fnm call `corepack enable` on every Node.js installation. For more information about corepack see https://nodejs.org/api/corepack.html'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from env" -l resolve-engines -d 'Resolve `engines.node` field in `package.json` whenever a `.node-version` or `.nvmrc` file is not present.
|
||||||
|
Experimental: This feature is subject to change.
|
||||||
|
Note: `engines.node` can be any semver range, with the latest satisfying version being resolved.'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from env" -s h -l help -d 'Print help (see more with \'--help\')'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from completions" -l shell -d 'The shell syntax to use. Infers when missing' -r -f -a "{bash ,zsh ,fish ,power-shell }"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from completions" -l node-dist-mirror -d 'https://nodejs.org/dist/ mirror' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from completions" -l fnm-dir -d 'The root directory of fnm installations' -r -F
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from completions" -l log-level -d 'The log level of fnm commands' -r -f -a "{quiet ,error ,info }"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from completions" -l arch -d 'Override the architecture of the installed Node binary. Defaults to arch of fnm binary' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from completions" -l version-file-strategy -d 'A strategy for how to resolve the Node version. Used whenever `fnm use` or `fnm install` is called without a version, or when `--use-on-cd` is configured on evaluation' -r -f -a "{local Use the local version of Node defined within the current directory,recursive Use the version of Node defined within the current directory and all parent directories}"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from completions" -l corepack-enabled -d 'Enable corepack support for each new installation. This will make fnm call `corepack enable` on every Node.js installation. For more information about corepack see https://nodejs.org/api/corepack.html'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from completions" -l resolve-engines -d 'Resolve `engines.node` field in `package.json` whenever a `.node-version` or `.nvmrc` file is not present.
|
||||||
|
Experimental: This feature is subject to change.
|
||||||
|
Note: `engines.node` can be any semver range, with the latest satisfying version being resolved.'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from completions" -s h -l help -d 'Print help (see more with \'--help\')'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from alias" -l node-dist-mirror -d 'https://nodejs.org/dist/ mirror' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from alias" -l fnm-dir -d 'The root directory of fnm installations' -r -F
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from alias" -l log-level -d 'The log level of fnm commands' -r -f -a "{quiet ,error ,info }"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from alias" -l arch -d 'Override the architecture of the installed Node binary. Defaults to arch of fnm binary' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from alias" -l version-file-strategy -d 'A strategy for how to resolve the Node version. Used whenever `fnm use` or `fnm install` is called without a version, or when `--use-on-cd` is configured on evaluation' -r -f -a "{local Use the local version of Node defined within the current directory,recursive Use the version of Node defined within the current directory and all parent directories}"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from alias" -l corepack-enabled -d 'Enable corepack support for each new installation. This will make fnm call `corepack enable` on every Node.js installation. For more information about corepack see https://nodejs.org/api/corepack.html'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from alias" -l resolve-engines -d 'Resolve `engines.node` field in `package.json` whenever a `.node-version` or `.nvmrc` file is not present.
|
||||||
|
Experimental: This feature is subject to change.
|
||||||
|
Note: `engines.node` can be any semver range, with the latest satisfying version being resolved.'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from alias" -s h -l help -d 'Print help (see more with \'--help\')'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from unalias" -l node-dist-mirror -d 'https://nodejs.org/dist/ mirror' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from unalias" -l fnm-dir -d 'The root directory of fnm installations' -r -F
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from unalias" -l log-level -d 'The log level of fnm commands' -r -f -a "{quiet ,error ,info }"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from unalias" -l arch -d 'Override the architecture of the installed Node binary. Defaults to arch of fnm binary' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from unalias" -l version-file-strategy -d 'A strategy for how to resolve the Node version. Used whenever `fnm use` or `fnm install` is called without a version, or when `--use-on-cd` is configured on evaluation' -r -f -a "{local Use the local version of Node defined within the current directory,recursive Use the version of Node defined within the current directory and all parent directories}"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from unalias" -l corepack-enabled -d 'Enable corepack support for each new installation. This will make fnm call `corepack enable` on every Node.js installation. For more information about corepack see https://nodejs.org/api/corepack.html'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from unalias" -l resolve-engines -d 'Resolve `engines.node` field in `package.json` whenever a `.node-version` or `.nvmrc` file is not present.
|
||||||
|
Experimental: This feature is subject to change.
|
||||||
|
Note: `engines.node` can be any semver range, with the latest satisfying version being resolved.'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from unalias" -s h -l help -d 'Print help (see more with \'--help\')'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from default" -l node-dist-mirror -d 'https://nodejs.org/dist/ mirror' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from default" -l fnm-dir -d 'The root directory of fnm installations' -r -F
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from default" -l log-level -d 'The log level of fnm commands' -r -f -a "{quiet ,error ,info }"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from default" -l arch -d 'Override the architecture of the installed Node binary. Defaults to arch of fnm binary' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from default" -l version-file-strategy -d 'A strategy for how to resolve the Node version. Used whenever `fnm use` or `fnm install` is called without a version, or when `--use-on-cd` is configured on evaluation' -r -f -a "{local Use the local version of Node defined within the current directory,recursive Use the version of Node defined within the current directory and all parent directories}"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from default" -l corepack-enabled -d 'Enable corepack support for each new installation. This will make fnm call `corepack enable` on every Node.js installation. For more information about corepack see https://nodejs.org/api/corepack.html'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from default" -l resolve-engines -d 'Resolve `engines.node` field in `package.json` whenever a `.node-version` or `.nvmrc` file is not present.
|
||||||
|
Experimental: This feature is subject to change.
|
||||||
|
Note: `engines.node` can be any semver range, with the latest satisfying version being resolved.'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from default" -s h -l help -d 'Print help (see more with \'--help\')'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from current" -l node-dist-mirror -d 'https://nodejs.org/dist/ mirror' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from current" -l fnm-dir -d 'The root directory of fnm installations' -r -F
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from current" -l log-level -d 'The log level of fnm commands' -r -f -a "{quiet ,error ,info }"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from current" -l arch -d 'Override the architecture of the installed Node binary. Defaults to arch of fnm binary' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from current" -l version-file-strategy -d 'A strategy for how to resolve the Node version. Used whenever `fnm use` or `fnm install` is called without a version, or when `--use-on-cd` is configured on evaluation' -r -f -a "{local Use the local version of Node defined within the current directory,recursive Use the version of Node defined within the current directory and all parent directories}"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from current" -l corepack-enabled -d 'Enable corepack support for each new installation. This will make fnm call `corepack enable` on every Node.js installation. For more information about corepack see https://nodejs.org/api/corepack.html'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from current" -l resolve-engines -d 'Resolve `engines.node` field in `package.json` whenever a `.node-version` or `.nvmrc` file is not present.
|
||||||
|
Experimental: This feature is subject to change.
|
||||||
|
Note: `engines.node` can be any semver range, with the latest satisfying version being resolved.'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from current" -s h -l help -d 'Print help (see more with \'--help\')'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from exec" -l using -d 'Either an explicit version, or a filename with the version written in it' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from exec" -l node-dist-mirror -d 'https://nodejs.org/dist/ mirror' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from exec" -l fnm-dir -d 'The root directory of fnm installations' -r -F
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from exec" -l log-level -d 'The log level of fnm commands' -r -f -a "{quiet ,error ,info }"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from exec" -l arch -d 'Override the architecture of the installed Node binary. Defaults to arch of fnm binary' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from exec" -l version-file-strategy -d 'A strategy for how to resolve the Node version. Used whenever `fnm use` or `fnm install` is called without a version, or when `--use-on-cd` is configured on evaluation' -r -f -a "{local Use the local version of Node defined within the current directory,recursive Use the version of Node defined within the current directory and all parent directories}"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from exec" -l using-file -d 'Deprecated. This is the default now'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from exec" -l corepack-enabled -d 'Enable corepack support for each new installation. This will make fnm call `corepack enable` on every Node.js installation. For more information about corepack see https://nodejs.org/api/corepack.html'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from exec" -l resolve-engines -d 'Resolve `engines.node` field in `package.json` whenever a `.node-version` or `.nvmrc` file is not present.
|
||||||
|
Experimental: This feature is subject to change.
|
||||||
|
Note: `engines.node` can be any semver range, with the latest satisfying version being resolved.'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from exec" -s h -l help -d 'Print help (see more with \'--help\')'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from uninstall" -l node-dist-mirror -d 'https://nodejs.org/dist/ mirror' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from uninstall" -l fnm-dir -d 'The root directory of fnm installations' -r -F
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from uninstall" -l log-level -d 'The log level of fnm commands' -r -f -a "{quiet ,error ,info }"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from uninstall" -l arch -d 'Override the architecture of the installed Node binary. Defaults to arch of fnm binary' -r
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from uninstall" -l version-file-strategy -d 'A strategy for how to resolve the Node version. Used whenever `fnm use` or `fnm install` is called without a version, or when `--use-on-cd` is configured on evaluation' -r -f -a "{local Use the local version of Node defined within the current directory,recursive Use the version of Node defined within the current directory and all parent directories}"
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from uninstall" -l corepack-enabled -d 'Enable corepack support for each new installation. This will make fnm call `corepack enable` on every Node.js installation. For more information about corepack see https://nodejs.org/api/corepack.html'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from uninstall" -l resolve-engines -d 'Resolve `engines.node` field in `package.json` whenever a `.node-version` or `.nvmrc` file is not present.
|
||||||
|
Experimental: This feature is subject to change.
|
||||||
|
Note: `engines.node` can be any semver range, with the latest satisfying version being resolved.'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from uninstall" -s h -l help -d 'Print help (see more with \'--help\')'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from list-remote; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from env; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from unalias; and not __fish_seen_subcommand_from default; and not __fish_seen_subcommand_from current; and not __fish_seen_subcommand_from exec; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "list-remote" -d 'List all remote Node.js versions'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from list-remote; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from env; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from unalias; and not __fish_seen_subcommand_from default; and not __fish_seen_subcommand_from current; and not __fish_seen_subcommand_from exec; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "list" -d 'List all locally installed Node.js versions'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from list-remote; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from env; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from unalias; and not __fish_seen_subcommand_from default; and not __fish_seen_subcommand_from current; and not __fish_seen_subcommand_from exec; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "install" -d 'Install a new Node.js version'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from list-remote; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from env; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from unalias; and not __fish_seen_subcommand_from default; and not __fish_seen_subcommand_from current; and not __fish_seen_subcommand_from exec; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "use" -d 'Change Node.js version'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from list-remote; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from env; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from unalias; and not __fish_seen_subcommand_from default; and not __fish_seen_subcommand_from current; and not __fish_seen_subcommand_from exec; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "env" -d 'Print and set up required environment variables for fnm'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from list-remote; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from env; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from unalias; and not __fish_seen_subcommand_from default; and not __fish_seen_subcommand_from current; and not __fish_seen_subcommand_from exec; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "completions" -d 'Print shell completions to stdout'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from list-remote; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from env; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from unalias; and not __fish_seen_subcommand_from default; and not __fish_seen_subcommand_from current; and not __fish_seen_subcommand_from exec; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "alias" -d 'Alias a version to a common name'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from list-remote; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from env; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from unalias; and not __fish_seen_subcommand_from default; and not __fish_seen_subcommand_from current; and not __fish_seen_subcommand_from exec; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "unalias" -d 'Remove an alias definition'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from list-remote; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from env; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from unalias; and not __fish_seen_subcommand_from default; and not __fish_seen_subcommand_from current; and not __fish_seen_subcommand_from exec; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "default" -d 'Set a version as the default version'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from list-remote; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from env; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from unalias; and not __fish_seen_subcommand_from default; and not __fish_seen_subcommand_from current; and not __fish_seen_subcommand_from exec; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "current" -d 'Print the current Node.js version'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from list-remote; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from env; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from unalias; and not __fish_seen_subcommand_from default; and not __fish_seen_subcommand_from current; and not __fish_seen_subcommand_from exec; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "exec" -d 'Run a command within fnm context'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from list-remote; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from env; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from unalias; and not __fish_seen_subcommand_from default; and not __fish_seen_subcommand_from current; and not __fish_seen_subcommand_from exec; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "uninstall" -d 'Uninstall a Node.js version'
|
||||||
|
complete -c fnm -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from list-remote; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from env; and not __fish_seen_subcommand_from completions; and not __fish_seen_subcommand_from alias; and not __fish_seen_subcommand_from unalias; and not __fish_seen_subcommand_from default; and not __fish_seen_subcommand_from current; and not __fish_seen_subcommand_from exec; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
|
||||||
243
fish/completions/sdk.fish
Normal file
243
fish/completions/sdk.fish
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
# Defines autocompletion for SDKMAN!
|
||||||
|
|
||||||
|
# Copyright (c) 2018-2023 Raphael Reitzig
|
||||||
|
# MIT License (MIT)
|
||||||
|
# https://github.com/reitzig/sdkman-for-fish
|
||||||
|
|
||||||
|
# Guard: SDKMAN! needs to be installed
|
||||||
|
if not test -f "$SDKMAN_DIR/bin/sdkman-init.sh"
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# # # # # #
|
||||||
|
# Completion trigger predicates
|
||||||
|
# # # # # #
|
||||||
|
|
||||||
|
# Test if there is no command
|
||||||
|
function __fish_sdkman_no_command
|
||||||
|
set cmd (commandline -opc)
|
||||||
|
|
||||||
|
if [ (count $cmd) -eq 1 ]
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# Test if the main command matches one of the parameters
|
||||||
|
function __fish_sdkman_using_command
|
||||||
|
set cmd (commandline -opc)
|
||||||
|
|
||||||
|
if [ (count $cmd) -eq 2 ]
|
||||||
|
if contains $cmd[2] $argv
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish_sdkman_specifying_candidate
|
||||||
|
set cmd (commandline -opc)
|
||||||
|
|
||||||
|
if [ (count $cmd) -eq 3 ] # currently, sdk does not support multiple versions
|
||||||
|
if contains $cmd[2] $argv
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish_sdkman_command_has_enough_parameters
|
||||||
|
set cmd (commandline -opc)
|
||||||
|
|
||||||
|
if [ (count $cmd) -ge (math $argv[1] + 2) ]; and contains $cmd[2] $argv[2..-1]
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
# # # # # #
|
||||||
|
# Data collectors
|
||||||
|
# # # # # #
|
||||||
|
|
||||||
|
function __fish_sdkman_candidates
|
||||||
|
cat "$SDKMAN_DIR"/var/candidates | string replace -a -r ',' '\n'
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish_sdkman_candidates_with_versions
|
||||||
|
set regexpHome (string replace -a '/' '\\/' "$HOME/")
|
||||||
|
|
||||||
|
find "$SDKMAN_DIR"/candidates/ -mindepth 2 -maxdepth 2 -name '*current' \
|
||||||
|
| awk -F '/' '{ print $(NF-1) }' \
|
||||||
|
| sort -u
|
||||||
|
end
|
||||||
|
|
||||||
|
function __fish_sdkman_installed_versions
|
||||||
|
set cmd (commandline -opc)
|
||||||
|
if [ -d "$SDKMAN_DIR"/candidates/$cmd[3]/current ]
|
||||||
|
ls -v1 "$SDKMAN_DIR"/candidates/$cmd[3] | grep -v current
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# # # # # #
|
||||||
|
# Completion specification
|
||||||
|
# # # # # #
|
||||||
|
|
||||||
|
# install
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'i install' \
|
||||||
|
-d 'Install new version'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command i install' \
|
||||||
|
-a "(__fish_sdkman_candidates)"
|
||||||
|
# TODO complete available versions --> issue #4
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_specifying_candidate i install' \
|
||||||
|
-a 'a.b.c' \
|
||||||
|
-d "version list unavailable"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_specifying_candidate i install' \
|
||||||
|
-a 'x.y.z' \
|
||||||
|
-d "Specify path to install custom version."
|
||||||
|
# Implicit: complete files as fourth parameter
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 3 i install'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# uninstall
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'rm uninstall' -d 'Uninstall version'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command rm uninstall' \
|
||||||
|
-a "(__fish_sdkman_candidates_with_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_specifying_candidate rm uninstall' \
|
||||||
|
-a "(__fish_sdkman_installed_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 rm uninstall'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# list
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'ls list' \
|
||||||
|
-d 'List versions'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command ls list' \
|
||||||
|
-a "(__fish_sdkman_candidates)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 ls list'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# use
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'u use' \
|
||||||
|
-d 'Use specific version'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command u use' \
|
||||||
|
-a "(__fish_sdkman_candidates_with_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_specifying_candidate u use' \
|
||||||
|
-a "(__fish_sdkman_installed_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 u use'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# default
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'd default' \
|
||||||
|
-d 'Set default version'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command d default' \
|
||||||
|
-a "(__fish_sdkman_candidates_with_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_specifying_candidate d default' \
|
||||||
|
-a "(__fish_sdkman_installed_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 d default'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# current
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'c current' \
|
||||||
|
-d 'Display current version'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command c current' \
|
||||||
|
-a "(__fish_sdkman_candidates)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 c current'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# upgrade
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'ug upgrade' \
|
||||||
|
-d 'Display what is outdated'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command ug upgrade' \
|
||||||
|
-a "(__fish_sdkman_candidates_with_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 ug upgrade'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# version
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'v version' \
|
||||||
|
-d 'Display version'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 v version'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# help
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'help' \
|
||||||
|
-d 'Display help message'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 h help'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# offline
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'offline' \
|
||||||
|
-d 'Set offline status'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command offline' \
|
||||||
|
-a 'enable' \
|
||||||
|
-d 'Make sdk work while offline'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command offline' \
|
||||||
|
-a 'disable' \
|
||||||
|
-d 'Turn on all features'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 offline'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# selfupdate
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'selfupdate' \
|
||||||
|
-d 'Update sdk'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command selfupdate' \
|
||||||
|
-a 'force' \
|
||||||
|
-d 'Force re-install of current version'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 selfupdate'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# update
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'update' \
|
||||||
|
-d 'Reload the candidate list'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 0 update'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# flush
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'flush' \
|
||||||
|
-d 'Clear out archives and temporary storage folders'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command flush' \
|
||||||
|
-a 'temp' \
|
||||||
|
-d 'Clear out staging work folder'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command flush' \
|
||||||
|
-a 'version' \
|
||||||
|
-d 'Flush version file'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 flush'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# env
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'e env' \
|
||||||
|
-d 'Load environment from .sdkmanrc file'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command e env' \
|
||||||
|
-a 'init' \
|
||||||
|
-d 'Initialize .sdkmanrc file'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command e env' \
|
||||||
|
-a 'install' \
|
||||||
|
-d 'Install all candidate versions listed in .sdkmanrc'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command e env' \
|
||||||
|
-a 'clear' \
|
||||||
|
-d 'Unload currently loaded environment'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 1 e env'
|
||||||
|
# block
|
||||||
|
|
||||||
|
# home
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_no_command' \
|
||||||
|
-a 'h home' \
|
||||||
|
-d 'Show installation folder of given candidate'
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_using_command h home' \
|
||||||
|
-a "(__fish_sdkman_candidates_with_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_specifying_candidate h home' \
|
||||||
|
-a "(__fish_sdkman_installed_versions)"
|
||||||
|
complete -c sdk -f -n '__fish_sdkman_command_has_enough_parameters 2 h home'
|
||||||
|
# block
|
||||||
335
fish/conf.d/done.fish
Normal file
335
fish/conf.d/done.fish
Normal file
@@ -0,0 +1,335 @@
|
|||||||
|
# MIT License
|
||||||
|
|
||||||
|
# Copyright (c) 2016 Francisco Lourenço & Daniel Wehner
|
||||||
|
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
|
||||||
|
if not status is-interactive
|
||||||
|
exit
|
||||||
|
end
|
||||||
|
|
||||||
|
set -g __done_version 1.19.2
|
||||||
|
|
||||||
|
function __done_run_powershell_script
|
||||||
|
set -l powershell_exe (command --search "powershell.exe")
|
||||||
|
|
||||||
|
if test $status -ne 0
|
||||||
|
and command --search wslvar
|
||||||
|
|
||||||
|
set -l powershell_exe (wslpath (wslvar windir)/System32/WindowsPowerShell/v1.0/powershell.exe)
|
||||||
|
end
|
||||||
|
|
||||||
|
if string length --quiet "$powershell_exe"
|
||||||
|
and test -x "$powershell_exe"
|
||||||
|
|
||||||
|
set cmd (string escape $argv)
|
||||||
|
|
||||||
|
eval "$powershell_exe -Command $cmd"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __done_windows_notification -a title -a message
|
||||||
|
if test "$__done_notify_sound" -eq 1
|
||||||
|
set soundopt "<audio silent=\"false\" src=\"ms-winsoundevent:Notification.Default\" />"
|
||||||
|
else
|
||||||
|
set soundopt "<audio silent=\"true\" />"
|
||||||
|
end
|
||||||
|
|
||||||
|
__done_run_powershell_script "
|
||||||
|
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
|
||||||
|
[Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
|
||||||
|
|
||||||
|
\$toast_xml_source = @\"
|
||||||
|
<toast>
|
||||||
|
$soundopt
|
||||||
|
<visual>
|
||||||
|
<binding template=\"ToastText02\">
|
||||||
|
<text id=\"1\">$title</text>
|
||||||
|
<text id=\"2\">$message</text>
|
||||||
|
</binding>
|
||||||
|
</visual>
|
||||||
|
</toast>
|
||||||
|
\"@
|
||||||
|
|
||||||
|
\$toast_xml = New-Object Windows.Data.Xml.Dom.XmlDocument
|
||||||
|
\$toast_xml.loadXml(\$toast_xml_source)
|
||||||
|
|
||||||
|
\$toast = New-Object Windows.UI.Notifications.ToastNotification \$toast_xml
|
||||||
|
|
||||||
|
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier(\"fish\").Show(\$toast)
|
||||||
|
"
|
||||||
|
end
|
||||||
|
|
||||||
|
function __done_get_focused_window_id
|
||||||
|
if type -q lsappinfo
|
||||||
|
lsappinfo info -only bundleID (lsappinfo front | string replace 'ASN:0x0-' '0x') | cut -d '"' -f4
|
||||||
|
else if test -n "$SWAYSOCK"
|
||||||
|
and type -q jq
|
||||||
|
swaymsg --type get_tree | jq '.. | objects | select(.focused == true) | .id'
|
||||||
|
else if test -n "$HYPRLAND_INSTANCE_SIGNATURE"
|
||||||
|
hyprctl activewindow | awk 'NR==1 {print $2}'
|
||||||
|
else if begin
|
||||||
|
test "$XDG_SESSION_DESKTOP" = gnome; and type -q gdbus
|
||||||
|
end
|
||||||
|
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'global.display.focus_window.get_id()'
|
||||||
|
else if type -q xprop
|
||||||
|
and test -n "$DISPLAY"
|
||||||
|
# Test that the X server at $DISPLAY is running
|
||||||
|
and xprop -grammar >/dev/null 2>&1
|
||||||
|
xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2
|
||||||
|
else if uname -a | string match --quiet --ignore-case --regex microsoft
|
||||||
|
__done_run_powershell_script '
|
||||||
|
Add-Type @"
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
public class WindowsCompat {
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
public static extern IntPtr GetForegroundWindow();
|
||||||
|
}
|
||||||
|
"@
|
||||||
|
[WindowsCompat]::GetForegroundWindow()
|
||||||
|
'
|
||||||
|
else if set -q __done_allow_nongraphical
|
||||||
|
echo 12345 # dummy value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __done_is_tmux_window_active
|
||||||
|
set -q fish_pid; or set -l fish_pid %self
|
||||||
|
|
||||||
|
# find the outermost process within tmux
|
||||||
|
# ppid != "tmux" -> pid = ppid
|
||||||
|
# ppid == "tmux" -> break
|
||||||
|
set tmux_fish_pid $fish_pid
|
||||||
|
while set tmux_fish_ppid (ps -o ppid= -p $tmux_fish_pid | string trim)
|
||||||
|
# remove leading hyphen so that basename does not treat it as an argument (e.g. -fish), and return only
|
||||||
|
# the actual command and not its arguments so that basename finds the correct command name.
|
||||||
|
# (e.g. '/usr/bin/tmux' from command '/usr/bin/tmux new-session -c /some/start/dir')
|
||||||
|
and ! string match -q "tmux*" (basename (ps -o command= -p $tmux_fish_ppid | string replace -r '^-' '' | string split ' ')[1])
|
||||||
|
set tmux_fish_pid $tmux_fish_ppid
|
||||||
|
end
|
||||||
|
|
||||||
|
# tmux session attached and window is active -> no notification
|
||||||
|
# all other combinations -> send notification
|
||||||
|
tmux list-panes -a -F "#{session_attached} #{window_active} #{pane_pid}" | string match -q "1 1 $tmux_fish_pid"
|
||||||
|
end
|
||||||
|
|
||||||
|
function __done_is_screen_window_active
|
||||||
|
string match --quiet --regex "$STY\s+\(Attached" (screen -ls)
|
||||||
|
end
|
||||||
|
|
||||||
|
function __done_is_process_window_focused
|
||||||
|
# Return false if the window is not focused
|
||||||
|
|
||||||
|
if set -q __done_allow_nongraphical
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if set -q __done_kitty_remote_control
|
||||||
|
kitty @ --password="$__done_kitty_remote_control_password" ls | jq -e ".[].tabs[] | select(any(.windows[]; .is_self)) | .is_focused" >/dev/null
|
||||||
|
return $status
|
||||||
|
end
|
||||||
|
|
||||||
|
set __done_focused_window_id (__done_get_focused_window_id)
|
||||||
|
if test "$__done_sway_ignore_visible" -eq 1
|
||||||
|
and test -n "$SWAYSOCK"
|
||||||
|
string match --quiet --regex "^true" (swaymsg -t get_tree | jq ".. | objects | select(.id == "$__done_initial_window_id") | .visible")
|
||||||
|
return $status
|
||||||
|
else if test -n "$HYPRLAND_INSTANCE_SIGNATURE"
|
||||||
|
and test $__done_initial_window_id = (hyprctl activewindow | awk 'NR==1 {print $2}')
|
||||||
|
return $status
|
||||||
|
else if test "$__done_initial_window_id" != "$__done_focused_window_id"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
# If inside a tmux session, check if the tmux window is focused
|
||||||
|
if type -q tmux
|
||||||
|
and test -n "$TMUX"
|
||||||
|
__done_is_tmux_window_active
|
||||||
|
return $status
|
||||||
|
end
|
||||||
|
|
||||||
|
# If inside a screen session, check if the screen window is focused
|
||||||
|
if type -q screen
|
||||||
|
and test -n "$STY"
|
||||||
|
__done_is_screen_window_active
|
||||||
|
return $status
|
||||||
|
end
|
||||||
|
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function __done_humanize_duration -a milliseconds
|
||||||
|
set -l seconds (math --scale=0 "$milliseconds/1000" % 60)
|
||||||
|
set -l minutes (math --scale=0 "$milliseconds/60000" % 60)
|
||||||
|
set -l hours (math --scale=0 "$milliseconds/3600000")
|
||||||
|
|
||||||
|
if test $hours -gt 0
|
||||||
|
printf '%s' $hours'h '
|
||||||
|
end
|
||||||
|
if test $minutes -gt 0
|
||||||
|
printf '%s' $minutes'm '
|
||||||
|
end
|
||||||
|
if test $seconds -gt 0
|
||||||
|
printf '%s' $seconds's'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# verify that the system has graphical capabilities before initializing
|
||||||
|
if test -z "$SSH_CLIENT" # not over ssh
|
||||||
|
and count (__done_get_focused_window_id) >/dev/null # is able to get window id
|
||||||
|
set __done_enabled
|
||||||
|
end
|
||||||
|
|
||||||
|
if set -q __done_allow_nongraphical
|
||||||
|
and set -q __done_notification_command
|
||||||
|
set __done_enabled
|
||||||
|
end
|
||||||
|
|
||||||
|
if set -q __done_enabled
|
||||||
|
set -g __done_initial_window_id ''
|
||||||
|
set -q __done_min_cmd_duration; or set -g __done_min_cmd_duration 5000
|
||||||
|
set -q __done_exclude; or set -g __done_exclude '^git (?!push|pull|fetch)'
|
||||||
|
set -q __done_notify_sound; or set -g __done_notify_sound 0
|
||||||
|
set -q __done_sway_ignore_visible; or set -g __done_sway_ignore_visible 0
|
||||||
|
set -q __done_tmux_pane_format; or set -g __done_tmux_pane_format '[#{window_index}]'
|
||||||
|
set -q __done_notification_duration; or set -g __done_notification_duration 3000
|
||||||
|
|
||||||
|
function __done_started --on-event fish_preexec
|
||||||
|
set __done_initial_window_id (__done_get_focused_window_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
function __done_ended --on-event fish_postexec
|
||||||
|
set -l exit_status $status
|
||||||
|
|
||||||
|
# backwards compatibility for fish < v3.0
|
||||||
|
set -q cmd_duration; or set -l cmd_duration $CMD_DURATION
|
||||||
|
|
||||||
|
if test $cmd_duration
|
||||||
|
and test $cmd_duration -gt $__done_min_cmd_duration # longer than notify_duration
|
||||||
|
and not __done_is_process_window_focused # process pane or window not focused
|
||||||
|
|
||||||
|
# don't notify if command matches exclude list
|
||||||
|
for pattern in $__done_exclude
|
||||||
|
if string match -qr $pattern $argv[1]
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Store duration of last command
|
||||||
|
set -l humanized_duration (__done_humanize_duration "$cmd_duration")
|
||||||
|
|
||||||
|
set -l title "Done in $humanized_duration"
|
||||||
|
set -l wd (string replace --regex "^$HOME" "~" (pwd))
|
||||||
|
set -l message "$wd/ $argv[1]"
|
||||||
|
set -l sender $__done_initial_window_id
|
||||||
|
|
||||||
|
if test $exit_status -ne 0
|
||||||
|
set title "Failed ($exit_status) after $humanized_duration"
|
||||||
|
end
|
||||||
|
|
||||||
|
if test -n "$TMUX_PANE"
|
||||||
|
set message (tmux lsw -F"$__done_tmux_pane_format" -f '#{==:#{pane_id},'$TMUX_PANE'}')" $message"
|
||||||
|
end
|
||||||
|
|
||||||
|
if set -q __done_notification_command
|
||||||
|
eval $__done_notification_command
|
||||||
|
if test "$__done_notify_sound" -eq 1
|
||||||
|
echo -e "\a" # bell sound
|
||||||
|
end
|
||||||
|
else if set -q KITTY_WINDOW_ID
|
||||||
|
printf "\x1b]99;i=done:d=0;$title\x1b\\"
|
||||||
|
printf "\x1b]99;i=done:d=1:p=body;$message\x1b\\"
|
||||||
|
else if type -q terminal-notifier # https://github.com/julienXX/terminal-notifier
|
||||||
|
if test "$__done_notify_sound" -eq 1
|
||||||
|
# pipe message into terminal-notifier to avoid escaping issues (https://github.com/julienXX/terminal-notifier/issues/134). fixes #140
|
||||||
|
echo "$message" | terminal-notifier -title "$title" -sender "$__done_initial_window_id" -sound default
|
||||||
|
else
|
||||||
|
echo "$message" | terminal-notifier -title "$title" -sender "$__done_initial_window_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
else if type -q osascript # AppleScript
|
||||||
|
# escape double quotes that might exist in the message and break osascript. fixes #133
|
||||||
|
set -l message (string replace --all '"' '\"' "$message")
|
||||||
|
set -l title (string replace --all '"' '\"' "$title")
|
||||||
|
|
||||||
|
osascript -e "display notification \"$message\" with title \"$title\""
|
||||||
|
if test "$__done_notify_sound" -eq 1
|
||||||
|
osascript -e "display notification \"$message\" with title \"$title\" sound name \"Glass\""
|
||||||
|
else
|
||||||
|
osascript -e "display notification \"$message\" with title \"$title\""
|
||||||
|
end
|
||||||
|
|
||||||
|
else if type -q notify-send # Linux notify-send
|
||||||
|
# set urgency to normal
|
||||||
|
set -l urgency normal
|
||||||
|
|
||||||
|
# use user-defined urgency if set
|
||||||
|
if set -q __done_notification_urgency_level
|
||||||
|
set urgency "$__done_notification_urgency_level"
|
||||||
|
end
|
||||||
|
# override user-defined urgency level if non-zero exitstatus
|
||||||
|
if test $exit_status -ne 0
|
||||||
|
set urgency critical
|
||||||
|
if set -q __done_notification_urgency_level_failure
|
||||||
|
set urgency "$__done_notification_urgency_level_failure"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
notify-send --hint=int:transient:1 --urgency=$urgency --icon=utilities-terminal --app-name=fish --expire-time=$__done_notification_duration "$title" "$message"
|
||||||
|
|
||||||
|
if test "$__done_notify_sound" -eq 1
|
||||||
|
echo -e "\a" # bell sound
|
||||||
|
end
|
||||||
|
|
||||||
|
else if type -q notify-desktop # Linux notify-desktop
|
||||||
|
set -l urgency
|
||||||
|
if test $exit_status -ne 0
|
||||||
|
set urgency "--urgency=critical"
|
||||||
|
end
|
||||||
|
notify-desktop $urgency --icon=utilities-terminal --app-name=fish "$title" "$message"
|
||||||
|
if test "$__done_notify_sound" -eq 1
|
||||||
|
echo -e "\a" # bell sound
|
||||||
|
end
|
||||||
|
|
||||||
|
else if uname -a | string match --quiet --ignore-case --regex microsoft
|
||||||
|
__done_windows_notification "$title" "$message"
|
||||||
|
|
||||||
|
else # anything else
|
||||||
|
echo -e "\a" # bell sound
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __done_uninstall -e done_uninstall
|
||||||
|
# Erase all __done_* functions
|
||||||
|
functions -e __done_ended
|
||||||
|
functions -e __done_started
|
||||||
|
functions -e __done_get_focused_window_id
|
||||||
|
functions -e __done_is_tmux_window_active
|
||||||
|
functions -e __done_is_screen_window_active
|
||||||
|
functions -e __done_is_process_window_focused
|
||||||
|
functions -e __done_windows_notification
|
||||||
|
functions -e __done_run_powershell_script
|
||||||
|
functions -e __done_humanize_duration
|
||||||
|
|
||||||
|
# Erase __done variables
|
||||||
|
set -e __done_version
|
||||||
|
end
|
||||||
3
fish/conf.d/fnm.fish
Normal file
3
fish/conf.d/fnm.fish
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# fnm
|
||||||
|
set PATH "/home/fscotto/.local/share/fnm" $PATH
|
||||||
|
fnm env | source
|
||||||
111
fish/conf.d/sdk.fish
Normal file
111
fish/conf.d/sdk.fish
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
#!/usr/bin/fish
|
||||||
|
|
||||||
|
# Makes command and binaries from SDKMAN! available in fish.
|
||||||
|
# Delegates to bash for the `sdk` command.
|
||||||
|
|
||||||
|
# Copyright (c) 2018-2023 Raphael Reitzig
|
||||||
|
# MIT License (MIT)
|
||||||
|
# https://github.com/reitzig/sdkman-for-fish
|
||||||
|
|
||||||
|
# Account for custom install locations
|
||||||
|
if set -q __sdkman_custom_dir
|
||||||
|
set -gx SDKMAN_DIR "$__sdkman_custom_dir"
|
||||||
|
end
|
||||||
|
# Guard: SDKMAN! needs to be installed
|
||||||
|
if set -q SDKMAN_DIR; and not test -f "$SDKMAN_DIR/bin/sdkman-init.sh"
|
||||||
|
echo "WARNING: SDKMAN! installation path set to $SDKMAN_DIR, but no installation found there"
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# Unless overridden, use the default location:
|
||||||
|
if not set -q SDKMAN_DIR
|
||||||
|
set -gx SDKMAN_DIR "$HOME/.sdkman"
|
||||||
|
end
|
||||||
|
|
||||||
|
set __fish_sdkman_init "$SDKMAN_DIR/bin/sdkman-init.sh"
|
||||||
|
|
||||||
|
# Guard: SDKMAN! needs to be installed
|
||||||
|
if not test -f "$__fish_sdkman_init"
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
|
||||||
|
# Copied from https://github.com/jorgebucaran/fisher/blob/main/functions/fisher.fish to be consistent:
|
||||||
|
set --query fisher_path || set --local fisher_path $__fish_config_dir
|
||||||
|
set __fish_sdkman_noexport_init "$fisher_path/functions/__sdkman-noexport-init.sh"
|
||||||
|
|
||||||
|
# Hack for issue #19:
|
||||||
|
# Create version of sdkman-init that doesn't export any environment variables.
|
||||||
|
# Refresh if sdkman-init changed.
|
||||||
|
if begin not test -f "$__fish_sdkman_noexport_init";
|
||||||
|
or env test "$__fish_sdkman_init" -nt "$__fish_sdkman_noexport_init"
|
||||||
|
end
|
||||||
|
mkdir -p (dirname $__fish_sdkman_noexport_init)
|
||||||
|
sed -E -e 's/^(\s*).*(export|to_path).*$/\1:/g' "$__fish_sdkman_init" \
|
||||||
|
> "$__fish_sdkman_noexport_init"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Runs the given command in bash, capturing some side effects
|
||||||
|
# and repeating them on the current fish shell.
|
||||||
|
# Returns the same status code as the given command.
|
||||||
|
function __fish_sdkman_run_in_bash
|
||||||
|
# We need to leave stdin and stdout of sdk free for user interaction.
|
||||||
|
# So, pipe relevant environment variables (which might have changed)
|
||||||
|
# through a file.
|
||||||
|
# But since now getting the exit code of sdk itself is a hassle,
|
||||||
|
# pipe it as well.
|
||||||
|
#
|
||||||
|
# TODO: Can somebody get this to work without the overhead of a file?
|
||||||
|
set pipe (mktemp)
|
||||||
|
bash -c "$argv[1];
|
||||||
|
echo -e \"\$?\" > $pipe;
|
||||||
|
env | grep -e '^SDKMAN_\|^PATH' >> $pipe;
|
||||||
|
env | grep -i -E \"^(`echo \${SDKMAN_CANDIDATES_CSV} | sed 's/,/|/g'`)_HOME\" >> $pipe;
|
||||||
|
echo \"SDKMAN_OFFLINE_MODE=\${SDKMAN_OFFLINE_MODE}\" >> $pipe;
|
||||||
|
echo \"SDKMAN_ENV=\${SDKMAN_ENV}\" >> $pipe" # it's not an environment variable!
|
||||||
|
set bashDump (cat $pipe; rm $pipe)
|
||||||
|
|
||||||
|
set sdkStatus $bashDump[1]
|
||||||
|
set bashEnv $bashDump[2..-1]
|
||||||
|
|
||||||
|
# If SDKMAN! succeeded, copy relevant environment variables
|
||||||
|
# to the current shell (they might have changed)
|
||||||
|
if [ $sdkStatus = 0 ]
|
||||||
|
for line in $bashEnv
|
||||||
|
set parts (string split "=" $line)
|
||||||
|
set var $parts[1]
|
||||||
|
set value (string join "=" $parts[2..-1])
|
||||||
|
|
||||||
|
switch "$var"
|
||||||
|
case "PATH"
|
||||||
|
# Special treatment: need fish list instead
|
||||||
|
# of colon-separated list.
|
||||||
|
set value (string split : "$value")
|
||||||
|
end
|
||||||
|
|
||||||
|
if test -n value
|
||||||
|
set -gx $var $value
|
||||||
|
# Note: This makes SDKMAN_{OFFLINE_MODE,ENV} environment variables.
|
||||||
|
# That gives it the behaviour we _want_!
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return $sdkStatus
|
||||||
|
end
|
||||||
|
|
||||||
|
# If this is a subshell of a(n initialized) fish owned by the same user,
|
||||||
|
# no initialization necessary.
|
||||||
|
# Otherwise:
|
||||||
|
if not set -q SDKMAN_CANDIDATES_DIR; or test (ls -ld "$SDKMAN_CANDIDATES_DIR" | awk '{print $3}') != (whoami)
|
||||||
|
__fish_sdkman_run_in_bash "source $__fish_sdkman_init"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Set up auto_env
|
||||||
|
if grep -q "^sdkman_auto_env=true" "$SDKMAN_DIR/etc/config"
|
||||||
|
function __fish_sdkman_autoenv --on-variable PWD
|
||||||
|
# Run the (modified) init script, which performs the checks and calls for us!
|
||||||
|
__fish_sdkman_run_in_bash "source \"$__fish_sdkman_noexport_init\""
|
||||||
|
|
||||||
|
set -x SDKMAN_OLD_PWD "$PWD" # needed by the Bash implementation
|
||||||
|
end
|
||||||
|
end
|
||||||
132
fish/config.fish
Normal file
132
fish/config.fish
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
## Set values
|
||||||
|
# Hide welcome message & ensure we are reporting fish as shell
|
||||||
|
set fish_greeting
|
||||||
|
set VIRTUAL_ENV_DISABLE_PROMPT "1"
|
||||||
|
set -xU MANPAGER "sh -c 'col -bx | batcat -l man -p'"
|
||||||
|
set -xU MANROFFOPT "-c"
|
||||||
|
set -x SHELL /usr/bin/fish
|
||||||
|
|
||||||
|
## Export variable need for qt-theme
|
||||||
|
if type "qtile" >> /dev/null 2>&1
|
||||||
|
set -x QT_QPA_PLATFORMTHEME "qt5ct"
|
||||||
|
end
|
||||||
|
|
||||||
|
# Set settings for https://github.com/franciscolourenco/done
|
||||||
|
set -U __done_min_cmd_duration 10000
|
||||||
|
set -U __done_notification_urgency_level low
|
||||||
|
|
||||||
|
|
||||||
|
## Environment setup
|
||||||
|
# Apply .profile: use this to put fish compatible .profile stuff in
|
||||||
|
if test -f ~/.fish_profile
|
||||||
|
source ~/.fish_profile
|
||||||
|
end
|
||||||
|
|
||||||
|
# Add ~/.local/bin to PATH
|
||||||
|
if test -d ~/.local/bin
|
||||||
|
if not contains -- ~/.local/bin $PATH
|
||||||
|
set -p PATH ~/.local/bin
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
## Starship prompt
|
||||||
|
if status --is-interactive
|
||||||
|
source ("/usr/local/bin/starship" init fish --print-full-init | psub)
|
||||||
|
end
|
||||||
|
|
||||||
|
## Advanced command-not-found hook
|
||||||
|
#source /usr/share/doc/find-the-command/ftc.fish
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
# Functions needed for !! and !$ https://github.com/oh-my-fish/plugin-bang-bang
|
||||||
|
function __history_previous_command
|
||||||
|
switch (commandline -t)
|
||||||
|
case "!"
|
||||||
|
commandline -t $history[1]; commandline -f repaint
|
||||||
|
case "*"
|
||||||
|
commandline -i !
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function __history_previous_command_arguments
|
||||||
|
switch (commandline -t)
|
||||||
|
case "!"
|
||||||
|
commandline -t ""
|
||||||
|
commandline -f history-token-search-backward
|
||||||
|
case "*"
|
||||||
|
commandline -i '$'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if [ "$fish_key_bindings" = fish_vi_key_bindings ];
|
||||||
|
bind -Minsert ! __history_previous_command
|
||||||
|
bind -Minsert '$' __history_previous_command_arguments
|
||||||
|
else
|
||||||
|
bind ! __history_previous_command
|
||||||
|
bind '$' __history_previous_command_arguments
|
||||||
|
end
|
||||||
|
|
||||||
|
# Fish command history
|
||||||
|
function history
|
||||||
|
builtin history --show-time='%F %T '
|
||||||
|
end
|
||||||
|
|
||||||
|
function backup --argument filename
|
||||||
|
cp $filename $filename.bak
|
||||||
|
end
|
||||||
|
|
||||||
|
# Copy DIR1 DIR2
|
||||||
|
function copy
|
||||||
|
set count (count $argv | tr -d \n)
|
||||||
|
if test "$count" = 2; and test -d "$argv[1]"
|
||||||
|
set from (echo $argv[1] | string trim --right --chars=/)
|
||||||
|
set to (echo $argv[2])
|
||||||
|
command cp -r $from $to
|
||||||
|
else
|
||||||
|
command cp $argv
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function fish_greeting
|
||||||
|
echo -e "\n"
|
||||||
|
fastfetch
|
||||||
|
end
|
||||||
|
|
||||||
|
## Useful aliases
|
||||||
|
|
||||||
|
# Replace ls with eza
|
||||||
|
alias ls 'eza --color=always --group-directories-first --icons' # preferred listing
|
||||||
|
alias la 'eza -a --color=always --group-directories-first --icons' # all files and dirs
|
||||||
|
alias ll 'eza -l --color=always --group-directories-first --icons' # long format
|
||||||
|
alias lt 'eza -aT --color=always --group-directories-first --icons' # tree listing
|
||||||
|
alias l. 'eza -ald --color=always --group-directories-first --icons .*' # show only dotfiles
|
||||||
|
|
||||||
|
# Replace some more things with better alternatives
|
||||||
|
alias cat 'batcat --style header --style snip --style changes --style header'
|
||||||
|
|
||||||
|
# Common use
|
||||||
|
alias .. 'cd ..'
|
||||||
|
alias ... 'cd ../..'
|
||||||
|
alias .... 'cd ../../..'
|
||||||
|
alias ..... 'cd ../../../..'
|
||||||
|
alias ...... 'cd ../../../../..'
|
||||||
|
alias big 'expac -H M "%m\t%n" | sort -h | nl' # Sort installed packages according to size in MB (expac must be installed)
|
||||||
|
alias dir 'dir --color=auto'
|
||||||
|
alias grep 'ugrep --color=auto'
|
||||||
|
alias egrep 'ugrep -E --color=auto'
|
||||||
|
alias fgrep 'ugrep -F --color=auto'
|
||||||
|
alias grubup 'sudo update-grub'
|
||||||
|
alias hw 'hwinfo --short' # Hardware Info
|
||||||
|
alias ip 'ip -color'
|
||||||
|
alias psmem 'ps auxf | sort -nr -k 4'
|
||||||
|
alias psmem10 'ps auxf | sort -nr -k 4 | head -10'
|
||||||
|
alias tarnow 'tar -acf '
|
||||||
|
alias untar 'tar -zxvf '
|
||||||
|
alias vdir 'vdir --color=auto'
|
||||||
|
alias wget 'wget -c '
|
||||||
|
|
||||||
|
# Get the error messages from journalctl
|
||||||
|
alias jctl 'journalctl -p 3 -xb'
|
||||||
|
|
||||||
|
# Recent installed packages
|
||||||
|
alias rip 'expac --timefmt="%Y-%m-%d %T" "%l\t%n %v" | sort | tail -200 | nl'
|
||||||
3
fish/fish_plugins
Normal file
3
fish/fish_plugins
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
jorgebucaran/fisher
|
||||||
|
reitzig/sdkman-for-fish@v2.1.0
|
||||||
|
edc/bass
|
||||||
41
fish/fish_variables
Normal file
41
fish/fish_variables
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
# This file contains fish universal variable definitions.
|
||||||
|
# VERSION: 3.0
|
||||||
|
SETUVAR --export MANPAGER:sh\x20\x2dc\x20\x27col\x20\x2dbx\x20\x7c\x20batcat\x20\x2dl\x20man\x20\x2dp\x27
|
||||||
|
SETUVAR --export MANROFFOPT:\x2dc
|
||||||
|
SETUVAR __done_min_cmd_duration:10000
|
||||||
|
SETUVAR __done_notification_urgency_level:low
|
||||||
|
SETUVAR __fish_initialized:3400
|
||||||
|
SETUVAR _fisher_edc_2F_bass_files:\x7e/\x2econfig/fish/functions/__bass\x2epy\x1e\x7e/\x2econfig/fish/functions/bass\x2efish
|
||||||
|
SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish
|
||||||
|
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1ereitzig/sdkman\x2dfor\x2dfish\x40v2\x2e1\x2e0\x1eedc/bass
|
||||||
|
SETUVAR _fisher_reitzig_2F_sdkman_2D_for_2D_fish_40_v2_2E_31_2E_30__files:\x7e/\x2econfig/fish/functions/sdk\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/sdk\x2efish\x1e\x7e/\x2econfig/fish/completions/sdk\x2efish
|
||||||
|
SETUVAR _fisher_upgraded_to_4_4:\x1d
|
||||||
|
SETUVAR fish_color_autosuggestion:brblack
|
||||||
|
SETUVAR fish_color_cancel:\x2dr
|
||||||
|
SETUVAR fish_color_command:blue
|
||||||
|
SETUVAR fish_color_comment:red
|
||||||
|
SETUVAR fish_color_cwd:green
|
||||||
|
SETUVAR fish_color_cwd_root:red
|
||||||
|
SETUVAR fish_color_end:green
|
||||||
|
SETUVAR fish_color_error:brred
|
||||||
|
SETUVAR fish_color_escape:brcyan
|
||||||
|
SETUVAR fish_color_history_current:\x2d\x2dbold
|
||||||
|
SETUVAR fish_color_host:normal
|
||||||
|
SETUVAR fish_color_host_remote:yellow
|
||||||
|
SETUVAR fish_color_normal:normal
|
||||||
|
SETUVAR fish_color_operator:brcyan
|
||||||
|
SETUVAR fish_color_param:cyan
|
||||||
|
SETUVAR fish_color_quote:yellow
|
||||||
|
SETUVAR fish_color_redirection:cyan\x1e\x2d\x2dbold
|
||||||
|
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
||||||
|
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
||||||
|
SETUVAR fish_color_status:red
|
||||||
|
SETUVAR fish_color_user:brgreen
|
||||||
|
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
||||||
|
SETUVAR fish_key_bindings:fish_default_key_bindings
|
||||||
|
SETUVAR fish_pager_color_completion:normal
|
||||||
|
SETUVAR fish_pager_color_description:yellow\x1e\x2di
|
||||||
|
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
||||||
|
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
||||||
|
SETUVAR fish_pager_color_selected_background:\x2dr
|
||||||
|
SETUVAR fish_user_paths:/home/fscotto/\x2elocal/share/go/bin
|
||||||
140
fish/functions/__bass.py
Normal file
140
fish/functions/__bass.py
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
"""
|
||||||
|
To be used with a companion fish function like this:
|
||||||
|
|
||||||
|
function refish
|
||||||
|
set -l _x (python /tmp/bass.py source ~/.nvm/nvim.sh ';' nvm use iojs); source $_x; and rm -f $_x
|
||||||
|
end
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import signal
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
|
||||||
|
BASH = 'bash'
|
||||||
|
|
||||||
|
FISH_READONLY = [
|
||||||
|
'PWD', 'SHLVL', 'history', 'pipestatus', 'status', 'version',
|
||||||
|
'FISH_VERSION', 'fish_pid', 'hostname', '_', 'fish_private_mode'
|
||||||
|
]
|
||||||
|
|
||||||
|
IGNORED = [
|
||||||
|
'PS1', 'XPC_SERVICE_NAME'
|
||||||
|
]
|
||||||
|
|
||||||
|
def ignored(name):
|
||||||
|
if name == 'PWD': # this is read only, but has special handling
|
||||||
|
return False
|
||||||
|
# ignore other read only variables
|
||||||
|
if name in FISH_READONLY:
|
||||||
|
return True
|
||||||
|
if name in IGNORED or name.startswith("BASH_FUNC"):
|
||||||
|
return True
|
||||||
|
if name.startswith('%'):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def escape(string):
|
||||||
|
# use json.dumps to reliably escape quotes and backslashes
|
||||||
|
return json.dumps(string).replace(r'$', r'\$')
|
||||||
|
|
||||||
|
def escape_identifier(word):
|
||||||
|
return escape(word.replace('?', '\\?'))
|
||||||
|
|
||||||
|
def comment(string):
|
||||||
|
return '\n'.join(['# ' + line for line in string.split('\n')])
|
||||||
|
|
||||||
|
def gen_script():
|
||||||
|
# Use the following instead of /usr/bin/env to read environment so we can
|
||||||
|
# deal with multi-line environment variables (and other odd cases).
|
||||||
|
env_reader = "%s -c 'import os,json; print(json.dumps({k:v for k,v in os.environ.items()}))'" % (sys.executable)
|
||||||
|
args = [BASH, '-c', env_reader]
|
||||||
|
output = subprocess.check_output(args, universal_newlines=True)
|
||||||
|
old_env = output.strip()
|
||||||
|
|
||||||
|
pipe_r, pipe_w = os.pipe()
|
||||||
|
if sys.version_info >= (3, 4):
|
||||||
|
os.set_inheritable(pipe_w, True)
|
||||||
|
command = 'eval $1 && ({}; alias) >&{}'.format(
|
||||||
|
env_reader,
|
||||||
|
pipe_w
|
||||||
|
)
|
||||||
|
args = [BASH, '-c', command, 'bass', ' '.join(sys.argv[1:])]
|
||||||
|
p = subprocess.Popen(args, universal_newlines=True, close_fds=False)
|
||||||
|
os.close(pipe_w)
|
||||||
|
with os.fdopen(pipe_r) as f:
|
||||||
|
new_env = f.readline()
|
||||||
|
alias_str = f.read()
|
||||||
|
if p.wait() != 0:
|
||||||
|
raise subprocess.CalledProcessError(
|
||||||
|
returncode=p.returncode,
|
||||||
|
cmd=' '.join(sys.argv[1:]),
|
||||||
|
output=new_env + alias_str
|
||||||
|
)
|
||||||
|
new_env = new_env.strip()
|
||||||
|
|
||||||
|
old_env = json.loads(old_env)
|
||||||
|
new_env = json.loads(new_env)
|
||||||
|
|
||||||
|
script_lines = []
|
||||||
|
|
||||||
|
for k, v in new_env.items():
|
||||||
|
if ignored(k):
|
||||||
|
continue
|
||||||
|
v1 = old_env.get(k)
|
||||||
|
if not v1:
|
||||||
|
script_lines.append(comment('adding %s=%s' % (k, v)))
|
||||||
|
elif v1 != v:
|
||||||
|
script_lines.append(comment('updating %s=%s -> %s' % (k, v1, v)))
|
||||||
|
# process special variables
|
||||||
|
if k == 'PWD':
|
||||||
|
script_lines.append('cd %s' % escape(v))
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
if k == 'PATH':
|
||||||
|
value = ' '.join([escape(directory)
|
||||||
|
for directory in v.split(':')])
|
||||||
|
else:
|
||||||
|
value = escape(v)
|
||||||
|
script_lines.append('set -g -x %s %s' % (k, value))
|
||||||
|
|
||||||
|
for var in set(old_env.keys()) - set(new_env.keys()):
|
||||||
|
script_lines.append(comment('removing %s' % var))
|
||||||
|
script_lines.append('set -e %s' % var)
|
||||||
|
|
||||||
|
script = '\n'.join(script_lines)
|
||||||
|
|
||||||
|
alias_lines = []
|
||||||
|
for line in alias_str.splitlines():
|
||||||
|
_, rest = line.split(None, 1)
|
||||||
|
k, v = rest.split("=", 1)
|
||||||
|
alias_lines.append("alias " + escape_identifier(k) + "=" + v)
|
||||||
|
alias = '\n'.join(alias_lines)
|
||||||
|
|
||||||
|
return script + '\n' + alias
|
||||||
|
|
||||||
|
script_file = os.fdopen(3, 'w')
|
||||||
|
|
||||||
|
if not sys.argv[1:]:
|
||||||
|
print('__bass_usage', file=script_file, end='')
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
try:
|
||||||
|
script = gen_script()
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
sys.exit(e.returncode)
|
||||||
|
except Exception:
|
||||||
|
print('Bass internal error!', file=sys.stderr)
|
||||||
|
raise # traceback will output to stderr
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||||
|
os.kill(os.getpid(), signal.SIGINT)
|
||||||
|
else:
|
||||||
|
script_file.write(script)
|
||||||
175
fish/functions/__sdkman-noexport-init.sh
Normal file
175
fish/functions/__sdkman-noexport-init.sh
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright 2021 Marco Vermeulen
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
# set env vars if not set
|
||||||
|
if [ -z "$SDKMAN_CANDIDATES_API" ]; then
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$SDKMAN_DIR" ]; then
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load the sdkman config if it exists.
|
||||||
|
if [ -f "${SDKMAN_DIR}/etc/config" ]; then
|
||||||
|
source "${SDKMAN_DIR}/etc/config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Read the platform file
|
||||||
|
SDKMAN_PLATFORM="$(cat "${SDKMAN_DIR}/var/platform")"
|
||||||
|
:
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
darwin=false
|
||||||
|
solaris=false
|
||||||
|
freebsd=false
|
||||||
|
SDKMAN_KERNEL="$(uname -s)"
|
||||||
|
case "${SDKMAN_KERNEL}" in
|
||||||
|
CYGWIN*)
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin*)
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
SunOS*)
|
||||||
|
solaris=true
|
||||||
|
;;
|
||||||
|
FreeBSD*)
|
||||||
|
freebsd=true
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Determine shell
|
||||||
|
zsh_shell=false
|
||||||
|
bash_shell=false
|
||||||
|
|
||||||
|
if [[ -n "$ZSH_VERSION" ]]; then
|
||||||
|
zsh_shell=true
|
||||||
|
elif [[ -n "$BASH_VERSION" ]]; then
|
||||||
|
bash_shell=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Source sdkman module scripts and extension files.
|
||||||
|
#
|
||||||
|
# Extension files are prefixed with 'sdkman-' and found in the ext/ folder.
|
||||||
|
# Use this if extensions are written with the functional approach and want
|
||||||
|
# to use functions in the main sdkman script. For more details, refer to
|
||||||
|
# <https://github.com/sdkman/sdkman-extensions>.
|
||||||
|
OLD_IFS="$IFS"
|
||||||
|
IFS=$'\n'
|
||||||
|
scripts=($(find "${SDKMAN_DIR}/src" "${SDKMAN_DIR}/ext" -type f -name 'sdkman-*.sh'))
|
||||||
|
for f in "${scripts[@]}"; do
|
||||||
|
source "$f"
|
||||||
|
done
|
||||||
|
IFS="$OLD_IFS"
|
||||||
|
unset OLD_IFS scripts f
|
||||||
|
|
||||||
|
# Create upgrade delay file if it doesn't exist
|
||||||
|
if [[ ! -f "${SDKMAN_DIR}/var/delay_upgrade" ]]; then
|
||||||
|
touch "${SDKMAN_DIR}/var/delay_upgrade"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set curl connect-timeout and max-time
|
||||||
|
if [[ -z "$sdkman_curl_connect_timeout" ]]; then sdkman_curl_connect_timeout=7; fi
|
||||||
|
if [[ -z "$sdkman_curl_max_time" ]]; then sdkman_curl_max_time=10; fi
|
||||||
|
|
||||||
|
# set curl retry
|
||||||
|
if [[ -z "${sdkman_curl_retry}" ]]; then sdkman_curl_retry=0; fi
|
||||||
|
|
||||||
|
# set curl retry max time in seconds
|
||||||
|
if [[ -z "${sdkman_curl_retry_max_time}" ]]; then sdkman_curl_retry_max_time=60; fi
|
||||||
|
|
||||||
|
# set curl to continue downloading automatically
|
||||||
|
if [[ -z "${sdkman_curl_continue}" ]]; then sdkman_curl_continue=true; fi
|
||||||
|
|
||||||
|
# read list of candidates and set array
|
||||||
|
SDKMAN_CANDIDATES_CACHE="${SDKMAN_DIR}/var/candidates"
|
||||||
|
SDKMAN_CANDIDATES_CSV=$(<"$SDKMAN_CANDIDATES_CACHE")
|
||||||
|
__sdkman_echo_debug "Setting candidates csv: $SDKMAN_CANDIDATES_CSV"
|
||||||
|
if [[ "$zsh_shell" == 'true' ]]; then
|
||||||
|
SDKMAN_CANDIDATES=(${(s:,:)SDKMAN_CANDIDATES_CSV})
|
||||||
|
else
|
||||||
|
IFS=',' read -a SDKMAN_CANDIDATES <<< "${SDKMAN_CANDIDATES_CSV}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
:
|
||||||
|
|
||||||
|
for candidate_name in "${SDKMAN_CANDIDATES[@]}"; do
|
||||||
|
candidate_dir="${SDKMAN_CANDIDATES_DIR}/${candidate_name}/current"
|
||||||
|
if [[ -h "$candidate_dir" || -d "${candidate_dir}" ]]; then
|
||||||
|
:
|
||||||
|
:
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset candidate_name candidate_dir
|
||||||
|
:
|
||||||
|
|
||||||
|
# source completion scripts
|
||||||
|
if [[ "$sdkman_auto_complete" == 'true' ]]; then
|
||||||
|
if [[ "$zsh_shell" == 'true' ]]; then
|
||||||
|
# initialize zsh completions (if not already done)
|
||||||
|
if ! (( $+functions[compdef] )) ; then
|
||||||
|
autoload -Uz compinit
|
||||||
|
if [[ $ZSH_DISABLE_COMPFIX == 'true' ]]; then
|
||||||
|
compinit -u -C
|
||||||
|
else
|
||||||
|
compinit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
autoload -U bashcompinit
|
||||||
|
bashcompinit
|
||||||
|
source "${SDKMAN_DIR}/contrib/completion/bash/sdk"
|
||||||
|
__sdkman_echo_debug "ZSH completion script loaded..."
|
||||||
|
elif [[ "$bash_shell" == 'true' ]]; then
|
||||||
|
source "${SDKMAN_DIR}/contrib/completion/bash/sdk"
|
||||||
|
__sdkman_echo_debug "Bash completion script loaded..."
|
||||||
|
else
|
||||||
|
__sdkman_echo_debug "No completion scripts found for $SHELL"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$sdkman_auto_env" == "true" ]]; then
|
||||||
|
if [[ "$zsh_shell" == "true" ]]; then
|
||||||
|
function sdkman_auto_env() {
|
||||||
|
if [[ -n $SDKMAN_ENV ]] && [[ ! $PWD =~ ^$SDKMAN_ENV ]]; then
|
||||||
|
sdk env clear
|
||||||
|
fi
|
||||||
|
if [[ -f .sdkmanrc ]]; then
|
||||||
|
sdk env
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
chpwd_functions+=(sdkman_auto_env)
|
||||||
|
else
|
||||||
|
function sdkman_auto_env() {
|
||||||
|
if [[ -n $SDKMAN_ENV ]] && [[ ! $PWD =~ ^$SDKMAN_ENV ]]; then
|
||||||
|
sdk env clear
|
||||||
|
fi
|
||||||
|
if [[ "$SDKMAN_OLD_PWD" != "$PWD" ]] && [[ -f ".sdkmanrc" ]]; then
|
||||||
|
sdk env
|
||||||
|
fi
|
||||||
|
|
||||||
|
:
|
||||||
|
}
|
||||||
|
|
||||||
|
trimmed_prompt_command="${PROMPT_COMMAND%"${PROMPT_COMMAND##*[![:space:]]}"}"
|
||||||
|
[[ -z "$trimmed_prompt_command" ]] && PROMPT_COMMAND="sdkman_auto_env" || PROMPT_COMMAND="${trimmed_prompt_command%\;};sdkman_auto_env"
|
||||||
|
fi
|
||||||
|
|
||||||
|
sdkman_auto_env
|
||||||
|
fi
|
||||||
29
fish/functions/bass.fish
Normal file
29
fish/functions/bass.fish
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
function bass
|
||||||
|
set -l bash_args $argv
|
||||||
|
set -l bass_debug
|
||||||
|
if test "$bash_args[1]_" = '-d_'
|
||||||
|
set bass_debug true
|
||||||
|
set -e bash_args[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
set -l script_file (mktemp)
|
||||||
|
if command -v python3 >/dev/null 2>&1
|
||||||
|
command python3 -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file
|
||||||
|
else
|
||||||
|
command python -sS (dirname (status -f))/__bass.py $bash_args 3>$script_file
|
||||||
|
end
|
||||||
|
set -l bass_status $status
|
||||||
|
if test $bass_status -ne 0
|
||||||
|
return $bass_status
|
||||||
|
end
|
||||||
|
|
||||||
|
if test -n "$bass_debug"
|
||||||
|
cat $script_file
|
||||||
|
end
|
||||||
|
source $script_file
|
||||||
|
command rm $script_file
|
||||||
|
end
|
||||||
|
|
||||||
|
function __bass_usage
|
||||||
|
echo "Usage: bass [-d] <bash-command>"
|
||||||
|
end
|
||||||
240
fish/functions/fisher.fish
Normal file
240
fish/functions/fisher.fish
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
function fisher --argument-names cmd --description "A plugin manager for Fish"
|
||||||
|
set --query fisher_path || set --local fisher_path $__fish_config_dir
|
||||||
|
set --local fisher_version 4.4.4
|
||||||
|
set --local fish_plugins $__fish_config_dir/fish_plugins
|
||||||
|
|
||||||
|
switch "$cmd"
|
||||||
|
case -v --version
|
||||||
|
echo "fisher, version $fisher_version"
|
||||||
|
case "" -h --help
|
||||||
|
echo "Usage: fisher install <plugins...> Install plugins"
|
||||||
|
echo " fisher remove <plugins...> Remove installed plugins"
|
||||||
|
echo " fisher update <plugins...> Update installed plugins"
|
||||||
|
echo " fisher update Update all installed plugins"
|
||||||
|
echo " fisher list [<regex>] List installed plugins matching regex"
|
||||||
|
echo "Options:"
|
||||||
|
echo " -v, --version Print version"
|
||||||
|
echo " -h, --help Print this help message"
|
||||||
|
echo "Variables:"
|
||||||
|
echo " \$fisher_path Plugin installation path. Default: $__fish_config_dir" | string replace --regex -- $HOME \~
|
||||||
|
case ls list
|
||||||
|
string match --entire --regex -- "$argv[2]" $_fisher_plugins
|
||||||
|
case install update remove
|
||||||
|
isatty || read --local --null --array stdin && set --append argv $stdin
|
||||||
|
|
||||||
|
set --local install_plugins
|
||||||
|
set --local update_plugins
|
||||||
|
set --local remove_plugins
|
||||||
|
set --local arg_plugins $argv[2..-1]
|
||||||
|
set --local old_plugins $_fisher_plugins
|
||||||
|
set --local new_plugins
|
||||||
|
|
||||||
|
test -e $fish_plugins && set --local file_plugins (string match --regex -- '^[^\s]+$' <$fish_plugins)
|
||||||
|
|
||||||
|
if ! set --query argv[2]
|
||||||
|
if test "$cmd" != update
|
||||||
|
echo "fisher: Not enough arguments for command: \"$cmd\"" >&2 && return 1
|
||||||
|
else if ! set --query file_plugins
|
||||||
|
echo "fisher: \"$fish_plugins\" file not found: \"$cmd\"" >&2 && return 1
|
||||||
|
end
|
||||||
|
set arg_plugins $file_plugins
|
||||||
|
end
|
||||||
|
|
||||||
|
for plugin in $arg_plugins
|
||||||
|
set plugin (test -e "$plugin" && realpath $plugin || string lower -- $plugin)
|
||||||
|
contains -- "$plugin" $new_plugins || set --append new_plugins $plugin
|
||||||
|
end
|
||||||
|
|
||||||
|
if set --query argv[2]
|
||||||
|
for plugin in $new_plugins
|
||||||
|
if contains -- "$plugin" $old_plugins
|
||||||
|
test "$cmd" = remove &&
|
||||||
|
set --append remove_plugins $plugin ||
|
||||||
|
set --append update_plugins $plugin
|
||||||
|
else if test "$cmd" = install
|
||||||
|
set --append install_plugins $plugin
|
||||||
|
else
|
||||||
|
echo "fisher: Plugin not installed: \"$plugin\"" >&2 && return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for plugin in $new_plugins
|
||||||
|
contains -- "$plugin" $old_plugins &&
|
||||||
|
set --append update_plugins $plugin ||
|
||||||
|
set --append install_plugins $plugin
|
||||||
|
end
|
||||||
|
|
||||||
|
for plugin in $old_plugins
|
||||||
|
contains -- "$plugin" $new_plugins || set --append remove_plugins $plugin
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
set --local pid_list
|
||||||
|
set --local source_plugins
|
||||||
|
set --local fetch_plugins $update_plugins $install_plugins
|
||||||
|
set --local fish_path (status fish-path)
|
||||||
|
|
||||||
|
echo (set_color --bold)fisher $cmd version $fisher_version(set_color normal)
|
||||||
|
|
||||||
|
for plugin in $fetch_plugins
|
||||||
|
set --local source (command mktemp -d)
|
||||||
|
set --append source_plugins $source
|
||||||
|
|
||||||
|
command mkdir -p $source/{completions,conf.d,themes,functions}
|
||||||
|
|
||||||
|
$fish_path --command "
|
||||||
|
if test -e $plugin
|
||||||
|
command cp -Rf $plugin/* $source
|
||||||
|
else
|
||||||
|
set temp (command mktemp -d)
|
||||||
|
set repo (string split -- \@ $plugin) || set repo[2] HEAD
|
||||||
|
|
||||||
|
if set path (string replace --regex -- '^(https://)?gitlab.com/' '' \$repo[1])
|
||||||
|
set name (string split -- / \$path)[-1]
|
||||||
|
set url https://gitlab.com/\$path/-/archive/\$repo[2]/\$name-\$repo[2].tar.gz
|
||||||
|
else
|
||||||
|
set url https://api.github.com/repos/\$repo[1]/tarball/\$repo[2]
|
||||||
|
end
|
||||||
|
|
||||||
|
echo Fetching (set_color --underline)\$url(set_color normal)
|
||||||
|
|
||||||
|
if command curl -q --silent -L \$url | command tar -xzC \$temp -f - 2>/dev/null
|
||||||
|
command cp -Rf \$temp/*/* $source
|
||||||
|
else
|
||||||
|
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
|
||||||
|
command rm -rf $source
|
||||||
|
end
|
||||||
|
|
||||||
|
command rm -rf \$temp
|
||||||
|
end
|
||||||
|
|
||||||
|
set files $source/* && string match --quiet --regex -- .+\.fish\\\$ \$files
|
||||||
|
" &
|
||||||
|
|
||||||
|
set --append pid_list (jobs --last --pid)
|
||||||
|
end
|
||||||
|
|
||||||
|
wait $pid_list 2>/dev/null
|
||||||
|
|
||||||
|
for plugin in $fetch_plugins
|
||||||
|
if set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)] && test ! -e $source
|
||||||
|
if set --local index (contains --index -- "$plugin" $install_plugins)
|
||||||
|
set --erase install_plugins[$index]
|
||||||
|
else
|
||||||
|
set --erase update_plugins[(contains --index -- "$plugin" $update_plugins)]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for plugin in $update_plugins $remove_plugins
|
||||||
|
if set --local index (contains --index -- "$plugin" $_fisher_plugins)
|
||||||
|
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
|
||||||
|
|
||||||
|
if contains -- "$plugin" $remove_plugins
|
||||||
|
for name in (string replace --filter --regex -- '.+/conf\.d/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||||
|
emit {$name}_uninstall
|
||||||
|
end
|
||||||
|
printf "%s\n" Removing\ (set_color red --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
|
||||||
|
set --erase _fisher_plugins[$index]
|
||||||
|
end
|
||||||
|
|
||||||
|
command rm -rf (string replace -- \~ ~ $$plugin_files_var)
|
||||||
|
|
||||||
|
functions --erase (string replace --filter --regex -- '.+/functions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||||
|
|
||||||
|
for name in (string replace --filter --regex -- '.+/completions/([^/]+)\.fish$' '$1' $$plugin_files_var)
|
||||||
|
complete --erase --command $name
|
||||||
|
end
|
||||||
|
|
||||||
|
set --erase $plugin_files_var
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if set --query update_plugins[1] || set --query install_plugins[1]
|
||||||
|
command mkdir -p $fisher_path/{functions,themes,conf.d,completions}
|
||||||
|
end
|
||||||
|
|
||||||
|
for plugin in $update_plugins $install_plugins
|
||||||
|
set --local source $source_plugins[(contains --index -- "$plugin" $fetch_plugins)]
|
||||||
|
set --local files $source/{functions,themes,conf.d,completions}/*
|
||||||
|
|
||||||
|
if set --local index (contains --index -- $plugin $install_plugins)
|
||||||
|
set --local user_files $fisher_path/{functions,themes,conf.d,completions}/*
|
||||||
|
set --local conflict_files
|
||||||
|
|
||||||
|
for file in (string replace -- $source/ $fisher_path/ $files)
|
||||||
|
contains -- $file $user_files && set --append conflict_files $file
|
||||||
|
end
|
||||||
|
|
||||||
|
if set --query conflict_files[1] && set --erase install_plugins[$index]
|
||||||
|
echo -s "fisher: Cannot install \"$plugin\": please remove or move conflicting files first:" \n" "$conflict_files >&2
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for file in (string replace -- $source/ "" $files)
|
||||||
|
command cp -RLf $source/$file $fisher_path/$file
|
||||||
|
end
|
||||||
|
|
||||||
|
set --local plugin_files_var _fisher_(string escape --style=var -- $plugin)_files
|
||||||
|
|
||||||
|
set --query files[1] && set --universal $plugin_files_var (string replace -- $source $fisher_path $files | string replace -- ~ \~)
|
||||||
|
|
||||||
|
contains -- $plugin $_fisher_plugins || set --universal --append _fisher_plugins $plugin
|
||||||
|
contains -- $plugin $install_plugins && set --local event install || set --local event update
|
||||||
|
|
||||||
|
printf "%s\n" Installing\ (set_color --bold)$plugin(set_color normal) " "$$plugin_files_var | string replace -- \~ ~
|
||||||
|
|
||||||
|
for file in (string match --regex -- '.+/[^/]+\.fish$' $$plugin_files_var | string replace -- \~ ~)
|
||||||
|
source $file
|
||||||
|
if set --local name (string replace --regex -- '.+conf\.d/([^/]+)\.fish$' '$1' $file)
|
||||||
|
emit {$name}_$event
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
command rm -rf $source_plugins
|
||||||
|
|
||||||
|
if set --query _fisher_plugins[1]
|
||||||
|
set --local commit_plugins
|
||||||
|
|
||||||
|
for plugin in $file_plugins
|
||||||
|
contains -- (string lower -- $plugin) (string lower -- $_fisher_plugins) && set --append commit_plugins $plugin
|
||||||
|
end
|
||||||
|
|
||||||
|
for plugin in $_fisher_plugins
|
||||||
|
contains -- (string lower -- $plugin) (string lower -- $commit_plugins) || set --append commit_plugins $plugin
|
||||||
|
end
|
||||||
|
|
||||||
|
printf "%s\n" $commit_plugins >$fish_plugins
|
||||||
|
else
|
||||||
|
set --erase _fisher_plugins
|
||||||
|
command rm -f $fish_plugins
|
||||||
|
end
|
||||||
|
|
||||||
|
set --local total (count $install_plugins) (count $update_plugins) (count $remove_plugins)
|
||||||
|
|
||||||
|
test "$total" != "0 0 0" && echo (string join ", " (
|
||||||
|
test $total[1] = 0 || echo "Installed $total[1]") (
|
||||||
|
test $total[2] = 0 || echo "Updated $total[2]") (
|
||||||
|
test $total[3] = 0 || echo "Removed $total[3]")
|
||||||
|
) plugin/s
|
||||||
|
case \*
|
||||||
|
echo "fisher: Unknown command: \"$cmd\"" >&2 && return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if ! set --query _fisher_upgraded_to_4_4
|
||||||
|
set --universal _fisher_upgraded_to_4_4
|
||||||
|
if functions --query _fisher_list
|
||||||
|
set --query XDG_DATA_HOME[1] || set --local XDG_DATA_HOME ~/.local/share
|
||||||
|
command rm -rf $XDG_DATA_HOME/fisher
|
||||||
|
functions --erase _fisher_{list,plugin_parse}
|
||||||
|
fisher update >/dev/null 2>/dev/null
|
||||||
|
else
|
||||||
|
for var in (set --names | string match --entire --regex '^_fisher_.+_files$')
|
||||||
|
set $var (string replace -- ~ \~ $$var)
|
||||||
|
end
|
||||||
|
functions --erase _fisher_fish_postexec
|
||||||
|
end
|
||||||
|
end
|
||||||
42
fish/functions/sdk.fish
Normal file
42
fish/functions/sdk.fish
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Wrapper function for SDKMAN!
|
||||||
|
|
||||||
|
# Copyright (c) 2018-2023 Raphael Reitzig
|
||||||
|
# MIT License (MIT)
|
||||||
|
# https://github.com/reitzig/sdkman-for-fish
|
||||||
|
|
||||||
|
function sdk -d "Manage SDKs"
|
||||||
|
# Guard: SDKMAN! needs to be installed
|
||||||
|
if not test -f "$__fish_sdkman_init"
|
||||||
|
# Propose to install SDKMAN!
|
||||||
|
|
||||||
|
function read_confirm
|
||||||
|
while true
|
||||||
|
read -l -P "$argv[1] [y/N] " confirm
|
||||||
|
|
||||||
|
switch $confirm
|
||||||
|
case Y y
|
||||||
|
return 0
|
||||||
|
case '' N n
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if read_confirm "You don't seem to have SDKMAN! installed. Install now?"
|
||||||
|
if not which curl > /dev/null
|
||||||
|
echo "curl required"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
if not which bash > /dev/null
|
||||||
|
echo "bash required"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
curl -s "https://get.sdkman.io" | bash | sed '/All done!/q'
|
||||||
|
echo "Please open a new terminal/shell to load SDKMAN!"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# Declare the _actual_ sdk command for fish
|
||||||
|
__fish_sdkman_run_in_bash "source \"$__fish_sdkman_noexport_init\" && sdk $argv"
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user