This way we can easily edit m4 in m4-mode and the shell script stub in sh-mode and prevent subtle errors coming from accidental quoting issues or macros (mis)interpreted by m4.
		
			
				
	
	
		
			30 lines
		
	
	
		
			815 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			815 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| include(`hledger-completion.bash.stub')dnl
 | |
| 
 | |
| # Include lists of commands and options generated by the Makefile using the
 | |
| # m4 macro processor.
 | |
| # Included files must have exactly one newline at EOF to prevent weired errors.
 | |
| 
 | |
| read -r -d "" _hledger_complist_commands <<TEXT
 | |
| include(`commands.txt')dnl
 | |
| TEXT
 | |
| 
 | |
| read -r -d "" _hledger_complist_query_filters <<TEXT
 | |
| include(`query-filters.txt')dnl
 | |
| TEXT
 | |
| 
 | |
| read -r -d "" _hledger_complist_generic_options <<TEXT
 | |
| include(`generic-options.txt')dnl
 | |
| TEXT
 | |
| 
 | |
| # Dashes are replaced by m4 with underscores to form valid identifiers
 | |
| # Referenced by indirect expansion of $subcommandOptions
 | |
| dnl
 | |
| include(`foreach2.m4')dnl
 | |
| foreach(`cmd', (include(`commands-list.txt')), `
 | |
| read -r -d "" _hledger_complist_options_`'translit(cmd, -, _) <<TEXT
 | |
| include(options-cmd.txt)dnl
 | |
| TEXT
 | |
| ')dnl
 | |
| 
 | |
| return 0
 |