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