Update completion according to the help documents
This commit is contained in:
		
							parent
							
								
									1ae4ab5dc2
								
							
						
					
					
						commit
						bb6d6ba990
					
				
							
								
								
									
										100
									
								
								src/_yfm
								
								
								
								
							
							
						
						
									
										100
									
								
								src/_yfm
								
								
								
								
							|  | @ -45,60 +45,98 @@ _yfm() { | |||
|   local ret=1 | ||||
| 
 | ||||
|   local -a commands=( | ||||
|     'build:Build documentation in target directory' | ||||
|     'publish:Publish built documentation in target aws s3 compatible storage' | ||||
|     'translate:Translate documentation from source to target language using configured translation provider' | ||||
|   ) | ||||
| 
 | ||||
|   _arguments -C \ | ||||
|     '(- *)'{-h,--help}'[Show help message]' \ | ||||
|     '(-i --input)'{-i,--input}'[Configure path to yfm input directory]:dir:_yfm_suggest_dir' \ | ||||
|     '(-o --output)'{-o,--output}'[Configure path to yfm output directory]:dir:_yfm_suggest_dir' \ | ||||
|     '--varsPreset[Name of the variable preset used]:TEXT' \ | ||||
|     '(-v --vars)'{--vars,-v}'[Values of variables]:TEXT' \ | ||||
|   local -a build_flags=( | ||||
|     '(-i --input)'{-i,--input}'[Configure path to yfm input directory]:dir:_yfm_suggest_dir' | ||||
|     '(-o --output)'{-o,--output}'[Configure path to yfm output directory]:dir:_yfm_suggest_dir' | ||||
|     \*{--lang,--langs}'[Configure langs supported by build]:lang' | ||||
|     '(-f --output-format)'{-f,--output-format}'[Format of output files]:format:(html md)' | ||||
|     '--vars-preset[Select vars preset of documentation]:preset' | ||||
|     \*{-v,--vars}'[Values of variables]:variable' | ||||
|     '--allow-html[Allow to use HTML in Markdown files]' | ||||
|     '--sanitize-html[Toggle transformed HTML sanitizing]' | ||||
|     '--add-map-file[Should add all paths of documentation into file.json]' | ||||
|     '--remove-hidden-toc-items[Remove hidden pages from the build result]' | ||||
|     '--merge-includes[Merge includes syntax during md to md processing]' | ||||
|     \*{--resource,--resources}'[Custom resources into statically generated pages]:resource' | ||||
|     '--allow-custom-resources[Allow loading custom resources into statically generated pages]' | ||||
|     '--static-content[Static content]' | ||||
|     '--add-system-meta[Should add system section variables from presets into files meta data]' | ||||
|     '*--ignore[Do not process paths matches by glob]:pattern' | ||||
|     '--ignore-stage[Ignore tocs with stage]:stage:(skip)' | ||||
|     '(-c --config)'{-c,--config}'[Path to the configuration file]:filename:_files' | ||||
|     '--build-disabled[Disable building]' | ||||
|     '(--template --no-template)--template[Select liquid template engine mode]:template:(all text code)' | ||||
|     '(--template --no-template)--no-template[Disable template engine]' | ||||
|     '--contributors[Should attach contributors into files]' | ||||
|     '--ignore-author-patterns[Ignore authors if they contain passed string]:pattern' | ||||
|     '--single-page[Build a single page in the output folder also]' | ||||
|     '--no-lint[Disable file linting]' | ||||
|     '--changelogs[Toggle processing of experimental changelogs syntax]' | ||||
|     '--search[Enable search functionality]' | ||||
|   ) | ||||
| 
 | ||||
|   local -a global_flags=( | ||||
|     '(- *)--help[Show help message]' | ||||
|     '(- *)--version[Output the version number]' | ||||
|     \*{-e,--extensions}'[Include external extention on startup]:extension:_files' | ||||
|     '(-q --quiet)'{--quiet,-q}'[Start in quiet mode]' | ||||
|     '(-s --strict)'{--strict,-s}'[Launch in strict mode]' \ | ||||
|     '(-q --quiet)'{--quiet,-q}'[Start in quiet mode]' \ | ||||
|     '(-c --config)'{--config,-c}'[Path to the configuration file]:filename:_files' \ | ||||
|     '--single-page[Build the project as a single HTML file]' \ | ||||
|     '--output-format[Generation format]:TEXT' \ | ||||
|     '--apply-presets[Substitute variable values from presets when building in YFM]:TEXT' \ | ||||
|     '--add-system-meta[Add variables from the system presets section to metadata files]' \ | ||||
|     '--remove-hidden-toc-items[Remove hidden pages from the build result]' \ | ||||
|     '--lint-disabled[Should whether to turn off a linter]' \ | ||||
|     '--build-disabled[Should whether to turn off a build]' \ | ||||
|     '--add-map-file[hould add all paths of documentation into file.json]' \ | ||||
|   ) | ||||
| 
 | ||||
|   _arguments -C \ | ||||
|     ${global_flags[@]} \ | ||||
|     ${build_flags[@]} \ | ||||
|     '1: :(($commands))' \ | ||||
|     '*:: :->command_args' && ret=0 | ||||
| 
 | ||||
|   case $state in | ||||
|     command_args) | ||||
|     (command_args) | ||||
|       case $words[1] in | ||||
|         publish) | ||||
|         (build) | ||||
|           _arguments \ | ||||
|             ${build_flags[@]} \ | ||||
|             '*:: :_files' \ | ||||
|             && ret=0 | ||||
|           ;; | ||||
|         (publish) | ||||
|           _arguments \ | ||||
|             '(-i --input)'{-i,--input}'[Configure path to publish input directory]:dir:_yfm_suggest_dir' \ | ||||
|             '--endpoint[Endpoint of S3 storage]:url:_urls' \ | ||||
|             '--bucket[Bucket name of S3 storage]:bucket' \ | ||||
|             '--prefix[Bucket internal scope of S3 storage]:bucket_internal_scope' \ | ||||
|             '--access-key-id[Key Id of S3 storage]:key_id' \ | ||||
|             '--secret-access-key[Secret key of S3 storage]:secret_key' \ | ||||
|             '(-c --config)'{-c,--config}'[Configure path to publish config]:filename:_files' \ | ||||
|             '--region[Region of S3 storage]:region' \ | ||||
|             '--hidden[Do not upload paths matched by glob]:pattern' \ | ||||
|             '1: :_files' \ | ||||
|             '*:: :_files' \ | ||||
|             && ret=0 | ||||
|           ;; | ||||
| 
 | ||||
