docopt-compgen 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c87d112789dd4ea1b0830ab3c5d004bf4e56fd42565de0c058cc3245ad9c58d
4
- data.tar.gz: 1145fcc4bab68d7414deab14eceae576cc2902d8b35155219c47990171907d21
3
+ metadata.gz: 7533273b1b8e479735f5314a7a4cf04bc8249fd244d44b6f9c612b08c9601bca
4
+ data.tar.gz: 0d7b952ae774b16b6dcf900ed9f7ef3ef1b3139e2cef2f935793f02625eadd50
5
5
  SHA512:
6
- metadata.gz: 52cfc2f51e175ad014c4c575eb5da8cdaab2e1e2e8ad7473c0a6827d2c5775f68d9ae9a6782034c505d87abb4d5ba9a7f27c204fc52e660d651458360c06be43
7
- data.tar.gz: eba600aa23409e5a9ee18c72991c32f1e5ed5a82805afc3f5943c9fd2fde3549f21cdc915904b62915677be006ae27f4a5fad90ff64cec5d9b4e474dbb676539
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
- # if pattern.short
61
- # node.add_option(pattern.short)
62
- # end
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)
@@ -1,3 +1,3 @@
1
1
  module DocoptCompgen
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  end
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.1.0
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-06 00:00:00.000000000 Z
11
+ date: 2021-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize