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 ret=1
|
||||||
|
|
||||||
local -a commands=(
|
local -a commands=(
|
||||||
|
'build:Build documentation in target directory'
|
||||||
'publish:Publish built documentation in target aws s3 compatible storage'
|
'publish:Publish built documentation in target aws s3 compatible storage'
|
||||||
'translate:Translate documentation from source to target language using configured translation provider'
|
'translate:Translate documentation from source to target language using configured translation provider'
|
||||||
)
|
)
|
||||||
|
|
||||||
_arguments -C \
|
local -a build_flags=(
|
||||||
'(- *)'{-h,--help}'[Show help message]' \
|
'(-i --input)'{-i,--input}'[Configure path to yfm input directory]:dir:_yfm_suggest_dir'
|
||||||
'(-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'
|
||||||
'(-o --output)'{-o,--output}'[Configure path to yfm output directory]:dir:_yfm_suggest_dir' \
|
\*{--lang,--langs}'[Configure langs supported by build]:lang'
|
||||||
'--varsPreset[Name of the variable preset used]:TEXT' \
|
'(-f --output-format)'{-f,--output-format}'[Format of output files]:format:(html md)'
|
||||||
'(-v --vars)'{--vars,-v}'[Values of variables]:TEXT' \
|
'--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]' \
|
'(-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]' \
|
_arguments -C \
|
||||||
'--output-format[Generation format]:TEXT' \
|
${global_flags[@]} \
|
||||||
'--apply-presets[Substitute variable values from presets when building in YFM]:TEXT' \
|
${build_flags[@]} \
|
||||||
'--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]' \
|
|
||||||
'1: :(($commands))' \
|
'1: :(($commands))' \
|
||||||
'*:: :->command_args' && ret=0
|
'*:: :->command_args' && ret=0
|
||||||
|
|
||||||
case $state in
|
case $state in
|
||||||
command_args)
|
(command_args)
|
||||||
case $words[1] in
|
case $words[1] in
|
||||||
publish)
|
(build)
|
||||||
_arguments \
|
_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' \
|
'--endpoint[Endpoint of S3 storage]:url:_urls' \
|
||||||
'--bucket[Bucket name of S3 storage]:bucket' \
|
'--bucket[Bucket name of S3 storage]:bucket' \
|
||||||
'--prefix[Bucket internal scope of S3 storage]:bucket_internal_scope' \
|
'--prefix[Bucket internal scope of S3 storage]:bucket_internal_scope' \
|
||||||
'--access-key-id[Key Id of S3 storage]:key_id' \
|
'--access-key-id[Key Id of S3 storage]:key_id' \
|
||||||
'--secret-access-key[Secret key of S3 storage]:secret_key' \
|
'--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' \
|
'--region[Region of S3 storage]:region' \
|
||||||
'--hidden[Do not upload paths matched by glob]:pattern' \
|
'--hidden[Do not upload paths matched by glob]:pattern' \
|
||||||
'1: :_files' \
|
'*:: :_files' \
|
||||||
&& ret=0
|
&& ret=0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
translate)
|
(translate)
|
||||||
_arguments \
|
_arguments \
|
||||||
'--source[Language code of the original document in ISO 639-1 format]:language' \
|
'(-i --input)'{-i,--input}'[Configure path to translate input directory]:dir:_yfm_suggest_dir' \
|
||||||
'--target[Language code of the translated document in ISO 639-1 format]:language' \
|
'(-o --output)'{-o,--output}'[Configure path to translate output directory]:dir:_yfm_suggest_dir' \
|
||||||
'--input[Source path to the documentation]:dir:_yfm_suggest_dir' \
|
'--provider[Configure translation service provider]:provider:(yandex)' \
|
||||||
'--target[Target path to the translated documentation]:dir:_yfm_suggest_dir' \
|
'(-sl --source)'{-sl,--source}'[Language code of the original document in ISO 639-1 format]:language' \
|
||||||
'--include[A set of rules for filtering sent translation files]:filename:_files' \
|
'(-tl --target)'{-tl,--target}'[Language code of the translated document in ISO 639-1 format]:language' \
|
||||||
'--exclude[A set of rules prohibiting sending files for translation]:filename:_files' \
|
'*--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
|
&& ret=0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
|
||||||
_default && ret=0
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -106,6 +144,8 @@ _yfm() {
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_yfm "$@"
|
||||||
|
|
||||||
# Local Variables:
|
# Local Variables:
|
||||||
# mode: Shell-Script
|
# mode: Shell-Script
|
||||||
# sh-indentation: 2
|
# sh-indentation: 2
|
||||||
|
|
Loading…
Reference in New Issue