|         translate) | ||||
|         (translate) | ||||
|           _arguments \ | ||||
|             '--source[Language code of the original document in ISO 639-1 format]:language' \ | ||||
|             '--target[Language code of the translated document in ISO 639-1 format]:language' \ | ||||
|             '--input[Source path to the documentation]:dir:_yfm_suggest_dir' \ | ||||
|             '--target[Target path to the translated documentation]:dir:_yfm_suggest_dir' \ | ||||
|             '--include[A set of rules for filtering sent translation files]:filename:_files' \ | ||||
|             '--exclude[A set of rules prohibiting sending files for translation]:filename:_files' \ | ||||
|             '(-i --input)'{-i,--input}'[Configure path to translate input directory]:dir:_yfm_suggest_dir' \ | ||||
|             '(-o --output)'{-o,--output}'[Configure path to translate output directory]:dir:_yfm_suggest_dir' \ | ||||
|             '--provider[Configure translation service provider]:provider:(yandex)' \ | ||||
|             '(-sl --source)'{-sl,--source}'[Language code of the original document in ISO 639-1 format]:language' \ | ||||
|             '(-tl --target)'{-tl,--target}'[Language code of the translated document in ISO 639-1 format]:language' \ | ||||
|             '*--files[List of paths need to be translated]:file:_files' \ | ||||
|             '*--include[A set of rules for filtering sent translation files]:filename:_files' \ | ||||
|             '*--exclude[A set of rules prohibiting sending files for translation]:filename:_files' \ | ||||
|             \*{-v,--vars}'[Pass list of variables directory to translation]:variable' \ | ||||
|             '--dry-run[Do not execute traget translation provider, but only calculate required quota]' \ | ||||
|             '(-c --config)'{-c,--config}'[Configure path to translate config]:filename:_files' \ | ||||
|             '--auth[Authorization token for Translation API]:token' \ | ||||
|             '--folder[ID of the folder to which you have access]:id' \ | ||||
|             '--glossary[Path to yaml file with glossary translation pairs]:file:_files' \ | ||||
|             '*:: :_files' \ | ||||
|             && ret=0 | ||||
|           ;; | ||||
| 
 | ||||
|         *) | ||||
|           _default && ret=0 | ||||
|         ;; | ||||
|       esac | ||||
|     ;; | ||||
|   esac | ||||
|  | @ -106,6 +144,8 @@ _yfm() { | |||
|   return ret | ||||
| } | ||||
| 
 | ||||
| _yfm "$@" | ||||
| 
 | ||||
| # Local Variables: | ||||
| # mode: Shell-Script | ||||
| # sh-indentation: 2 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue