docopt-compgen 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d80128550098ba94a9a1356e193321811a256fa4598af6e35ec352239a8ebae
4
- data.tar.gz: 591f5fea08948f09ebe008d48e2efb05edf84659a9f51e413594ff1bca465bc7
3
+ metadata.gz: bb0c497d240588d088c975448cdf72354f26bbb7eaf093f7f49d605f9fd605ed
4
+ data.tar.gz: b00a7f2e4b0cd01bcf9886ddc018012ee3ea7b44969099ddce3ff6b27ff7204b
5
5
  SHA512:
6
- metadata.gz: '09ddc20292a5a3f9b6c047e41e35e63365dc80e5f4b077e8e85dc015520a72b222e3850dd1ca06b0865f68da2e8cea46127f1c70f95f4ddd7c7b4ba13609f8c6'
7
- data.tar.gz: 8522dd62dd630bf968486038894061e3f151d0055ce6b5f81a781673bc8d7354688bcbb5b8b5e274d23bfa5d1a516dc4013e2bb235fa38d666993486bf632591
6
+ metadata.gz: d5d2b99b19724d97ed7ddba682b953452d936e76baa30818ec66f2346fe0b5b80807d2eb6567d09f5732c9d89b9e1dc22a10c537f734ed94206bf963113b2441
7
+ data.tar.gz: 2e0700092b8aa3c663a5434c86d7370af24734293d162427889cd2acd62e8d658a26ee8d201bdd4ad2872c7a52d00c22fac427f6c9b23a764409a7b629a0f355
data/bin/docopt-compgen CHANGED
@@ -14,6 +14,7 @@ usage = <<~EOF
14
14
  --command-name NAME Command name
15
15
  If not specified then the slugified basename of <command> will be used
16
16
  --namespace NAME Prefix for generated bash functions [default: cmd]
17
+ --header TEXT Header to insert at the start of the completion script
17
18
  -v, --version Show version
18
19
  -h, --help Show help
19
20
  EOF
@@ -76,6 +77,7 @@ generator = DocoptCompgen::Generator.new(
76
77
  parser.to_node,
77
78
  command_name: command_name,
78
79
  namespace: opts['--namespace'],
80
+ header: opts['--header'],
79
81
  )
80
82
 
81
83
  output = generator.to_s
@@ -1,10 +1,11 @@
1
1
  module DocoptCompgen
2
2
  class Generator
3
- def initialize(command, node, command_name: nil, namespace: nil)
3
+ def initialize(command, node, command_name: nil, namespace: nil, header: nil)
4
4
  @command = command ? File.basename(command) : command_name
5
5
  @node = node
6
6
  @command_name = command_name || Util.slugify(@command)
7
7
  @namespace = '_' + namespace
8
+ @header = header
8
9
  end
9
10
 
10
11
  def indent(str, level)
@@ -119,7 +120,7 @@ module DocoptCompgen
119
120
  return <<~EOF
120
121
  #!/bin/bash
121
122
  # shellcheck disable=SC2207
122
-
123
+ #{@header ? @header + "\n" : ''}
123
124
  #{content}
124
125
  complete -o bashdefault -o default -o filenames -F #{@namespace}_#{@command_name} #{@command}
125
126
  EOF
@@ -1,3 +1,3 @@
1
1
  module DocoptCompgen
2
- VERSION = '1.4.0'
2
+ VERSION = '1.5.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.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - crdx
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-25 00:00:00.000000000 Z
11
+ date: 2023-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize