Cosmetic changes
This commit is contained in:
parent
872484729e
commit
e3826be379
@ -15,11 +15,10 @@ set -o pipefail
|
|||||||
# for example grepping an array or map a substitution on it.
|
# for example grepping an array or map a substitution on it.
|
||||||
# Therefore, we create temp files in RAM for completion suggestions (see below).
|
# Therefore, we create temp files in RAM for completion suggestions (see below).
|
||||||
|
|
||||||
declare -g HLEDGER_COMPLETION_TEMPDIR
|
readonly HLEDGER_COMPLETION_TEMPDIR=$(mktemp -d)
|
||||||
HLEDGER_COMPLETION_TEMPDIR=$(mktemp -d)
|
|
||||||
|
|
||||||
hledgerCompletionFunction() {
|
hledgerCompletionFunction() {
|
||||||
declare cmd=$1
|
#declare cmd=$1
|
||||||
declare wordToComplete=$2
|
declare wordToComplete=$2
|
||||||
declare precedingWord=$3
|
declare precedingWord=$3
|
||||||
|
|
||||||
@ -52,7 +51,6 @@ hledgerCompletionFunction() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ -n $completeFiles ]]; then
|
if [[ -n $completeFiles ]]; then
|
||||||
:
|
|
||||||
#COMP_WORDBREAKS='= '
|
#COMP_WORDBREAKS='= '
|
||||||
COMPREPLY+=( $(compgen -df | grep "^$filenameSoFar") )
|
COMPREPLY+=( $(compgen -df | grep "^$filenameSoFar") )
|
||||||
|
|
||||||
@ -62,7 +60,8 @@ hledgerCompletionFunction() {
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
# Almost all subcommands accpt [QUERY] -> always add accounts to completion list
|
# Almost all subcommands accept [QUERY]
|
||||||
|
# -> always add accounts to completion list
|
||||||
|
|
||||||
COMP_WORDBREAKS=' '
|
COMP_WORDBREAKS=' '
|
||||||
COMPREPLY+=( $(hledger accounts --flat | grep "^$wordToComplete") )
|
COMPREPLY+=( $(hledger accounts --flat | grep "^$wordToComplete") )
|
||||||
@ -71,10 +70,11 @@ hledgerCompletionFunction() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Register completion function for hledger:
|
||||||
complete -F hledgerCompletionFunction hledger
|
complete -F hledgerCompletionFunction hledger
|
||||||
|
|
||||||
# Include lists of commands and options generated by the Makefile using m4
|
# Include lists of commands and options generated by the Makefile using the
|
||||||
# macro processor.
|
# m4 macro processor.
|
||||||
# Included files must have exactly one newline at EOF to prevent weired errors.
|
# Included files must have exactly one newline at EOF to prevent weired errors.
|
||||||
|
|
||||||
cat <<TEXT > "$HLEDGER_COMPLETION_TEMPDIR/commands.txt"
|
cat <<TEXT > "$HLEDGER_COMPLETION_TEMPDIR/commands.txt"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user