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 +4 -4
- data/bin/docopt-compgen +2 -0
- data/lib/docopt_compgen/generator.rb +3 -2
- 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: bb0c497d240588d088c975448cdf72354f26bbb7eaf093f7f49d605f9fd605ed
|
4
|
+
data.tar.gz: b00a7f2e4b0cd01bcf9886ddc018012ee3ea7b44969099ddce3ff6b27ff7204b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.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:
|
11
|
+
date: 2023-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|