fix: Update build.rs to fix completions

This commit is contained in:
Dheepak Krishnamurthy 2021-11-09 04:07:22 -07:00
parent 4998bd398b
commit 57097d3bec
3 changed files with 9 additions and 13 deletions

View file

@ -11,8 +11,8 @@ fn main() {
let name = app.get_name().to_string(); let name = app.get_name().to_string();
let outdir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("completions/"); let outdir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("completions/");
dbg!(&outdir); dbg!(&outdir);
generate_to::<Bash, _, _>(&mut app, &name, &outdir).unwrap(); generate_to(Bash, &mut app, &name, &outdir).unwrap();
generate_to::<Zsh, _, _>(&mut app, &name, &outdir).unwrap(); generate_to(Zsh, &mut app, &name, &outdir).unwrap();
generate_to::<Fish, _, _>(&mut app, &name, &outdir).unwrap(); generate_to(Fish, &mut app, &name, &outdir).unwrap();
generate_to::<PowerShell, _, _>(&mut app, &name, &outdir).unwrap(); generate_to(PowerShell, &mut app, &name, &outdir).unwrap();
} }

View file

@ -15,16 +15,15 @@ _taskwarrior-tui() {
local context curcontext="$curcontext" state line local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
'-c+[Sets a custom config file]' \ '-c+[Sets a custom config file]:FILE: ' \
'--config=[Sets a custom config file]' \ '--config=[Sets a custom config file]:FILE: ' \
'-r+[Sets default report]' \ '-r+[Sets default report]:STRING: ' \
'--report=[Sets default report]' \ '--report=[Sets default report]:STRING: ' \
'-h[Print help information]' \ '-h[Print help information]' \
'--help[Print help information]' \ '--help[Print help information]' \
'-V[Print version information]' \ '-V[Print version information]' \
'--version[Print version information]' \ '--version[Print version information]' \
&& ret=0 && ret=0
} }
(( $+functions[_taskwarrior-tui_commands] )) || (( $+functions[_taskwarrior-tui_commands] )) ||

View file

@ -12,7 +12,6 @@ _taskwarrior-tui() {
taskwarrior-tui) taskwarrior-tui)
cmd="taskwarrior__tui" cmd="taskwarrior__tui"
;; ;;
*) *)
;; ;;
esac esac
@ -20,13 +19,12 @@ _taskwarrior-tui() {
case "${cmd}" in case "${cmd}" in
taskwarrior__tui) taskwarrior__tui)
opts=" -h -V -c -r --help --version --config --report " opts="-h -V -c -r --help --version --config --report"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
fi fi
case "${prev}" in case "${prev}" in
--config) --config)
COMPREPLY=($(compgen -f "${cur}")) COMPREPLY=($(compgen -f "${cur}"))
return 0 return 0
@ -50,7 +48,6 @@ _taskwarrior-tui() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0
;; ;;
esac esac
} }