mirror of
https://github.com/nikdoof/smsbot.git
synced 2025-12-13 18:12:15 +00:00
Clean up temporary files and update .gitignore for uv migration
Co-authored-by: nikdoof <170514+nikdoof@users.noreply.github.com>
This commit is contained in:
9
.gitignore
vendored
9
.gitignore
vendored
@@ -102,3 +102,12 @@ venv.bak/
|
|||||||
|
|
||||||
# mypy
|
# mypy
|
||||||
.mypy_cache/
|
.mypy_cache/
|
||||||
|
|
||||||
|
# Task completions
|
||||||
|
completion/
|
||||||
|
|
||||||
|
# Build artifacts
|
||||||
|
dist/
|
||||||
|
|
||||||
|
# uv cache
|
||||||
|
.ruff_cache/
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
# vim: set tabstop=2 shiftwidth=2 expandtab:
|
|
||||||
|
|
||||||
_GO_TASK_COMPLETION_LIST_OPTION='--list-all'
|
|
||||||
|
|
||||||
function _task()
|
|
||||||
{
|
|
||||||
local cur prev words cword
|
|
||||||
_init_completion -n : || return
|
|
||||||
|
|
||||||
# Check for `--` within command-line and quit or strip suffix.
|
|
||||||
local i
|
|
||||||
for i in "${!words[@]}"; do
|
|
||||||
if [ "${words[$i]}" == "--" ]; then
|
|
||||||
# Do not complete words following `--` passed to CLI_ARGS.
|
|
||||||
[ $cword -gt $i ] && return
|
|
||||||
# Remove the words following `--` to not put --list in CLI_ARGS.
|
|
||||||
words=( "${words[@]:0:$i}" )
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Handle special arguments of options.
|
|
||||||
case "$prev" in
|
|
||||||
-d|--dir)
|
|
||||||
_filedir -d
|
|
||||||
return $?
|
|
||||||
;;
|
|
||||||
-t|--taskfile)
|
|
||||||
_filedir yaml || return $?
|
|
||||||
_filedir yml
|
|
||||||
return $?
|
|
||||||
;;
|
|
||||||
-o|--output)
|
|
||||||
COMPREPLY=( $( compgen -W "interleaved group prefixed" -- $cur ) )
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Handle normal options.
|
|
||||||
case "$cur" in
|
|
||||||
-*)
|
|
||||||
COMPREPLY=( $( compgen -W "$(_parse_help $1)" -- $cur ) )
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Prepare task name completions.
|
|
||||||
local tasks=( $( "${words[@]}" --silent $_GO_TASK_COMPLETION_LIST_OPTION 2> /dev/null ) )
|
|
||||||
COMPREPLY=( $( compgen -W "${tasks[*]}" -- "$cur" ) )
|
|
||||||
|
|
||||||
# Post-process because task names might contain colons.
|
|
||||||
__ltrim_colon_completions "$cur"
|
|
||||||
}
|
|
||||||
|
|
||||||
complete -F _task task
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
set -l GO_TASK_PROGNAME task
|
|
||||||
|
|
||||||
function __task_get_tasks --description "Prints all available tasks with their description" --inherit-variable GO_TASK_PROGNAME
|
|
||||||
# Check if the global task is requested
|
|
||||||
set -l global_task false
|
|
||||||
commandline --current-process | read --tokenize --list --local cmd_args
|
|
||||||
for arg in $cmd_args
|
|
||||||
if test "_$arg" = "_--"
|
|
||||||
break # ignore arguments to be passed to the task
|
|
||||||
end
|
|
||||||
if test "_$arg" = "_--global" -o "_$arg" = "_-g"
|
|
||||||
set global_task true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Read the list of tasks (and potential errors)
|
|
||||||
if $global_task
|
|
||||||
$GO_TASK_PROGNAME --global --list-all
|
|
||||||
else
|
|
||||||
$GO_TASK_PROGNAME --list-all
|
|
||||||
end 2>&1 | read -lz rawOutput
|
|
||||||
|
|
||||||
# Return on non-zero exit code (for cases when there is no Taskfile found or etc.)
|
|
||||||
if test $status -ne 0
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
# Grab names and descriptions (if any) of the tasks
|
|
||||||
set -l output (echo $rawOutput | sed -e '1d; s/\* \(.*\):\s*\(.*\)\s*(\(aliases.*\))/\1\t\2\t\3/' -e 's/\* \(.*\):\s*\(.*\)/\1\t\2/'| string split0)
|
|
||||||
if test $output
|
|
||||||
echo $output
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
complete -c $GO_TASK_PROGNAME -d 'Runs the specified task(s). Falls back to the "default" task if no task name was specified, or lists all tasks if an unknown task name was
|
|
||||||
specified.' -xa "(__task_get_tasks)"
|
|
||||||
|
|
||||||
complete -c $GO_TASK_PROGNAME -s c -l color -d 'colored output (default true)'
|
|
||||||
complete -c $GO_TASK_PROGNAME -s d -l dir -d 'sets directory of execution'
|
|
||||||
complete -c $GO_TASK_PROGNAME -l dry -d 'compiles and prints tasks in the order that they would be run, without executing them'
|
|
||||||
complete -c $GO_TASK_PROGNAME -s f -l force -d 'forces execution even when the task is up-to-date'
|
|
||||||
complete -c $GO_TASK_PROGNAME -s h -l help -d 'shows Task usage'
|
|
||||||
complete -c $GO_TASK_PROGNAME -s i -l init -d 'creates a new Taskfile.yml in the current folder'
|
|
||||||
complete -c $GO_TASK_PROGNAME -s l -l list -d 'lists tasks with description of current Taskfile'
|
|
||||||
complete -c $GO_TASK_PROGNAME -s o -l output -d 'sets output style: [interleaved|group|prefixed]' -xa "interleaved group prefixed"
|
|
||||||
complete -c $GO_TASK_PROGNAME -s p -l parallel -d 'executes tasks provided on command line in parallel'
|
|
||||||
complete -c $GO_TASK_PROGNAME -s s -l silent -d 'disables echoing'
|
|
||||||
complete -c $GO_TASK_PROGNAME -l status -d 'exits with non-zero exit code if any of the given tasks is not up-to-date'
|
|
||||||
complete -c $GO_TASK_PROGNAME -l summary -d 'show summary about a task'
|
|
||||||
complete -c $GO_TASK_PROGNAME -s t -l taskfile -d 'choose which Taskfile to run. Defaults to "Taskfile.yml"'
|
|
||||||
complete -c $GO_TASK_PROGNAME -s v -l verbose -d 'enables verbose mode'
|
|
||||||
complete -c $GO_TASK_PROGNAME -l version -d 'show Task version'
|
|
||||||
complete -c $GO_TASK_PROGNAME -s w -l watch -d 'enables watch of the given task'
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
using namespace System.Management.Automation
|
|
||||||
|
|
||||||
Register-ArgumentCompleter -CommandName task -ScriptBlock {
|
|
||||||
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters)
|
|
||||||
|
|
||||||
if ($commandName.StartsWith('-')) {
|
|
||||||
$completions = @(
|
|
||||||
[CompletionResult]::new('--list-all ', '--list-all ', [CompletionResultType]::ParameterName, 'list all tasks'),
|
|
||||||
[CompletionResult]::new('--color ', '--color', [CompletionResultType]::ParameterName, '--color'),
|
|
||||||
[CompletionResult]::new('--concurrency=', '--concurrency=', [CompletionResultType]::ParameterName, 'concurrency'),
|
|
||||||
[CompletionResult]::new('--interval=', '--interval=', [CompletionResultType]::ParameterName, 'interval'),
|
|
||||||
[CompletionResult]::new('--output=interleaved ', '--output=interleaved', [CompletionResultType]::ParameterName, '--output='),
|
|
||||||
[CompletionResult]::new('--output=group ', '--output=group', [CompletionResultType]::ParameterName, '--output='),
|
|
||||||
[CompletionResult]::new('--output=prefixed ', '--output=prefixed', [CompletionResultType]::ParameterName, '--output='),
|
|
||||||
[CompletionResult]::new('--dry ', '--dry', [CompletionResultType]::ParameterName, '--dry'),
|
|
||||||
[CompletionResult]::new('--force ', '--force', [CompletionResultType]::ParameterName, '--force'),
|
|
||||||
[CompletionResult]::new('--parallel ', '--parallel', [CompletionResultType]::ParameterName, '--parallel'),
|
|
||||||
[CompletionResult]::new('--silent ', '--silent', [CompletionResultType]::ParameterName, '--silent'),
|
|
||||||
[CompletionResult]::new('--status ', '--status', [CompletionResultType]::ParameterName, '--status'),
|
|
||||||
[CompletionResult]::new('--verbose ', '--verbose', [CompletionResultType]::ParameterName, '--verbose'),
|
|
||||||
[CompletionResult]::new('--watch ', '--watch', [CompletionResultType]::ParameterName, '--watch')
|
|
||||||
)
|
|
||||||
|
|
||||||
return $completions.Where{ $_.CompletionText.StartsWith($commandName) }
|
|
||||||
}
|
|
||||||
|
|
||||||
return $(task --list-all --silent) | Where-Object { $_.StartsWith($commandName) } | ForEach-Object { return $_ + " " }
|
|
||||||
}
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
#compdef task
|
|
||||||
compdef _task task
|
|
||||||
typeset -A opt_args
|
|
||||||
|
|
||||||
_GO_TASK_COMPLETION_LIST_OPTION="${GO_TASK_COMPLETION_LIST_OPTION:---list-all}"
|
|
||||||
|
|
||||||
# Listing commands from Taskfile.yml
|
|
||||||
function __task_list() {
|
|
||||||
local -a scripts cmd
|
|
||||||
local -i enabled=0
|
|
||||||
local taskfile item task desc
|
|
||||||
|
|
||||||
cmd=(task)
|
|
||||||
taskfile=${(Qv)opt_args[(i)-t|--taskfile]}
|
|
||||||
taskfile=${taskfile//\~/$HOME}
|
|
||||||
|
|
||||||
|
|
||||||
if [[ -n "$taskfile" && -f "$taskfile" ]]; then
|
|
||||||
enabled=1
|
|
||||||
cmd+=(--taskfile "$taskfile")
|
|
||||||
else
|
|
||||||
for taskfile in {T,t}askfile{,.dist}.{yaml,yml}; do
|
|
||||||
if [[ -f "$taskfile" ]]; then
|
|
||||||
enabled=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
(( enabled )) || return 0
|
|
||||||
|
|
||||||
scripts=()
|
|
||||||
for item in "${(@)${(f)$("${cmd[@]}" $_GO_TASK_COMPLETION_LIST_OPTION)}[2,-1]#\* }"; do
|
|
||||||
task="${item%%:[[:space:]]*}"
|
|
||||||
desc="${item##[^[:space:]]##[[:space:]]##}"
|
|
||||||
scripts+=( "${task//:/\\:}:$desc" )
|
|
||||||
done
|
|
||||||
_describe 'Task to run' scripts
|
|
||||||
}
|
|
||||||
|
|
||||||
_task() {
|
|
||||||
_arguments \
|
|
||||||
'(-C --concurrency)'{-C,--concurrency}'[limit number of concurrent tasks]: ' \
|
|
||||||
'(-p --parallel)'{-p,--parallel}'[run command-line tasks in parallel]' \
|
|
||||||
'(-f --force)'{-f,--force}'[run even if task is up-to-date]' \
|
|
||||||
'(-c --color)'{-c,--color}'[colored output]' \
|
|
||||||
'(-d --dir)'{-d,--dir}'[dir to run in]:execution dir:_dirs' \
|
|
||||||
'(--dry)--dry[dry-run mode, compile and print tasks only]' \
|
|
||||||
'(-o --output)'{-o,--output}'[set output style]:style:(interleaved group prefixed)' \
|
|
||||||
'(--output-group-begin)--output-group-begin[message template before grouped output]:template text: ' \
|
|
||||||
'(--output-group-end)--output-group-end[message template after grouped output]:template text: ' \
|
|
||||||
'(-s --silent)'{-s,--silent}'[disable echoing]' \
|
|
||||||
'(--status)--status[exit non-zero if supplied tasks not up-to-date]' \
|
|
||||||
'(--summary)--summary[show summary\: field from tasks instead of running them]' \
|
|
||||||
'(-t --taskfile)'{-t,--taskfile}'[specify a different taskfile]:taskfile:_files' \
|
|
||||||
'(-v --verbose)'{-v,--verbose}'[verbose mode]' \
|
|
||||||
'(-w --watch)'{-w,--watch}'[watch-mode for given tasks, re-run when inputs change]' \
|
|
||||||
+ '(operation)' \
|
|
||||||
{-l,--list}'[list describable tasks]' \
|
|
||||||
{-a,--list-all}'[list all tasks]' \
|
|
||||||
{-i,--init}'[create new Taskfile.yml]' \
|
|
||||||
'(-*)'{-h,--help}'[show help]' \
|
|
||||||
'(-*)--version[show version and exit]' \
|
|
||||||
'*: :__task_list'
|
|
||||||
}
|
|
||||||
|
|
||||||
# don't run the completion function when being source-ed or eval-ed
|
|
||||||
if [ "$funcstack[1]" = "_task" ]; then
|
|
||||||
_task "$@"
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user