Fix according to coding convention

- Don't define global variables
- add command prefix to avoid conflicting names
This commit is contained in:
Shohei YOSHIDA 2024-12-11 00:03:21 +09:00
parent 8f1b90cd4b
commit a9c9c72fae
No known key found for this signature in database
GPG Key ID: C9A1BB11BB940CF2
1 changed files with 13 additions and 17 deletions

View File

@ -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
@ -92,8 +88,8 @@ _yfm() {
_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'