formated using alejandra
This commit is contained in:
parent
88a48b895c
commit
4b1114a616
92 changed files with 1377 additions and 1156 deletions
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, ... }: {
|
||||
{pkgs, ...}: {
|
||||
home.file = {
|
||||
doascomplete = {
|
||||
enable = true;
|
||||
|
|
@ -8,10 +8,10 @@
|
|||
{
|
||||
local cur prev words cword split
|
||||
_init_completion -s || return
|
||||
|
||||
|
||||
local i mode=normal
|
||||
[[ ''$1 == *doasedit ]] && mode=edit
|
||||
|
||||
|
||||
[[ ''$mode == normal ]] &&
|
||||
for ((i = 1; i <= cword; i++)); do
|
||||
if [[ ''${words[i]} != -* ]]; then
|
||||
|
|
@ -23,16 +23,16 @@
|
|||
[[ ''${words[i]} == -@(!(-*)[uUgCp]) ]] &&
|
||||
((i++))
|
||||
done
|
||||
|
||||
|
||||
case "''$prev" in
|
||||
-u)
|
||||
COMPREPLY=(''$(compgen -u -- "''$cur"))
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
''$split && return
|
||||
|
||||
|
||||
if [[ ''$cur == -* ]]; then
|
||||
local opts=''$(_parse_help "''$1")
|
||||
COMPREPLY=(''$(compgen -W ' ''${opts:-''$(_parse_usage "''$1")}' -- "''$cur"))
|
||||
|
|
@ -103,33 +103,33 @@
|
|||
################################################################################
|
||||
#the following variable is substituted for by ../../test/bash_completion.t
|
||||
taskcommand='task rc.verbose:nothing rc.confirmation:no rc.hooks:off'
|
||||
|
||||
|
||||
_task_get_tags() {
|
||||
''$taskcommand _tags
|
||||
}
|
||||
|
||||
|
||||
_task_get_config() {
|
||||
''$taskcommand _config
|
||||
}
|
||||
|
||||
|
||||
_task_offer_priorities() {
|
||||
COMPREPLY=( ''$(compgen -W "L M H" -- ''${cur/*:/}) )
|
||||
}
|
||||
|
||||
|
||||
_task_offer_projects() {
|
||||
COMPREPLY=( ''$(compgen -W "''$(''$taskcommand _projects)" -- ''${cur/*:/}) )
|
||||
}
|
||||
|
||||
|
||||
_task_offer_contexts() {
|
||||
COMPREPLY=( ''$(compgen -W "''$(''$taskcommand _context) define delete list none show" -- ''$cur) )
|
||||
}
|
||||
|
||||
|
||||
_task_context_alias=''$(''$taskcommand show | grep alias.*context | cut -d' ' -f1 | cut -d. -f2)
|
||||
|
||||
|
||||
_task()
|
||||
{
|
||||
local cur prev opts base
|
||||
|
||||
|
||||
COMPREPLY=()
|
||||
cur="''${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="''${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
|
@ -143,11 +143,11 @@
|
|||
# echo -e "\ncur='''$cur'"
|
||||
# echo "prev='''$prev'"
|
||||
# echo "prev2='''$prev2'"
|
||||
|
||||
|
||||
abbrev_min=''$(''$taskcommand show | grep "abbreviation.minimum" | awk {'print ''$2'})
|
||||
commands_aliases=''$(echo ''$(''$taskcommand _commands; ''$taskcommand _aliases) | tr " " "\n"|sort|tr "\n" " ")
|
||||
opts="''$commands_aliases ''$(''$taskcommand _columns)"
|
||||
|
||||
|
||||
case "''${prev}" in
|
||||
''$_task_context_alias|cont|conte|contex|context)
|
||||
_task_offer_contexts
|
||||
|
|
@ -237,7 +237,7 @@
|
|||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
COMPREPLY=( ''$(compgen -W "''${opts}" -- ''${cur}) )
|
||||
return 0
|
||||
}
|
||||
|
|
@ -257,7 +257,7 @@
|
|||
{
|
||||
echo "annotate cancel config continue day delete diagnostics export extensions gaps get help join lengthen modify month move report resize shorten show split start stop summary tag tags track undo untag week"
|
||||
}
|
||||
|
||||
|
||||
function __get_subcommands()
|
||||
{
|
||||
case "''${1}" in
|
||||
|
|
@ -269,17 +269,17 @@
|
|||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
function __get_help_items()
|
||||
{
|
||||
echo -e "''$( __get_commands ) interval hints date duration dom"
|
||||
}
|
||||
|
||||
|
||||
function __get_options()
|
||||
{
|
||||
echo -e "--help --verbose --version"
|
||||
}
|
||||
|
||||
|
||||
function __get_ids()
|
||||
{
|
||||
local count
|
||||
|
|
@ -290,17 +290,17 @@
|
|||
seq -f "@%g" 1 "''${count}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function __get_tags()
|
||||
{
|
||||
timew tags | tail -n +4 -- | sed -e "s|[[:space:]]*-''$||"
|
||||
}
|
||||
|
||||
|
||||
function __get_extensions()
|
||||
{
|
||||
timew extensions | awk '{if(NR>6)print ''$1}'
|
||||
}
|
||||
|
||||
|
||||
function __has_entered_id()
|
||||
{
|
||||
for word in "''${COMP_WORDS[@]}" ; do
|
||||
|
|
@ -308,14 +308,14 @@
|
|||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
function __has_entered_subcommand()
|
||||
{
|
||||
local subcommands=''$( __get_subcommands "''${1}" )
|
||||
|
||||
|
||||
for word in "''${COMP_WORDS[@]}" ; do
|
||||
for cmd in ''${subcommands} ; do
|
||||
if [[ "''${word}" == "''${cmd}" ]] ; then
|
||||
|
|
@ -323,14 +323,14 @@
|
|||
fi
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
function __has_entered_help_item()
|
||||
{
|
||||
local items=''$( __get_help_items )
|
||||
|
||||
|
||||
for word in "''${COMP_WORDS[@]:2}" ; do
|
||||
for item in ''${items} ; do
|
||||
if [[ "''${word}" == "''${item}" ]] ; then
|
||||
|
|
@ -338,10 +338,10 @@
|
|||
fi
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
function __is_entering_id()
|
||||
{
|
||||
if [[ "''${COMP_WORDS[COMP_CWORD]}" =~ @[0-9]* ]] ; then
|
||||
|
|
@ -350,36 +350,36 @@
|
|||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function __complete_tag()
|
||||
{
|
||||
COMPREPLY=()
|
||||
cur="''${COMP_WORDS[COMP_CWORD]}"
|
||||
local line wordlist
|
||||
|
||||
|
||||
declare -a wordlist
|
||||
while IFS=''$'\n' read -r line ; do
|
||||
wordlist+=( "''${line}" )
|
||||
done <<< "''$( __get_tags )"
|
||||
|
||||
|
||||
declare -a completions
|
||||
while read -r line ; do
|
||||
completions+=( "''${line}" )
|
||||
done < <( compgen -W "''$(printf '%q ' "''${wordlist[@]}")" -- "''${cur}" 2>/dev/null )
|
||||
|
||||
|
||||
for completion in "''${completions[@]}" ; do
|
||||
COMPREPLY+=( "''$(printf "%q" "''${completion}")" )
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function _timew()
|
||||
{
|
||||
local cur first wordlist
|
||||
|
||||
|
||||
COMPREPLY=()
|
||||
cur="''${COMP_WORDS[COMP_CWORD]}"
|
||||
first="''${COMP_WORDS[1]}"
|
||||
|
||||
|
||||
case "''${first}" in
|
||||
cancel|config|diagnostics|day|extensions|get|month|show|undo|week)
|
||||
wordlist=""
|
||||
|
|
@ -425,10 +425,10 @@
|
|||
wordlist=''$( __get_commands )
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
COMPREPLY=(''$( compgen -W "''${wordlist}" -- "''${cur}" ))
|
||||
}
|
||||
|
||||
|
||||
complete -F _timew timew
|
||||
complete -F _timew tt
|
||||
'';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue