bashly 0.4.5 → 0.6.1
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 +4 -4
- data/README.md +143 -29
- data/lib/bashly/commands/add.rb +82 -0
- data/lib/bashly/concerns/completions.rb +47 -0
- data/lib/bashly/concerns/renderable.rb +1 -4
- data/lib/bashly/models/base.rb +3 -0
- data/lib/bashly/models/command.rb +2 -0
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/command/command_fallback.erb +45 -0
- data/lib/bashly/views/command/command_filter.erb +1 -19
- data/lib/bashly/views/command/footer.erb +2 -0
- data/lib/bashly/views/command/usage.erb +1 -0
- metadata +26 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a6c888335f32b6223149d91ed739e189ffbc6921afec05ff709380c76387338
|
4
|
+
data.tar.gz: b964b4ac7a5fa86f8766b350a3240ee00882be5cfc574e97f001a832a506e342
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1e2757a735e55ffc4d4b27633d6df020184521ed8eb6377c0f26f8edd7442d28fb2a3c56c056de4558aab2204f7d522e15df6374f1962fcbaf26226f590d22b
|
7
|
+
data.tar.gz: a8aa77fba152f005136ff8ee8aacdc7236f15975042c4066f6d94e7e400133e2ca4137ffbbe9bc6f458c2aae2784aa956721d9179862cd78bf95ec6f99f39bd3
|
data/README.md
CHANGED
@@ -15,6 +15,7 @@ Create beautiful bash scripts from simple YAML configuration
|
|
15
15
|
|
16
16
|
</div>
|
17
17
|
|
18
|
+
|
18
19
|
## Table of Contents
|
19
20
|
|
20
21
|
- [Table of Contents](#table-of-contents)
|
@@ -24,18 +25,19 @@ Create beautiful bash scripts from simple YAML configuration
|
|
24
25
|
- [Usage](#usage)
|
25
26
|
- [Using the input arguments in your code](#using-the-input-arguments-in-your-code)
|
26
27
|
- [Examples](#examples)
|
27
|
-
- [Sample configuration for a script without commands](#sample-configuration-for-a-script-without-commands)
|
28
|
-
- [Sample configuration for a script with commands](#sample-configuration-for-a-script-with-commands)
|
29
28
|
- [Configuration Reference](#configuration-reference)
|
30
29
|
- [Command options](#command-options)
|
31
30
|
- [Argument options](#argument-options)
|
32
31
|
- [Flag options](#flag-options)
|
33
32
|
- [Environment Variable options](#environment-variable-options)
|
33
|
+
- [Extensible Scripts](#extensible-scripts)
|
34
|
+
- [Bash Completions](#bash-completions)
|
34
35
|
- [Real World Examples](#real-world-examples)
|
35
36
|
- [Contributing / Support](#contributing--support)
|
36
37
|
|
37
38
|
---
|
38
39
|
|
40
|
+
|
39
41
|
## Installation
|
40
42
|
|
41
43
|
```shell
|
@@ -74,6 +76,7 @@ Bahsly is responsible for:
|
|
74
76
|
- Optional or required **option flags** (with or without flag arguments).
|
75
77
|
- **Commands** (and subcommands).
|
76
78
|
- Standard flags (like **--help** and **--version**).
|
79
|
+
- Preventing your script from running unless the command line is valid.
|
77
80
|
- Providing you with a place to input your code for each of the functions
|
78
81
|
your tool performs, and merging it back to the final script.
|
79
82
|
- Providing you with additional (optional) framework-style, standard
|
@@ -81,10 +84,20 @@ Bahsly is responsible for:
|
|
81
84
|
- **Color output**.
|
82
85
|
- **Config file management** (INI format).
|
83
86
|
- **YAML parsing**.
|
87
|
+
- **Bash completions**.
|
84
88
|
- and more.
|
85
89
|
|
90
|
+
|
86
91
|
## Usage
|
87
92
|
|
93
|
+
The `bashly.yml` file can be set up to generate two types of scripts:
|
94
|
+
|
95
|
+
1. Script with commands (for example, like `docker` or `git`).
|
96
|
+
2. Script without commands (for example, like `ls`)
|
97
|
+
|
98
|
+
This is detected automatically by the contents of the configuration: If it
|
99
|
+
contains a `commands` definition, it will generate a script with commands.
|
100
|
+
|
88
101
|
In an empty directory, create a sample configuration file by running
|
89
102
|
|
90
103
|
```shell
|
@@ -152,32 +165,11 @@ $ ./download a --force
|
|
152
165
|
downloading a with --force
|
153
166
|
```
|
154
167
|
|
155
|
-
## Examples
|
156
168
|
|
157
|
-
|
158
|
-
|
159
|
-
1. Script with commands (for example, like `docker` or `git`).
|
160
|
-
2. Script without commands (for example, like `ls`)
|
161
|
-
|
162
|
-
This is detected automatically by the contents of the configuration: If it
|
163
|
-
contains a `commands` definition, it will generate a script with commands.
|
164
|
-
|
165
|
-
|
166
|
-
### Sample configuration for a script without commands
|
167
|
-
|
168
|
-
- Generate this script by running `bashly generate --minimal`
|
169
|
-
- [See the initial sample bashly.yml file](examples/minimal/src/bashly.yml)
|
170
|
-
- [See the generated bash script](examples/minimal/download)
|
171
|
-
|
172
|
-
### Sample configuration for a script with commands
|
173
|
-
|
174
|
-
- Generate this script by running `bashly generate`
|
175
|
-
- [See the initial sample bashly.yml file](examples/commands/src/bashly.yml)
|
176
|
-
- [See the generated bash script](examples/commands/cli)
|
177
|
-
|
178
|
-
|
179
|
-
See the [examples](examples) folder for more examples.
|
169
|
+
## Examples
|
180
170
|
|
171
|
+
The [examples folder](examples#readme) contains many detailed and documented
|
172
|
+
example configuration files, with their output.
|
181
173
|
|
182
174
|
|
183
175
|
## Configuration Reference
|
@@ -203,14 +195,17 @@ command and subcommands (under the `commands` definition).
|
|
203
195
|
`help` | The header text to display when using `--help`. This option can have multiple lines. In this case, the first line will be used as summary wherever appropriate.
|
204
196
|
`version` | The string to display when using `--version`. *Applicable only in the main command*.
|
205
197
|
`default` | Setting this to `true` on any command, will cause any unrecognized command line to be passed to this command. *Applicable only in subcommands*.
|
198
|
+
`extensible` | Specify that this command can be [externally extended](#extensible-scripts). *Applicable only in the main command*.
|
206
199
|
`examples` | Specify an array of examples to show when using `--help`. Each example can have multiple lines.
|
207
200
|
`environment_variables` | Specify an array of [environment variables](#environment-variable-options) needed by your script.
|
208
201
|
`commands` | Specify the array of [commands](#command-options). Each command will have its own args and flags. Note: if `commands` is provided, you cannot specify flags or args at the same level.
|
209
202
|
`args` | Specify the array of [positional arguments](#argument-options) this script needs.
|
210
203
|
`flags` | Specify the array of option [flags](#flag-options) this script needs.
|
204
|
+
`completions` | Specify an array of additional completion suggestions when used in conjunction with `bashly add comp`. See [Bash Completions](#bash-completions).
|
211
205
|
`catch_all` | Specify that this command should allow for additional arbitrary arguments or flags. It can be set in one of three ways:<br>- Set to `true` to just enable it.<br>- Set to a string, to use this string in the usage help text.<br>- Set to a hash containing `label` and `help` keys, to show a detailed help for it when running with `--help`.
|
212
206
|
`dependencies` | Specify an array of any required external dependencies (commands). The script execution will be halted with a friendly error unless all dependency commands exist.
|
213
207
|
`group` | In case you have many commands, use this option to specify a caption to display before this command. This option is purely for display purposes, and needs to be specified only for the first command in each group.
|
208
|
+
`footer` | Add a custom message that will be displayed at the end of the `--help` text.
|
214
209
|
|
215
210
|
### Argument options
|
216
211
|
|
@@ -247,9 +242,7 @@ The `-v` and `-h` flags will be used as the short options for `--version` and
|
|
247
242
|
`--help` respectively **only if you are not using them in any of your own
|
248
243
|
flags**.
|
249
244
|
|
250
|
-
### Environment
|
251
|
-
|
252
|
-
The below configuration generates this environment variable usage text:
|
245
|
+
### Environment variable options
|
253
246
|
|
254
247
|
If an environment variable is defined as required (false by default), the
|
255
248
|
execution of the script will be halted with a friendly error if it is not
|
@@ -262,6 +255,125 @@ set.
|
|
262
255
|
`required` | Specify if this variable is required.
|
263
256
|
|
264
257
|
|
258
|
+
## Extensible Scripts
|
259
|
+
|
260
|
+
You may configure your generated bash script to delegate any unknown command
|
261
|
+
to an external executable, by setting the `extensible` option to either `true`,
|
262
|
+
or to a different external command.
|
263
|
+
|
264
|
+
This is similar to how `git` works. When you execute `git whatever`, the `git`
|
265
|
+
command will look for a file named `git-whatever` in the path, and execute it.
|
266
|
+
|
267
|
+
Note that this option cannot be specified together with the `default` option,
|
268
|
+
since both specify a handler for unknown commands.
|
269
|
+
|
270
|
+
The `extensible` option supports two operation modes:
|
271
|
+
|
272
|
+
### Extension Mode (`extensible: true`)
|
273
|
+
|
274
|
+
By setting `extensible` to `true`, a specially named executable will be called
|
275
|
+
when an unknown command is called by the user.
|
276
|
+
|
277
|
+
Given this `bashly.yml` configuration:
|
278
|
+
|
279
|
+
```yaml
|
280
|
+
name: myscript
|
281
|
+
help: Example
|
282
|
+
version: 0.1.0
|
283
|
+
extensible: true
|
284
|
+
|
285
|
+
commands:
|
286
|
+
- name: upload
|
287
|
+
help: Upload a file
|
288
|
+
```
|
289
|
+
|
290
|
+
And this user command:
|
291
|
+
|
292
|
+
```
|
293
|
+
$ myscript something
|
294
|
+
|
295
|
+
```
|
296
|
+
|
297
|
+
The generated script will look for an executable named `myscript-something`
|
298
|
+
in the path. If found, it will be called.
|
299
|
+
|
300
|
+
See the [extensible example](examples/extensible).
|
301
|
+
|
302
|
+
|
303
|
+
### Delegate Mode (`extensible: <executable name>`)
|
304
|
+
|
305
|
+
By setting `extensible` to any string, unknown command calls by the user will
|
306
|
+
be delegated to the executable with that name.
|
307
|
+
|
308
|
+
Given this `bashly.yml` configuration:
|
309
|
+
|
310
|
+
```yaml
|
311
|
+
name: mygit
|
312
|
+
help: Example
|
313
|
+
version: 0.1.0
|
314
|
+
extensible: git
|
315
|
+
|
316
|
+
commands:
|
317
|
+
- name: push
|
318
|
+
help: Push to my repository
|
319
|
+
```
|
320
|
+
|
321
|
+
And this user command:
|
322
|
+
|
323
|
+
```
|
324
|
+
$ mygit status
|
325
|
+
|
326
|
+
```
|
327
|
+
|
328
|
+
The generated script will execute `git status`.
|
329
|
+
|
330
|
+
See the [extensible-delegate example](examples/extensible-delegate).
|
331
|
+
|
332
|
+
|
333
|
+
## Bash Completions
|
334
|
+
|
335
|
+
Bashly comes with built-in bash completions generator, provided by the
|
336
|
+
[completely][completely] gem.
|
337
|
+
|
338
|
+
By running any of the `bashly add comp` commands, you can add this
|
339
|
+
functionality to your script in one of three ways:
|
340
|
+
|
341
|
+
- `bashly add comp function` - creates a function in your `./src/lib` directory
|
342
|
+
that echoes a completion script. You can then call this function from any
|
343
|
+
command (for example `yourcli completions`) and your users will be able to
|
344
|
+
install the completions by running `eval "$(yourcli completions)"`.
|
345
|
+
- `bashly add comp script` - creates a standalone completion script that can be
|
346
|
+
sourced or copies to the system's bash completions directory.
|
347
|
+
- `bashly add comp yaml` - creates the "raw data" YAML file. This is intended
|
348
|
+
mainly for development purposes.
|
349
|
+
|
350
|
+
The bash completions generation is completely automatic, and you will have to
|
351
|
+
rerun the `bashly add comp *` command whenever you change your `bashly.yml`
|
352
|
+
file.
|
353
|
+
|
354
|
+
In addition to suggesting subcommands and flags, you can instruct bashly to
|
355
|
+
also suggest files, directories, users, git branches and more. To do this,
|
356
|
+
add another option in your `bashly.yml` on the command you wish to alter:
|
357
|
+
|
358
|
+
```yaml
|
359
|
+
# bashly.yml
|
360
|
+
commands:
|
361
|
+
- name: upload
|
362
|
+
help: Upload a file
|
363
|
+
completions:
|
364
|
+
- <directory>
|
365
|
+
- <user>
|
366
|
+
- $(git branch 2> /dev/null)
|
367
|
+
|
368
|
+
```
|
369
|
+
|
370
|
+
- Anything between `<...>` will be added using the `compgen -A action` flag.
|
371
|
+
- Anything else, will be appended to the `compgen -W` flag.
|
372
|
+
|
373
|
+
For more information about these custom completions, see the documentation for
|
374
|
+
the [completely][completely] gem.
|
375
|
+
|
376
|
+
|
265
377
|
## Real World Examples
|
266
378
|
|
267
379
|
- [Rush][rush] - a Personal Package Manager
|
@@ -280,3 +392,5 @@ to contribute, feel free to [open an issue][issues].
|
|
280
392
|
[rush]: https://github.com/DannyBen/rush-cli
|
281
393
|
[alf]: https://github.com/DannyBen/alf
|
282
394
|
[git-changelog]: https://github.com/DannyBen/git-changelog
|
395
|
+
[completely]: https://github.com/DannyBen/completely
|
396
|
+
[compgen]: https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion-Builtins.html
|
data/lib/bashly/commands/add.rb
CHANGED
@@ -8,15 +8,24 @@ module Bashly
|
|
8
8
|
usage "bashly add config [--force]"
|
9
9
|
usage "bashly add colors [--force]"
|
10
10
|
usage "bashly add yaml [--force]"
|
11
|
+
usage "bashly add comp FORMAT [OUTPUT]"
|
11
12
|
usage "bashly add (-h|--help)"
|
12
13
|
|
13
14
|
option "-f --force", "Overwrite existing files"
|
14
15
|
|
16
|
+
param "FORMAT", "Output format, can be one of:\n function : generate a function file to be included in your script.\n script : generate a standalone bash completions script\n yaml : generate a yaml compatible with 'completely'"
|
17
|
+
param "OUTPUT", "For the 'comp function' command: Name of the generated function.\nFor the 'comp script' or 'comp yaml' commands: path to output file.\nIn all cases, this is optional and will have sensible defaults."
|
18
|
+
|
15
19
|
command "strings", "Copy an additional configuration file to your project, allowing you to customize all the tips and error strings."
|
16
20
|
command "lib", "Create the additional lib directory for additional user scripts. All *.sh scripts in this folder will be included in the final bash script."
|
17
21
|
command "config", "Add standard functions for handling INI files to the lib directory."
|
18
22
|
command "colors", "Add standard functions for printing colorful and formatted text to the lib directory."
|
19
23
|
command "yaml", "Add standard functions for reading YAML files to the lib directory."
|
24
|
+
command "comp", "Generate a bash completions script or function."
|
25
|
+
|
26
|
+
example "bashly add strings --force"
|
27
|
+
example "bashly add comp function"
|
28
|
+
example "bashly add comp script completions.bash"
|
20
29
|
|
21
30
|
environment "BASHLY_SOURCE_DIR", "The path containing the bashly configuration and source files [default: src]"
|
22
31
|
|
@@ -40,7 +49,25 @@ module Bashly
|
|
40
49
|
safe_copy_lib "yaml.sh"
|
41
50
|
end
|
42
51
|
|
52
|
+
def comp_command
|
53
|
+
format = args['FORMAT']
|
54
|
+
output = args['OUTPUT']
|
55
|
+
|
56
|
+
case format
|
57
|
+
when "function"
|
58
|
+
save_comp_function output
|
59
|
+
when "yaml"
|
60
|
+
save_comp_yaml output
|
61
|
+
when "script"
|
62
|
+
save_comp_script output
|
63
|
+
else
|
64
|
+
raise Error, "Unrecognized format: #{format}"
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
43
69
|
private
|
70
|
+
|
44
71
|
def safe_copy_lib(libfile)
|
45
72
|
safe_copy asset("templates/lib/#{libfile}"), "#{Settings.source_dir}/lib/#{libfile}"
|
46
73
|
end
|
@@ -63,6 +90,61 @@ module Bashly
|
|
63
90
|
FileUtils.mkdir_p target_dir unless Dir.exist? target_dir
|
64
91
|
FileUtils.cp source, target
|
65
92
|
end
|
93
|
+
|
94
|
+
def config
|
95
|
+
@config ||= Config.new "#{Settings.source_dir}/bashly.yml"
|
96
|
+
end
|
97
|
+
|
98
|
+
def command
|
99
|
+
@command ||= Models::Command.new config
|
100
|
+
end
|
101
|
+
|
102
|
+
def completions
|
103
|
+
@completions ||= command.completion_data
|
104
|
+
end
|
105
|
+
|
106
|
+
def completions_script
|
107
|
+
@completions_script ||= command.completion_script
|
108
|
+
end
|
109
|
+
|
110
|
+
def completions_function
|
111
|
+
@completions_function ||= command.completion_function
|
112
|
+
end
|
113
|
+
|
114
|
+
def save_comp_yaml(filename = nil)
|
115
|
+
filename ||= "#{Settings.target_dir}/completions.yml"
|
116
|
+
File.write filename, completions.to_yaml
|
117
|
+
say "created !txtgrn!#{filename}"
|
118
|
+
say ""
|
119
|
+
say "This file can be converted to a completions script using the !txtgrn!completely!txtrst! gem."
|
120
|
+
end
|
121
|
+
|
122
|
+
def save_comp_script(filename = nil)
|
123
|
+
filename ||= "#{Settings.target_dir}/completions.bash"
|
124
|
+
File.write filename, completions_script
|
125
|
+
say "created !txtgrn!#{filename}"
|
126
|
+
say ""
|
127
|
+
say "In order to enable completions, run:"
|
128
|
+
say ""
|
129
|
+
say " !txtpur!$ source #{filename}"
|
130
|
+
end
|
131
|
+
|
132
|
+
def save_comp_function(name = nil)
|
133
|
+
name ||= "send_completions"
|
134
|
+
target_dir = "#{Settings.source_dir}/lib"
|
135
|
+
filename = "#{target_dir}/#{name}.sh"
|
136
|
+
|
137
|
+
FileUtils.mkdir_p target_dir unless Dir.exist? target_dir
|
138
|
+
File.write filename, completions_function
|
139
|
+
|
140
|
+
say "created !txtgrn!#{filename}"
|
141
|
+
say ""
|
142
|
+
say "In order to use it in your script, create a command or a flag (for example: !txtgrn!#{command.name} completions!txtrst! or !txtgrn!#{command.name} --completions!txtrst!) that calls the !txtgrn!#{name}!txtrst! function."
|
143
|
+
say "Your users can then run something like this to enable completions:"
|
144
|
+
say ""
|
145
|
+
say " !txtpur!$ eval \"$(#{command.name} completions)\""
|
146
|
+
end
|
147
|
+
|
66
148
|
end
|
67
149
|
end
|
68
150
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'completely'
|
2
|
+
|
3
|
+
module Bashly
|
4
|
+
# This is a `Command` concern responsible for providing bash completion data
|
5
|
+
module Completions
|
6
|
+
def completion_data(with_version: true)
|
7
|
+
result = { full_name => completion_words(with_version: with_version) }
|
8
|
+
|
9
|
+
commands.each do |command|
|
10
|
+
result.merge! command.completion_data(with_version: false)
|
11
|
+
end
|
12
|
+
|
13
|
+
result
|
14
|
+
end
|
15
|
+
|
16
|
+
def completion_script
|
17
|
+
completion_generator.script
|
18
|
+
end
|
19
|
+
|
20
|
+
def completion_function(name = nil)
|
21
|
+
completion_generator.wrapper_function(name)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def completion_generator
|
27
|
+
Completely::Completions.new(completion_data)
|
28
|
+
end
|
29
|
+
|
30
|
+
def completion_flag_names
|
31
|
+
flags.map(&:name) + flags.map(&:short)
|
32
|
+
end
|
33
|
+
|
34
|
+
def completion_words(with_version: false)
|
35
|
+
trivial_flags = %w[--help -h]
|
36
|
+
trivial_flags += %w[--version -v] if with_version
|
37
|
+
all = (
|
38
|
+
command_names + trivial_flags +
|
39
|
+
completion_flag_names
|
40
|
+
)
|
41
|
+
|
42
|
+
all += completions if completions
|
43
|
+
all.compact.uniq.sort
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
@@ -4,10 +4,7 @@ module Bashly
|
|
4
4
|
module Renderable
|
5
5
|
def render(view)
|
6
6
|
template = File.read view_path(view)
|
7
|
-
|
8
|
-
# So for now, we keep the old deprecated syntax
|
9
|
-
# ERB.new(template, trim_mode: '%-').result(binding)
|
10
|
-
ERB.new(template, nil, '%-').result(binding)
|
7
|
+
ERB.new(template, trim_mode: '%-').result(binding)
|
11
8
|
end
|
12
9
|
|
13
10
|
def strings
|
data/lib/bashly/models/base.rb
CHANGED
data/lib/bashly/version.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
# :command.command_fallback
|
2
|
+
<%- if default_command -%>
|
3
|
+
"" )
|
4
|
+
<%= function_name %>_usage
|
5
|
+
exit 1
|
6
|
+
;;
|
7
|
+
|
8
|
+
* )
|
9
|
+
action="<%= default_command.name %>"
|
10
|
+
<%= default_command.function_name %>_parse_requirements "$@"
|
11
|
+
shift $#
|
12
|
+
;;
|
13
|
+
<%- elsif extensible.is_a? String -%>
|
14
|
+
"" )
|
15
|
+
<%= function_name %>_usage
|
16
|
+
exit 1
|
17
|
+
;;
|
18
|
+
|
19
|
+
* )
|
20
|
+
if [[ -x "$(command -v "<%= extensible %>")" ]]; then
|
21
|
+
exec <%= extensible %> "$@"
|
22
|
+
else
|
23
|
+
<%= function_name %>_usage
|
24
|
+
exit 1
|
25
|
+
fi
|
26
|
+
<%- elsif extensible -%>
|
27
|
+
"" )
|
28
|
+
<%= function_name %>_usage
|
29
|
+
exit 1
|
30
|
+
;;
|
31
|
+
|
32
|
+
* )
|
33
|
+
if [[ -x "$(command -v "<%= function_name %>-$action")" ]]; then
|
34
|
+
shift
|
35
|
+
exec "<%= function_name %>-$action" "$@"
|
36
|
+
else
|
37
|
+
<%= function_name %>_usage
|
38
|
+
exit 1
|
39
|
+
fi
|
40
|
+
<%- else -%>
|
41
|
+
* )
|
42
|
+
<%= function_name %>_usage
|
43
|
+
exit 1
|
44
|
+
;;
|
45
|
+
<%- end -%>
|
@@ -15,25 +15,7 @@ case $action in
|
|
15
15
|
;;
|
16
16
|
|
17
17
|
<%- end -%>
|
18
|
-
|
19
|
-
"" )
|
20
|
-
<%= function_name %>_usage
|
21
|
-
exit 1
|
22
|
-
;;
|
23
|
-
|
24
|
-
* )
|
25
|
-
action="<%= default_command.name %>"
|
26
|
-
<%= default_command.function_name %>_parse_requirements "$@"
|
27
|
-
shift $#
|
28
|
-
;;
|
29
|
-
|
30
|
-
<%- else -%>
|
31
|
-
* )
|
32
|
-
<%= function_name %>_usage
|
33
|
-
exit 1
|
34
|
-
;;
|
35
|
-
|
36
|
-
<%- end -%>
|
18
|
+
<%= render :command_fallback %>
|
37
19
|
esac
|
38
20
|
<%- else -%>
|
39
21
|
action="<%= action_name %>"
|
@@ -40,6 +40,7 @@
|
|
40
40
|
<%= render(:usage_args).indent 4 if args.any? or catch_all_help %>
|
41
41
|
<%= render(:usage_environment_variables).indent 4 if environment_variables.any? %>
|
42
42
|
<%= render(:usage_examples).indent 4 if examples %>
|
43
|
+
<%= render(:footer).indent 4 if footer %>
|
43
44
|
|
44
45
|
fi
|
45
46
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bashly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -24,6 +24,26 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: completely
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.1'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 0.1.2
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0.1'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.1.2
|
27
47
|
- !ruby/object:Gem::Dependency
|
28
48
|
name: mister_bin
|
29
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -69,6 +89,7 @@ files:
|
|
69
89
|
- lib/bashly/commands/init.rb
|
70
90
|
- lib/bashly/commands/preview.rb
|
71
91
|
- lib/bashly/concerns/asset_helper.rb
|
92
|
+
- lib/bashly/concerns/completions.rb
|
72
93
|
- lib/bashly/concerns/renderable.rb
|
73
94
|
- lib/bashly/config.rb
|
74
95
|
- lib/bashly/exceptions.rb
|
@@ -92,6 +113,7 @@ files:
|
|
92
113
|
- lib/bashly/templates/strings.yml
|
93
114
|
- lib/bashly/version.rb
|
94
115
|
- lib/bashly/views/argument/usage.erb
|
116
|
+
- lib/bashly/views/command/command_fallback.erb
|
95
117
|
- lib/bashly/views/command/command_filter.erb
|
96
118
|
- lib/bashly/views/command/command_functions.erb
|
97
119
|
- lib/bashly/views/command/default_assignments.erb
|
@@ -101,6 +123,7 @@ files:
|
|
101
123
|
- lib/bashly/views/command/dependencies_filter.erb
|
102
124
|
- lib/bashly/views/command/environment_variables_filter.erb
|
103
125
|
- lib/bashly/views/command/fixed_flags_filter.erb
|
126
|
+
- lib/bashly/views/command/footer.erb
|
104
127
|
- lib/bashly/views/command/function.erb
|
105
128
|
- lib/bashly/views/command/initialize.erb
|
106
129
|
- lib/bashly/views/command/inspect_args.erb
|
@@ -139,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
139
162
|
requirements:
|
140
163
|
- - ">="
|
141
164
|
- !ruby/object:Gem::Version
|
142
|
-
version: 2.
|
165
|
+
version: 2.7.0
|
143
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
167
|
requirements:
|
145
168
|
- - ">="
|