Add doc on adding support for other shells
This commit is contained in:
		
							parent
							
								
									84eaf20f9b
								
							
						
					
					
						commit
						a2dc1289a5
					
				| @ -54,3 +54,28 @@ The Bash completion script is generated (GNU make) by parsing output of `hledger | ||||
| `hledger -h`, and `hledger <cmd> -h`. The script also uses `hledger accounts` for | ||||
| account name completion. I propose that the Makefile is not run at every built | ||||
| but rather manually when the CLI changes. | ||||
| 
 | ||||
| Completion scripts for other shells (e.g. Fish or Zsh) | ||||
| ------------------------------------------------------ | ||||
| 
 | ||||
| You're welcome to add completion scripts for other shells. It should not be too | ||||
| hard! All available hledger options and commands are already there (generated by | ||||
| the Makefile). | ||||
| 
 | ||||
| The generated text files with options and commands are: `commands.txt`, | ||||
| `generic-options.txt`, and `options-*.txt` where `*` is the subcommand. | ||||
| 
 | ||||
| Instructions to add support for another shell: | ||||
| 
 | ||||
| 1. Create e.g. `hledger-completion.fish.m4` as a template file. | ||||
| 
 | ||||
| 2. Add a Make rule to transform it to `hledger-completion.fish`. | ||||
| 
 | ||||
| 3. Use m4 commands to include hledger options and commands into your script | ||||
|    template. See `hledger-completion.bash.m4` as a reference. | ||||
| 
 | ||||
| 4. Use `make` and then `make hledger-completion.fish` to create and test the | ||||
|    completion script. | ||||
| 
 | ||||
| 5. Finally, if everything is working, also add the generated artifact | ||||
|    `hledger-completion.fish` to the repo so that people can use it directly. | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user