mirror of
https://github.com/go-task/task.git
synced 2025-11-23 22:24:45 +02:00
fix: autocomplete works with other binary than 'task'
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# vim: set tabstop=2 shiftwidth=2 expandtab:
|
||||
|
||||
_GO_TASK_COMPLETION_LIST_OPTION='--list-all'
|
||||
TASK_CMD="${TASK_EXE:-task}"
|
||||
|
||||
function _task()
|
||||
{
|
||||
@@ -52,4 +53,4 @@ function _task()
|
||||
__ltrim_colon_completions "$cur"
|
||||
}
|
||||
|
||||
complete -F _task task
|
||||
complete -F _task "$TASK_CMD"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
set -l GO_TASK_PROGNAME task
|
||||
set -l GO_TASK_PROGNAME (if set -q GO_TASK_PROGNAME; echo $GO_TASK_PROGNAME; else if set -q TASK_EXE; echo $TASK_EXE; else; echo task; end)
|
||||
|
||||
function __task_get_tasks --description "Prints all available tasks with their description" --inherit-variable GO_TASK_PROGNAME
|
||||
# Check if the global task is requested
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using namespace System.Management.Automation
|
||||
|
||||
Register-ArgumentCompleter -CommandName task -ScriptBlock {
|
||||
$TaskCmd = if ($env:TASK_EXE) { $env:TASK_EXE } else { "task" }
|
||||
|
||||
Register-ArgumentCompleter -CommandName $TaskCmd -ScriptBlock {
|
||||
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters)
|
||||
|
||||
if ($commandName.StartsWith('-')) {
|
||||
@@ -24,5 +26,5 @@ Register-ArgumentCompleter -CommandName task -ScriptBlock {
|
||||
return $completions.Where{ $_.CompletionText.StartsWith($commandName) }
|
||||
}
|
||||
|
||||
return $(task --list-all --silent) | Where-Object { $_.StartsWith($commandName) } | ForEach-Object { return $_ + " " }
|
||||
return $(& $commandName --list-all --silent) | Where-Object { $_.StartsWith($commandName) } | ForEach-Object { return $_ + " " }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#compdef task
|
||||
compdef _task task
|
||||
typeset -A opt_args
|
||||
TASK_CMD="${TASK_EXE:-task}"
|
||||
compdef _task "$TASK_CMD"
|
||||
|
||||
_GO_TASK_COMPLETION_LIST_OPTION="${GO_TASK_COMPLETION_LIST_OPTION:---list-all}"
|
||||
|
||||
@@ -10,7 +11,7 @@ function __task_list() {
|
||||
local -i enabled=0
|
||||
local taskfile item task desc
|
||||
|
||||
cmd=(task)
|
||||
cmd=($TASK_CMD)
|
||||
taskfile=${(Qv)opt_args[(i)-t|--taskfile]}
|
||||
taskfile=${taskfile//\~/$HOME}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user