docopt-compgen 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/docopt-compgen +2 -1
- data/lib/docopt-compgen/parser.rb +5 -6
- data/lib/docopt-compgen/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7533273b1b8e479735f5314a7a4cf04bc8249fd244d44b6f9c612b08c9601bca
|
4
|
+
data.tar.gz: 0d7b952ae774b16b6dcf900ed9f7ef3ef1b3139e2cef2f935793f02625eadd50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 845886a43d2ebd84efdcb2462b5f6cc00c718c97eb0cc704df969c325caa90e5b2030e43e62c4bb7d564a610e8caa5cebd4ba5328640468e526fb7eecb21c019
|
7
|
+
data.tar.gz: 2078c30e502311eafd5cc0159d7fdb5faf97769fe35290d1aa0c51fb4fc2175e41f4349f8be9f80495d3a82b4c90921fd8da14542160d6bebb977c435661bd5f
|
data/bin/docopt-compgen
CHANGED
@@ -8,6 +8,7 @@ usage = <<~EOF
|
|
8
8
|
#{File.basename($0)} [options] [<command>]
|
9
9
|
|
10
10
|
Options:
|
11
|
+
--complete-short Complete short options (long options are always completed)
|
11
12
|
--command-name NAME Command name
|
12
13
|
If not specified then the slugified basename of <command> will be used
|
13
14
|
--namespace NAME Prefix for generated bash functions [default: cmd]
|
@@ -61,7 +62,7 @@ end
|
|
61
62
|
|
62
63
|
require_relative '../lib/docopt-compgen'
|
63
64
|
|
64
|
-
parser = DocoptCompgen::Parser.new(usage)
|
65
|
+
parser = DocoptCompgen::Parser.new(usage, complete_short: opts['--complete-short'])
|
65
66
|
generator = DocoptCompgen::Generator.new(
|
66
67
|
command,
|
67
68
|
parser.to_node,
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module DocoptCompgen
|
2
2
|
class Parser
|
3
|
-
def initialize(help)
|
3
|
+
def initialize(help, complete_short: false)
|
4
4
|
@help = help
|
5
|
+
@complete_short = complete_short
|
5
6
|
end
|
6
7
|
|
7
8
|
def to_node
|
@@ -55,17 +56,15 @@ module DocoptCompgen
|
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
58
|
-
# rubocop:disable Style/SoleNestedConditional
|
59
59
|
if [Docopt::Option].include?(pattern.class)
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
if pattern.short && @complete_short
|
61
|
+
node.add_option(pattern.short)
|
62
|
+
end
|
63
63
|
|
64
64
|
if pattern.long
|
65
65
|
node.add_option(pattern.long)
|
66
66
|
end
|
67
67
|
end
|
68
|
-
# rubocop:enable Style/SoleNestedConditional
|
69
68
|
|
70
69
|
if [Docopt::Argument].include?(pattern.class)
|
71
70
|
node.add_argument(pattern.name)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docopt-compgen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- crdx
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|