From fb88ab8756cc4e172db79e82fc1bad8a14115837 Mon Sep 17 00:00:00 2001 From: Takuya Noguchi Date: Sun, 26 Jun 2022 02:59:14 +0000 Subject: [PATCH] Allow / as a separator for options Signed-off-by: Takuya Noguchi --- command-reference.md | 6 +++--- lib/options_list_markdownizer.rb | 2 +- spec/options_list_markdownizer_spec.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/command-reference.md b/command-reference.md index 130b702..bada072 100644 --- a/command-reference.md +++ b/command-reference.md @@ -614,7 +614,7 @@ Install a gem into the local repository * `--without GROUPS` - Omit the named groups (comma separated) when installing from a gem dependencies file * `--default` - Add the gem's full specification to specifications/default and extract only its bin * `--explain` - Rather than install the gems, indicate which would be installed -* `--[no-]lock` - Create a lock file (when used with `-g`/--file) +* `--[no-]lock` - Create a lock file (when used with `-g`/`--file`) * `--[no-]suggestions` - Suggest alternates when gems are not found ### Local/Remote Options @@ -996,7 +996,7 @@ Restores installed gems to pristine condition from files located in the gem cach ### Options * `--all` - Restore all installed gems to pristine condition -* `--skip=gem_name` - used on `--all,` skip if name == gem_name +* `--skip=gem_name` - used on `--all`, skip if name == gem_name * `--[no-]extensions` - Restore gems with extensions in addition to regular gems * `--only-executables` - Only restore executables * `--only-plugins` - Only restore plugins @@ -1608,7 +1608,7 @@ Update installed gems to the latest version * `--without GROUPS` - Omit the named groups (comma separated) when installing from a gem dependencies file * `--default` - Add the gem's full specification to specifications/default and extract only its bin * `--explain` - Rather than install the gems, indicate which would be installed -* `--[no-]lock` - Create a lock file (when used with `-g`/--file) +* `--[no-]lock` - Create a lock file (when used with `-g`/`--file`) * `--[no-]suggestions` - Suggest alternates when gems are not found ### Local/Remote Options diff --git a/lib/options_list_markdownizer.rb b/lib/options_list_markdownizer.rb index 555355a..8e21d95 100644 --- a/lib/options_list_markdownizer.rb +++ b/lib/options_list_markdownizer.rb @@ -50,6 +50,6 @@ def markdownize_options(line) private def markdownize_inline_options(line) - line.gsub(/(?<=\s)(--[^\s]+|-[^\s])/, '`\1`') + line.gsub(/(?<=[\s\/])(--[\w\[\]\-]+|-\w)/, '`\1`') end end diff --git a/spec/options_list_markdownizer_spec.rb b/spec/options_list_markdownizer_spec.rb index 00d0408..593788b 100644 --- a/spec/options_list_markdownizer_spec.rb +++ b/spec/options_list_markdownizer_spec.rb @@ -51,8 +51,8 @@ 'short option and boolean switch long', ], [ - " -K, --private-key KEY Key for --sign or --build\n", - " `-K, --private-key KEY` Key for `--sign` or `--build`\n", + " -K, --private-key KEY Key for --sign or --build. -g/--file can be used.\n", + " `-K, --private-key KEY` Key for `--sign` or `--build`. `-g`/`--file` can be used.\n", 'long option in description', ], [