Add completions for query filters
This commit is contained in:
		
							parent
							
								
									5df9de3abb
								
							
						
					
					
						commit
						3f407a326d
					
				| @ -3,7 +3,7 @@ | ||||
| 
 | ||||
| all: command-options hledger-completion.bash | ||||
| 
 | ||||
| hledger-completion.bash: hledger-completion.bash.m4 commands-list.txt generic-options.txt | ||||
| hledger-completion.bash: hledger-completion.bash.m4 commands-list.txt query-filters.txt generic-options.txt | ||||
| 	m4 hledger-completion.bash.m4 > $@ | ||||
| 
 | ||||
| generic-options.txt: | ||||
|  | ||||
| @ -76,7 +76,8 @@ _hledger_completion_function() { | ||||
| 	# be passed! | ||||
| 
 | ||||
| 	declare -a accounts | ||||
| 	readarray -t accounts < <(hledger accounts --flat | grep "^$wordToComplete") | ||||
| 	readarray -t accounts < <({ cat "$_HLEDGER_COMPLETION_TEMPDIR/query-filters.txt"; hledger accounts --flat; } | grep "^$wordToComplete") | ||||
| 	compopt -o nospace | ||||
| 	COMPREPLY+=( "${accounts[@]}" ) | ||||
| 	# Special characters (e.g. '-', ':') are allowed in account names. | ||||
| 	# Account names with spaces must be still be quoted (e.g. '"Expens') | ||||
| @ -128,6 +129,31 @@ cf | ||||
| is | ||||
| TEXT | ||||
| 
 | ||||
| cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/query-filters.txt" | ||||
| not: | ||||
| acct: | ||||
| amt: | ||||
| amt:< | ||||
| amt:<= | ||||
| amt:> | ||||
| amt:>= | ||||
| code: | ||||
| cur: | ||||
| desc: | ||||
| date: | ||||
| date2: | ||||
| depth: | ||||
| note: | ||||
| payee: | ||||
| real: | ||||
| real:0 | ||||
| status: | ||||
| status:! | ||||
| status:* | ||||
| tag: | ||||
| inacct: | ||||
| TEXT | ||||
| 
 | ||||
| cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/generic-options.txt" | ||||
| -f | ||||
| -I | ||||
|  | ||||
| @ -76,7 +76,8 @@ _hledger_completion_function() { | ||||
| 	# be passed! | ||||
| 
 | ||||
| 	declare -a accounts | ||||
| 	readarray -t accounts < <(hledger accounts --flat | grep "^$wordToComplete") | ||||
| 	readarray -t accounts < <({ cat "$_HLEDGER_COMPLETION_TEMPDIR/query-filters.txt"; hledger accounts --flat; } | grep "^$wordToComplete") | ||||
| 	compopt -o nospace | ||||
| 	COMPREPLY+=( "${accounts[@]}" ) | ||||
| 	# Special characters (e.g. '-', ':') are allowed in account names. | ||||
| 	# Account names with spaces must be still be quoted (e.g. '"Expens') | ||||
| @ -98,6 +99,10 @@ cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/commands.txt" | ||||
| include(`commands.txt')dnl | ||||
| TEXT | ||||
| 
 | ||||
| cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/query-filters.txt" | ||||
| include(`query-filters.txt')dnl | ||||
| TEXT | ||||
| 
 | ||||
| cat <<TEXT > "$_HLEDGER_COMPLETION_TEMPDIR/generic-options.txt" | ||||
| include(`generic-options.txt')dnl | ||||
| TEXT | ||||
|  | ||||
							
								
								
									
										22
									
								
								shell-completion/query-filters.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								shell-completion/query-filters.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | ||||
| not: | ||||
| acct: | ||||
| amt: | ||||
| amt:< | ||||
| amt:<= | ||||
| amt:> | ||||
| amt:>= | ||||
| code: | ||||
| cur: | ||||
| desc: | ||||
| date: | ||||
| date2: | ||||
| depth: | ||||
| note: | ||||
| payee: | ||||
| real: | ||||
| real:0 | ||||
| status: | ||||
| status:! | ||||
| status:* | ||||
| tag: | ||||
| inacct: | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user