Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

env-vars: improvements #1435

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 26 additions & 13 deletions completions/_mise
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ _mise() {
(direnv) __mise_direnv_cmd && ret=0 ;;
(doctor) __mise_doctor_cmd && ret=0 ;;
(e|env) __mise_env_cmd && ret=0 ;;
(ev|env-vars) __mise_env_vars_cmd && ret=0 ;;
(x|exec) __mise_exec_cmd && ret=0 ;;
(g|global) __mise_global_cmd && ret=0 ;;
(hook-env) __mise_hook_env_cmd && ret=0 ;;
Expand All @@ -46,12 +45,14 @@ _mise() {
(reshim) __mise_reshim_cmd && ret=0 ;;
(r|run) __mise_run_cmd && ret=0 ;;
(self-update) __mise_self_update_cmd && ret=0 ;;
(env-vars|ev|set) __mise_set_cmd && ret=0 ;;
(settings) __mise_settings_cmd && ret=0 ;;
(sh|shell) __mise_shell_cmd && ret=0 ;;
(sync) __mise_sync_cmd && ret=0 ;;
(t|tasks|task) __mise_task_cmd && ret=0 ;;
(trust) __mise_trust_cmd && ret=0 ;;
(remove|rm|uninstall) __mise_uninstall_cmd && ret=0 ;;
(unset) __mise_unset_cmd && ret=0 ;;
(up|upgrade) __mise_upgrade_cmd && ret=0 ;;
(u|use) __mise_use_cmd && ret=0 ;;
(v|version) __mise_version_cmd && ret=0 ;;
Expand Down Expand Up @@ -321,17 +322,6 @@ __mise_env_cmd() {
'*'{-v,--verbose}'[Show extra output (use -vv for even more)]' \
'(-y --yes)'{-y,--yes}'[Answer yes to all confirmation prompts]'
}
(( $+functions[__mise_env_vars_cmd] )) ||
__mise_env_vars_cmd() {
_arguments -s -S \
'--file=[The TOML file to update]:file:_files' \
'*--remove=[Remove the environment variable from config file]:remove:' \
'*::env_vars:' \
'(-C --cd)'{-C,--cd}'=[Change directory before running command]:cd:_directories' \
'(-q --quiet)'{-q,--quiet}'[Suppress non-error messages]' \
'*'{-v,--verbose}'[Show extra output (use -vv for even more)]' \
'(-y --yes)'{-y,--yes}'[Answer yes to all confirmation prompts]'
}
(( $+functions[__mise_exec_cmd] )) ||
__mise_exec_cmd() {
_arguments -s -S \
Expand Down Expand Up @@ -610,6 +600,17 @@ __mise_self_update_cmd() {
'(-q --quiet)'{-q,--quiet}'[Suppress non-error messages]' \
'*'{-v,--verbose}'[Show extra output (use -vv for even more)]'
}
(( $+functions[__mise_set_cmd] )) ||
__mise_set_cmd() {
_arguments -s -S \
'--file=[The TOML file to update]:file:_files' \
'(-g --global)'{-g,--global}'[Set the environment variable in the global config file]' \
'*::env_vars:' \
'(-C --cd)'{-C,--cd}'=[Change directory before running command]:cd:_directories' \
'(-q --quiet)'{-q,--quiet}'[Suppress non-error messages]' \
'*'{-v,--verbose}'[Show extra output (use -vv for even more)]' \
'(-y --yes)'{-y,--yes}'[Answer yes to all confirmation prompts]'
}
(( $+functions[__mise_settings_cmd] )) ||
__mise_settings_cmd() {
_arguments -s -S \
Expand Down Expand Up @@ -808,6 +809,17 @@ __mise_uninstall_cmd() {
'*'{-v,--verbose}'[Show extra output (use -vv for even more)]' \
'(-y --yes)'{-y,--yes}'[Answer yes to all confirmation prompts]'
}
(( $+functions[__mise_unset_cmd] )) ||
__mise_unset_cmd() {
_arguments -s -S \
'*::keys:' \
'(-f --file)'{-f,--file}'=[Specify a file to use instead of ".mise.toml"]:file:_files' \
'(-g --global)'{-g,--global}'[Use the global config file]' \
'(-C --cd)'{-C,--cd}'=[Change directory before running command]:cd:_directories' \
'(-q --quiet)'{-q,--quiet}'[Suppress non-error messages]' \
'*'{-v,--verbose}'[Show extra output (use -vv for even more)]' \
'(-y --yes)'{-y,--yes}'[Answer yes to all confirmation prompts]'
}
(( $+functions[__mise_upgrade_cmd] )) ||
__mise_upgrade_cmd() {
_arguments -s -S \
Expand Down Expand Up @@ -893,7 +905,6 @@ __mise_cmds() {
'direnv:Output direnv function to use mise inside direnv'
'doctor:Check mise installation for possible problems.'
{e,env}':Exports env vars to activate mise a single time'
{ev,env-vars}':Manage environment variables'
{x,exec}':Execute a command with tool(s) set'
'implode:Removes mise CLI and all related data'
{i,install}':Install a tool version'
Expand All @@ -907,12 +918,14 @@ __mise_cmds() {
'reshim:rebuilds the shim farm'
{r,run}':\[experimental\] Run a task'
'self-update:Updates mise itself'
'set:Manage environment variables'
'settings:Manage settings'
{sh,shell}':Sets a tool version for the current shell session'
'sync:Add tool versions from external tools to mise'
{t,task}':\[experimental\] Manage tasks'
'trust:Marks a config file as trusted'
{remove,rm,uninstall}':Removes runtime versions'
'unset:Remove environment variable(s) from the config file'
{up,upgrade}':Upgrades outdated tool versions'
{u,use}':Change the active version of a tool locally or globally.'
'version:Show mise version'
Expand Down
169 changes: 110 additions & 59 deletions completions/mise.bash
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ _mise() {
mise,env)
cmd="mise__env"
;;
mise,env-vars)
cmd="mise__env__vars"
;;
mise,ev)
cmd="mise__env__vars"
;;
mise,exec)
cmd="mise__exec"
;;
Expand Down Expand Up @@ -147,6 +141,9 @@ _mise() {
mise,self-update)
cmd="mise__self__update"
;;
mise,set)
cmd="mise__set"
;;
mise,settings)
cmd="mise__settings"
;;
Expand Down Expand Up @@ -174,6 +171,9 @@ _mise() {
mise,uninstall)
cmd="mise__uninstall"
;;
mise,unset)
cmd="mise__unset"
;;
mise,up)
cmd="mise__upgrade"
;;
Expand Down Expand Up @@ -348,9 +348,6 @@ _mise() {
mise__help,env)
cmd="mise__help__env"
;;
mise__help,env-vars)
cmd="mise__help__env__vars"
;;
mise__help,exec)
cmd="mise__help__exec"
;;
Expand Down Expand Up @@ -414,6 +411,9 @@ _mise() {
mise__help,self-update)
cmd="mise__help__self__update"
;;
mise__help,set)
cmd="mise__help__set"
;;
mise__help,settings)
cmd="mise__help__settings"
;;
Expand All @@ -432,6 +432,9 @@ _mise() {
mise__help,uninstall)
cmd="mise__help__uninstall"
;;
mise__help,unset)
cmd="mise__help__unset"
;;
mise__help,upgrade)
cmd="mise__help__upgrade"
;;
Expand Down Expand Up @@ -700,7 +703,7 @@ _mise() {

case "${cmd}" in
mise)
opts="-C -q -v -y -h -V --debug --log-level --trace --cd --quiet --verbose --yes --help --version activate alias asdf bin-paths cache completion config current deactivate direnv doctor env env-vars exec global hook-env hook-not-found implode install latest link local ls ls-remote outdated plugins prune reshim run self-update settings shell sync task trust uninstall upgrade use version watch where which render-completion render-help render-mangen help"
opts="-C -q -v -y -h -V --debug --log-level --trace --cd --quiet --verbose --yes --help --version activate alias asdf bin-paths cache completion config current deactivate direnv doctor env exec global hook-env hook-not-found implode install latest link local ls ls-remote outdated plugins prune reshim run self-update set settings shell sync task trust uninstall upgrade unset use version watch where which render-completion render-help render-mangen help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -1589,40 +1592,6 @@ _mise() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
mise__env__vars)
opts="-C -q -v -y -h --file --remove --debug --log-level --trace --cd --quiet --verbose --yes --help [ENV_VARS]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--file)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--remove)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--log-level)
COMPREPLY=($(compgen -W "error warn info debug trace" -- "${cur}"))
return 0
;;
--cd)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-C)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
mise__exec)
opts="-c -j -C -q -v -y -h --command --jobs --raw --debug --log-level --trace --cd --quiet --verbose --yes --help [TOOL@VERSION]... [COMMAND]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
Expand Down Expand Up @@ -1696,7 +1665,7 @@ _mise() {
return 0
;;
mise__help)
opts="activate alias asdf bin-paths cache completion config current deactivate direnv doctor env env-vars exec global hook-env hook-not-found implode install latest link local ls ls-remote outdated plugins prune reshim run self-update settings shell sync task trust uninstall upgrade use version watch where which render-completion render-help render-mangen help"
opts="activate alias asdf bin-paths cache completion config current deactivate direnv doctor env exec global hook-env hook-not-found implode install latest link local ls ls-remote outdated plugins prune reshim run self-update set settings shell sync task trust uninstall upgrade unset use version watch where which render-completion render-help render-mangen help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -2017,20 +1986,6 @@ _mise() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
mise__help__env__vars)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
mise__help__exec)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
Expand Down Expand Up @@ -2409,6 +2364,20 @@ _mise() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
mise__help__set)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
mise__help__settings)
opts="get ls set unset"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
Expand Down Expand Up @@ -2619,6 +2588,20 @@ _mise() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
mise__help__unset)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
mise__help__upgrade)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
Expand Down Expand Up @@ -3511,6 +3494,40 @@ _mise() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
mise__set)
opts="-g -C -q -v -y -h --file --global --remove --debug --log-level --trace --cd --quiet --verbose --yes --help [ENV_VARS]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--file)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--remove)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--log-level)
COMPREPLY=($(compgen -W "error warn info debug trace" -- "${cur}"))
return 0
;;
--cd)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-C)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
mise__settings)
opts="-C -q -v -y -h --debug --log-level --trace --cd --quiet --verbose --yes --help get ls set unset help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
Expand Down Expand Up @@ -4135,6 +4152,40 @@ _mise() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
mise__unset)
opts="-f -g -C -q -v -y -h --file --global --debug --log-level --trace --cd --quiet --verbose --yes --help [KEYS]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--file)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-f)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--log-level)
COMPREPLY=($(compgen -W "error warn info debug trace" -- "${cur}"))
return 0
;;
--cd)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-C)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
mise__upgrade)
opts="-n -j -i -C -q -v -y -h --dry-run --jobs --interactive --raw --debug --log-level --trace --cd --quiet --verbose --yes --help [TOOL@VERSION]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
Expand Down
Loading