Skip to content

Commit

Permalink
feat: add completions for task deps command (#1456)
Browse files Browse the repository at this point in the history
* add completions for task deps command

* fix inconcise flag comment
  • Loading branch information
roele committed Jan 13, 2024
1 parent ef2cc0c commit e0ba235
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
19 changes: 18 additions & 1 deletion completions/mise.bash
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,9 @@ _mise() {
mise__help__sync,python)
cmd="mise__help__sync__python"
;;
mise__help__task,deps)
cmd="mise__help__task__deps"
;;
mise__help__task,edit)
cmd="mise__help__task__edit"
;;
Expand Down Expand Up @@ -2505,7 +2508,7 @@ _mise() {
return 0
;;
mise__help__task)
opts="edit ls run"
opts="deps edit ls run"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand All @@ -2518,6 +2521,20 @@ _mise() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
mise__help__task__deps)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
mise__help__task__edit)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
Expand Down
7 changes: 6 additions & 1 deletion completions/mise.fish
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,16 @@ complete -kxc mise -n "$fssf sync; and $fssf python" -l pyenv -d 'Get tool versi
# task
complete -kxc mise -n "$fssf task" -l hidden -d 'Show hidden tasks'
complete -kxc mise -n "$fssf task" -l no-header -d 'Do not print table header'
set -l others edit ls run
set -l others deps edit ls run
complete -xc mise -n "$fssf task; and not $fssf $others" -a deps -d '[experimental] Display a tree visualization of a dependency graph'
complete -xc mise -n "$fssf task; and not $fssf $others" -a edit -d '[experimental] Edit a task with $EDITOR'
complete -xc mise -n "$fssf task; and not $fssf $others" -a ls -d '[experimental] List available tasks to execute'
complete -xc mise -n "$fssf task; and not $fssf $others" -a run -d '[experimental] Run a task'
# task deps
complete -kxc mise -n "$fssf task; and $fssf deps" -l dot -d 'Display dependencies in DOT format'
complete -kxc mise -n "$fssf task; and $fssf deps" -a "(__mise_tasks)" -d 'Tasks to show dependencies for'
# task edit
complete -kxc mise -n "$fssf task; and $fssf edit" -s p -l path -d 'Display the path to the task instead of editing it'
complete -kxc mise -n "$fssf task; and $fssf edit" -a "(__mise_tasks)" -d 'Task to edit'
Expand Down
4 changes: 2 additions & 2 deletions src/cli/task/deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ use petgraph::dot::Dot;
#[derive(Debug, clap::Args)]
#[clap(verbatim_doc_comment, after_long_help = AFTER_LONG_HELP)]
pub struct TaskDeps {
/// Tasks to get dependencies for
/// Tasks to show dependencies for
/// Can specify multiple tasks by separating with spaces
/// e.g.: mise task deps task1 task2
/// e.g.: mise task deps lint test check
#[clap(verbatim_doc_comment)]
pub tasks: Option<Vec<String>>,

Expand Down

0 comments on commit e0ba235

Please sign in to comment.