Add command tag-list.
This commit is contained in:
		
							parent
							
								
									a7b0ae4898
								
							
						
					
					
						commit
						1a944f574e
					
				
					 1 changed files with 23 additions and 0 deletions
				
			
		|  | @ -454,6 +454,17 @@ def tag_breplace_argparse(args): | |||
|             tag.add_synonym(tag_name) | ||||
|     photodb.commit() | ||||
| 
 | ||||
| def tag_list_argparse(args): | ||||
|     photodb = find_photodb() | ||||
|     tags = photodb.get_all_tag_names() | ||||
|     synonyms = photodb.get_all_synonyms() | ||||
|     keys = sorted(tags.union(synonyms.keys())) | ||||
|     for key in keys: | ||||
|         if key in synonyms: | ||||
|             print(f'{key}={synonyms[key]}') | ||||
|         else: | ||||
|             print(key) | ||||
| 
 | ||||
| DOCSTRING = ''' | ||||
| Etiquette CLI | ||||
| ============= | ||||
|  | @ -490,6 +501,8 @@ Etiquette CLI | |||
| 
 | ||||
| {tag_breplace} | ||||
| 
 | ||||
| {tag_list} | ||||
| 
 | ||||
| At any time, you may add --silent, --quiet, --debug, --loud to change logging. | ||||
| 
 | ||||
| You can add --yes to avoid the "Commit?" prompt. | ||||
|  | @ -788,6 +801,13 @@ tag_breplace: | |||
| 
 | ||||
|     > etiquette_cli.py tag_breplace replace_from replace_to | ||||
| '''.strip(), | ||||
| 
 | ||||
| tag_list=''' | ||||
| tag_list: | ||||
|     Show all tags in the database. | ||||
| 
 | ||||
|     > etiquette_cli.py tag_list | ||||
| ''' | ||||
| ) | ||||
| 
 | ||||
| DOCSTRING = betterhelp.add_previews(DOCSTRING, SUB_DOCSTRINGS) | ||||
|  | @ -928,6 +948,9 @@ def main(argv): | |||
|     p_tag_breplace.add_argument('--yes', dest='autoyes', action='store_true') | ||||
|     p_tag_breplace.set_defaults(func=tag_breplace_argparse) | ||||
| 
 | ||||
|     p_tag_list = subparsers.add_parser('tag_list', aliases=['tag-list']) | ||||
|     p_tag_list.set_defaults(func=tag_list_argparse) | ||||
| 
 | ||||
|     ## | ||||
| 
 | ||||
|     def pp(args): | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue