Fix according to coding convention
- Don't define global variables - add command prefix to avoid conflicting names
This commit is contained in:
parent
8f1b90cd4b
commit
a9c9c72fae
30
src/_yfm
30
src/_yfm
|
@ -24,7 +24,7 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
#
|
||||
# Completion script for diplodoc cli v4.49.1 (https://diplodoc.com/en/)
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
@ -35,27 +35,23 @@
|
|||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
_commands=(
|
||||
'publish:Publish built documentation in target aws s3 compatible storage'
|
||||
'translate:Translate documentation from source to target language using configured translation provider'
|
||||
)
|
||||
|
||||
_suggest_dir() {
|
||||
_yfm_suggest_dir() {
|
||||
_alternative 'directory::_directories' ':current directory:(.)' && return 0
|
||||
}
|
||||
|
||||
_yfm_commands() {
|
||||
_describe 'commands' _commands
|
||||
}
|
||||
|
||||
_yfm() {
|
||||
local context state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
local commands=(
|
||||
'publish:Publish built documentation in target aws s3 compatible storage'
|
||||
'translate:Translate documentation from source to target language using configured translation provider'
|
||||
)
|
||||
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[Show help message]' \
|
||||
'(-i --input)'{-i,--input}'[Configure path to yfm input directory]:dir:_suggest_dir' \
|
||||
'(-o --output)'{-o,--output}'[Configure path to yfm output directory]:dir:_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' \
|
||||
'(--varsPreset)'--varsPreset'[Name of the variable preset used]:TEXT' \
|
||||
'(--vars -v)'{--vars,-v}'[Values of variables]:TEXT' \
|
||||
'(--strict -s)'{--strict,-s}'[Launch in strict mode]' \
|
||||
|
@ -69,7 +65,7 @@ _yfm() {
|
|||
'(--lint-disabled)'--lint-disabled'[Should whether to turn off a linter]' \
|
||||
'(--build-disabled)'--build-disabled'[Should whether to turn off a build]' \
|
||||
'(--add-map-file)'--add-map-file'[hould add all paths of documentation into file.json]' \
|
||||
'1: :_yfm_commands' \
|
||||
'1: :(($commands))' \
|
||||
'*:: :->command_args'
|
||||
|
||||
case $state in
|
||||
|
@ -87,13 +83,13 @@ _yfm() {
|
|||
'1: :_files' \
|
||||
'*:: :->command_args'
|
||||
;;
|
||||
|
||||
|
||||
translate)
|
||||
_arguments \
|
||||
'(--source)'--source'[Language code of the original document in ISO 639-1 format]:TEXT' \
|
||||
'(--target)'--target'[Language code of the translated document in ISO 639-1 format]:TEXT' \
|
||||
'(--input)'--input'[Source path to the documentation]:dir:_suggest_dir' \
|
||||
'(--target)'--target'[Target path to the translated documentation]:dir:_suggest_dir' \
|
||||
'(--input)'--input'[Source path to the documentation]:dir:_yfm_suggest_dir' \
|
||||
'(--target)'--target'[Target path to the translated documentation]:dir:_yfm_suggest_dir' \
|
||||
'(--include)'--include'[A set of rules for filtering sent translation files]:filename:_files' \
|
||||
'(--exclude)'--exclude'[A set of rules prohibiting sending files for translation]:filename:_files' \
|
||||
'*:: :->command_args'
|
||||
|
|
Loading…
Reference in New Issue