76 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			76 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| # alias-related tests
 | |
| 
 | |
| # 1. alias directive. The pattern is a case-insensitive regular
 | |
| # expression matching anywhere in the account name. All matching
 | |
| # aliases will be applied to an account name in turn, most recently
 | |
| # declared first. The replacement can replace multiple matches within
 | |
| # the account name.  The replacement pattern supports numeric
 | |
| # backreferences.
 | |
| #
 | |
| hledgerdev -f- print
 | |
| <<<
 | |
| alias a=b
 | |
| 
 | |
| 2011/01/01
 | |
|     A a  1
 | |
|     a a  2
 | |
|     c
 | |
| 
 | |
| alias A (.)=\1
 | |
| 
 | |
| 2011/01/01
 | |
|     A a  1
 | |
|     a a  2
 | |
|     c
 | |
| 
 | |
| >>>
 | |
| 2011/01/01
 | |
|     b b             1
 | |
|     b b             2
 | |
|     c              -3
 | |
| 
 | |
| 2011/01/01
 | |
|     b             1
 | |
|     b             2
 | |
|     c            -3
 | |
| 
 | |
| >>>=0
 | |
| 
 | |
| # 2. command-line --alias option. These are applied in the order
 | |
| # written. Spaces are allowed if quoted.
 | |
| # 
 | |
| hledgerdev -f- print --alias 'A (.)=a' --alias a=b
 | |
| <<<
 | |
| 2011/01/01
 | |
|     a a  1
 | |
|     A a  2
 | |
|     c
 | |
| 
 | |
| >>>
 | |
| 2011/01/01
 | |
|     b             1
 | |
|     b             2
 | |
|     c            -3
 | |
| 
 | |
| >>>=0
 | |
| 
 | |
| # 3. Alias options run after alias directives.
 | |
| #
 | |
| hledgerdev -f- print --alias a=A --alias B=C --alias B=D --alias C=D
 | |
| <<<
 | |
| alias ^a=B
 | |
| alias ^a=E
 | |
| alias E=F
 | |
| 
 | |
| 2011/01/01
 | |
|     [a:x]    1
 | |
|     [x:a:x]
 | |
| 
 | |
| >>>
 | |
| 2011/01/01
 | |
|     [E:x]             1
 | |
|     [x:A:x]            -1
 | |
| 
 | |
| >>>2
 | |
| >>>=0
 |