From 1b16b6c697d96f8db4c707f625a392e610a62f85 Mon Sep 17 00:00:00 2001 From: guesswhozzz Date: Tue, 10 Dec 2024 16:30:04 +0300 Subject: [PATCH 1/9] Add completion script for yfm (diplodoc cli) --- src/_yfm | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 src/_yfm diff --git a/src/_yfm b/src/_yfm new file mode 100644 index 0000000..e2b96ac --- /dev/null +++ b/src/_yfm @@ -0,0 +1,122 @@ +#compdef yfm +# ------------------------------------------------------------------------------ +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the zsh-users nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for diplodoc cli v4.49.1 (https://diplodoc.com/en/) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Egor Lem / egorlem.com +# +# ------------------------------------------------------------------------------ + +_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() { + _alternative 'directory::_directories' ':current directory:(.)' && return 0 +} + +_yfm_commands() { + _describe 'commands' _commands +} + +_yfm() { + local context state state_descr line + typeset -A opt_args + + local -a file_types=( + html md + ) + + _arguments \ + '(-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' \ + '(--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]' \ + '(--quiet, -q)'{--quiet,-q}'[Start in quiet mode]' \ + '(--config, -c)'{--config,-c}'[Path to the configuration file]:filename:_files' \ + '(--singlePage)'--singlePage'[Build the project as a single HTML file]' \ + '(--output-format)'--output-format'[Generation format]:TEXT' \ + '(--apply-presets)'--apply-presets'[Substitute variable values from presets when building in YFM]:TEXT' \ + '(--add-system-meta)'--add-system-meta'[Add variables from the system presets section to metadata files]' \ + '(--remove-hidden-toc-items)'--remove-hidden-toc-items'[Remove hidden pages from the build result]' \ + '(--version)'--version'[Current version]' \ + '(--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' \ + '*:: :->command_args' + + case $state in + command_args) + case $words[1] in + publish) + _arguments \ + '(--endpoint)'--endpoint'[Endpoint of S3 storage]:url:_urls' \ + '(--bucket)'--bucket'[Bucket name of S3 storage]' \ + '(--prefix)'--prefix'[Bucket internal scope of S3 storage]' \ + '(--access-key-id)'--access-key-id'[Key Id of S3 storage]' \ + '(--secret-access-key)'--secret-access-key'[Secret key of S3 storage]' \ + '(--region)'--region'[Region of S3 storage]' \ + '(--hidden)'--hidden'[Do not upload paths matched by glob]' \ + '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' \ + '(--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' + ;; + + *) + _default + ;; + esac + ;; + esac +} + +_yfm "$@" + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et From a0effab9505857441a9bd049d76b97447526b6a0 Mon Sep 17 00:00:00 2001 From: guesswhozzz Date: Tue, 10 Dec 2024 16:43:06 +0300 Subject: [PATCH 2/9] Remove unused file_types var --- src/_yfm | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/_yfm b/src/_yfm index e2b96ac..b0deeb7 100644 --- a/src/_yfm +++ b/src/_yfm @@ -52,10 +52,6 @@ _yfm() { local context state state_descr line typeset -A opt_args - local -a file_types=( - html md - ) - _arguments \ '(-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' \ From b97fdbd1a60187633ca357783cbaa53910c21725 Mon Sep 17 00:00:00 2001 From: guesswhozzz Date: Tue, 10 Dec 2024 17:09:07 +0300 Subject: [PATCH 3/9] Fix typo --- src/_yfm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/_yfm b/src/_yfm index b0deeb7..5610ce2 100644 --- a/src/_yfm +++ b/src/_yfm @@ -53,13 +53,13 @@ _yfm() { typeset -A opt_args _arguments \ - '(-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:_suggest_dir' \ + '(-o --output)'{-o,--output}'[Configure path to yfm output directory]:dir:_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]' \ - '(--quiet, -q)'{--quiet,-q}'[Start in quiet mode]' \ - '(--config, -c)'{--config,-c}'[Path to the configuration file]:filename:_files' \ + '(--vars -v)'{--vars,-v}'[Values of variables]:TEXT' \ + '(--strict -s)'{--strict,-s}'[Launch in strict mode]' \ + '(--quiet -q)'{--quiet,-q}'[Start in quiet mode]' \ + '(--config -c)'{--config,-c}'[Path to the configuration file]:filename:_files' \ '(--singlePage)'--singlePage'[Build the project as a single HTML file]' \ '(--output-format)'--output-format'[Generation format]:TEXT' \ '(--apply-presets)'--apply-presets'[Substitute variable values from presets when building in YFM]:TEXT' \ @@ -107,8 +107,6 @@ _yfm() { esac } -_yfm "$@" - # Local Variables: # mode: Shell-Script # sh-indentation: 2 From 8f1b90cd4be645edf8663080f19ffe93d82da70f Mon Sep 17 00:00:00 2001 From: guesswhozzz Date: Tue, 10 Dec 2024 17:31:22 +0300 Subject: [PATCH 4/9] Add help argument --- src/_yfm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_yfm b/src/_yfm index 5610ce2..86c8ad4 100644 --- a/src/_yfm +++ b/src/_yfm @@ -53,6 +53,7 @@ _yfm() { typeset -A opt_args _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' \ '(--varsPreset)'--varsPreset'[Name of the variable preset used]:TEXT' \ @@ -65,7 +66,6 @@ _yfm() { '(--apply-presets)'--apply-presets'[Substitute variable values from presets when building in YFM]:TEXT' \ '(--add-system-meta)'--add-system-meta'[Add variables from the system presets section to metadata files]' \ '(--remove-hidden-toc-items)'--remove-hidden-toc-items'[Remove hidden pages from the build result]' \ - '(--version)'--version'[Current version]' \ '(--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]' \ From a9c9c72fae09d568aa8bfcf15251e999679607b0 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Wed, 11 Dec 2024 00:03:21 +0900 Subject: [PATCH 5/9] Fix according to coding convention - Don't define global variables - add command prefix to avoid conflicting names --- src/_yfm | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/_yfm b/src/_yfm index 86c8ad4..eccd635 100644 --- a/src/_yfm +++ b/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' From e7068f9923dc031d5f6a384d9a7b43002f68262e Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Wed, 11 Dec 2024 11:44:38 +0900 Subject: [PATCH 6/9] Set argument parameter to options that take an argument --- src/_yfm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/_yfm b/src/_yfm index eccd635..efe6265 100644 --- a/src/_yfm +++ b/src/_yfm @@ -74,26 +74,26 @@ _yfm() { publish) _arguments \ '(--endpoint)'--endpoint'[Endpoint of S3 storage]:url:_urls' \ - '(--bucket)'--bucket'[Bucket name of S3 storage]' \ - '(--prefix)'--prefix'[Bucket internal scope of S3 storage]' \ - '(--access-key-id)'--access-key-id'[Key Id of S3 storage]' \ - '(--secret-access-key)'--secret-access-key'[Secret key of S3 storage]' \ - '(--region)'--region'[Region of S3 storage]' \ - '(--hidden)'--hidden'[Do not upload paths matched by glob]' \ + '(--bucket)'--bucket'[Bucket name of S3 storage]:bucket' \ + '(--prefix)'--prefix'[Bucket internal scope of S3 storage]:bucket_internal_scope' \ + '(--access-key-id)'--access-key-id'[Key Id of S3 storage]:key_id' \ + '(--secret-access-key)'--secret-access-key'[Secret key of S3 storage]:secret_key' \ + '(--region)'--region'[Region of S3 storage]:region' \ + '(--hidden)'--hidden'[Do not upload paths matched by glob]:pattern' \ '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' \ + '(--source)'--source'[Language code of the original document in ISO 639-1 format]:language' \ + '(--target)'--target'[Language code of the translated document in ISO 639-1 format]:language' \ '(--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' - ;; + ;; *) _default From 1ae4ab5dc2c57babe8f1cfad847c9c2ff6bdf82e Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Wed, 11 Dec 2024 12:33:11 +0900 Subject: [PATCH 7/9] Remove needless configurations --- src/_yfm | 67 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/src/_yfm b/src/_yfm index efe6265..3118ce5 100644 --- a/src/_yfm +++ b/src/_yfm @@ -42,65 +42,68 @@ _yfm_suggest_dir() { _yfm() { local context state state_descr line typeset -A opt_args + local ret=1 - local commands=( + local -a 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 -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)'--varsPreset'[Name of the variable preset used]:TEXT' \ - '(--vars -v)'{--vars,-v}'[Values of variables]:TEXT' \ - '(--strict -s)'{--strict,-s}'[Launch in strict mode]' \ - '(--quiet -q)'{--quiet,-q}'[Start in quiet mode]' \ - '(--config -c)'{--config,-c}'[Path to the configuration file]:filename:_files' \ - '(--singlePage)'--singlePage'[Build the project as a single HTML file]' \ - '(--output-format)'--output-format'[Generation format]:TEXT' \ - '(--apply-presets)'--apply-presets'[Substitute variable values from presets when building in YFM]:TEXT' \ - '(--add-system-meta)'--add-system-meta'[Add variables from the system presets section to metadata files]' \ - '(--remove-hidden-toc-items)'--remove-hidden-toc-items'[Remove hidden pages from the build result]' \ - '(--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]' \ + '--varsPreset[Name of the variable preset used]:TEXT' \ + '(-v --vars)'{--vars,-v}'[Values of variables]:TEXT' \ + '(-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]' \ '1: :(($commands))' \ - '*:: :->command_args' + '*:: :->command_args' && ret=0 case $state in command_args) case $words[1] in publish) _arguments \ - '(--endpoint)'--endpoint'[Endpoint of S3 storage]:url:_urls' \ - '(--bucket)'--bucket'[Bucket name of S3 storage]:bucket' \ - '(--prefix)'--prefix'[Bucket internal scope of S3 storage]:bucket_internal_scope' \ - '(--access-key-id)'--access-key-id'[Key Id of S3 storage]:key_id' \ - '(--secret-access-key)'--secret-access-key'[Secret key of S3 storage]:secret_key' \ - '(--region)'--region'[Region of S3 storage]:region' \ - '(--hidden)'--hidden'[Do not upload paths matched by glob]:pattern' \ + '--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' \ + '--region[Region of S3 storage]:region' \ + '--hidden[Do not upload paths matched by glob]:pattern' \ '1: :_files' \ - '*:: :->command_args' + && ret=0 ;; translate) _arguments \ - '(--source)'--source'[Language code of the original document in ISO 639-1 format]:language' \ - '(--target)'--target'[Language code of the translated document in ISO 639-1 format]:language' \ - '(--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' + '--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' \ + && ret=0 ;; *) - _default + _default && ret=0 ;; esac ;; esac + + return ret } # Local Variables: From bb6d6ba990d142e8ff8a7062bdf0fe3bb356aa31 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Wed, 11 Dec 2024 14:32:16 +0900 Subject: [PATCH 8/9] Update completion according to the help documents --- src/_yfm | 100 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 70 insertions(+), 30 deletions(-) diff --git a/src/_yfm b/src/_yfm index 3118ce5..6bbfb52 100644 --- a/src/_yfm +++ b/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 From 375d578d840b4b13a63441713c72467be6105377 Mon Sep 17 00:00:00 2001 From: guesswhozzz Date: Wed, 11 Dec 2024 08:53:45 +0300 Subject: [PATCH 9/9] Update authors block --- src/_yfm | 1 + 1 file changed, 1 insertion(+) diff --git a/src/_yfm b/src/_yfm index 6bbfb52..856838a 100644 --- a/src/_yfm +++ b/src/_yfm @@ -31,6 +31,7 @@ # Authors # ------- # +# * Shohei Yoshida (https://github.com/syohex) # * Egor Lem / egorlem.com # # ------------------------------------------------------------------------------