Update README
This commit is contained in:
		
							parent
							
								
									3c4025ae19
								
							
						
					
					
						commit
						3ab796fd9e
					
				| @ -15,8 +15,8 @@ The completions can handle hledger's CLI: | |||||||
| 
 | 
 | ||||||
| - commands and generic options | - commands and generic options | ||||||
| - command-specific options | - command-specific options | ||||||
| - filenames for options that take a filename as argument | - most option arguments | ||||||
| - account names from journal files (but not yet for files named by `--file`) | - account names, tags, payees, etc. from journal files | ||||||
| - query filter keywords like `status:`, `tag:`, or `amt:` | - query filter keywords like `status:`, `tag:`, or `amt:` | ||||||
| 
 | 
 | ||||||
| Installation for end users | Installation for end users | ||||||
| @ -27,22 +27,45 @@ Completions are currently only implemented for the Bash shell. | |||||||
| Please check first if the completions for hledger are already installed on your | Please check first if the completions for hledger are already installed on your | ||||||
| distribution. Refer to the last paragraph of this section for how to test that. | distribution. Refer to the last paragraph of this section for how to test that. | ||||||
| 
 | 
 | ||||||
| To install the completions manually, follow this steps: | To install from the repository, do: | ||||||
| 
 | 
 | ||||||
| - Download or copy the file `shell-completion/hledger-completion.bash` and save | ``` sh | ||||||
|   it as `~/.hledger-completion.bash`. | cd /path-to-repo/shell-completion | ||||||
|  | make install | ||||||
|  | ``` | ||||||
| 
 | 
 | ||||||
| - Add the command `source ~/.hledger-completion.bash` this to the end of your | Completions installed this way will be loaded dynamically after you use the hledger | ||||||
|   `~/.bashrc` file. | command. Upon the first invocation of a command that has no predefined completion | ||||||
|  | bash looks for a file with the same name in a set of predefined locations in this order: | ||||||
| 
 | 
 | ||||||
| - Then, you have to start a new Bash, e.g. by typing `bash` on the current | - $BASH_COMPLETION_USER_DIR/completions | ||||||
|   shell. | - $XDG_DATA_HOME/bash-completion/completions | ||||||
|  | - $HOME/.local/share/bash-completion/completions | ||||||
|  | - etc. | ||||||
| 
 | 
 | ||||||
| Example installation script: | You can manually achieve the effects of `make install` by copying | ||||||
|  | `shell-completion/hledger-completion.bash` to one of the above, and renaming it | ||||||
|  | to `hledger`, `_hledger` or `hledger.bash`. For the gory details, type this in a | ||||||
|  | bash shell: | ||||||
|  | 
 | ||||||
|  | ``` sh | ||||||
|  | type __load_completion | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | To install the completions manually, you can also just download and copy | ||||||
|  | `shell-completion/hledger-completion.bash` to a directory of your choosing, and | ||||||
|  | source it from your shell start up files. This way completions are loaded | ||||||
|  | eagerly and that adds a delay to shell start up time. | ||||||
|  | 
 | ||||||
|  | Example: | ||||||
| 
 | 
 | ||||||
| ``` | ``` | ||||||
| cp hledger-completion.bash ~/.hledger-completion.bash | cp hledger-completion.bash ~/.bash_completion.d/hledger | ||||||
| echo 'source ~/.hledger-completion.bash' >> ~/.bashrc | echo 'source ~/.bash_completion.d/hledger' >> ~/.bashrc | ||||||
|  | # Restart shell | ||||||
|  | exec bash | ||||||
|  | # Confirm that completion is loaded | ||||||
|  | complete -p hledger | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| Now, try it by typing `hledger` (with a space after the command) and press the | Now, try it by typing `hledger` (with a space after the command) and press the | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user