bashly 0.4.4 → 0.6.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: 3b9f48152171cac044c5f26ec11f6fcdad64d9bb5fcf3363ab23a609d24c5b3b
4
- data.tar.gz: 7ffcba2d9cc3448f0e08972086c5518dfc7d5c0b2969f5f112045b6b5f114f4f
3
+ metadata.gz: 7fe733a46c8634cc39b4c792b177ca9ac7610a8d408714fa482b3c0ad15fc10f
4
+ data.tar.gz: 908960de1cb2d682ff801630e0f6667a42df171612ed6a92aee72bcc369cc0e2
5
5
  SHA512:
6
- metadata.gz: 6fe841722c54b62f72ddce5afdd8448feb30e973a034e623146981b1166be57826238eec5d5e2ac18e3d8357872b5305709110302ae13a7ce5130a0aa46d3a87
7
- data.tar.gz: 6d93748b46b22c2e42f5abcd8751e99454545da4293e7a8deeca28869be8df4eccc980d21ca4e4e2acb6b682a2b5451fddc5e339759f40bbb4202e15923cdceb
6
+ metadata.gz: 9e0dcf39faf63d5d798fac7ed41768994ec6715a58b898e390ec2a6019948497d314c08bc8ce1041fb5f1a105884a04d759e258085fdcf7fbbe87af1c4a7a4e0
7
+ data.tar.gz: 83279b0a7df6eb6f3c2a779bbc54221e9cad58e6e08c4a207f1d592aa12329cc488d7169b682191be02474f098dbfda0f3d6ad6cd03e3a91e1bf793bb29fcdc3
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)
@@ -22,20 +23,21 @@ Create beautiful bash scripts from simple YAML configuration
22
23
  - [Prerequisites](#prerequisites)
23
24
  - [What is Bashly](#what-is-bashly)
24
25
  - [Usage](#usage)
25
- - [Using the input arguemnts in your code](#using-the-input-arguemnts-in-your-code)
26
+ - [Using the input arguments in your code](#using-the-input-arguments-in-your-code)
26
27
  - [Examples](#examples)
27
- - [Sample configuraiton for a script without commands](#sample-configuraiton-for-a-script-without-commands)
28
- - [Sample configuraiton for a script with commands](#sample-configuraiton-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
@@ -113,7 +126,7 @@ Finally, edit the files in the `src` folder. Each of your script's commands
113
126
  get their own file. Once you edit, run `bashly generate` again to merge the
114
127
  content from your functions back into the script.
115
128
 
116
- ### Using the input arguemnts in your code
129
+ ### Using the input arguments in your code
117
130
 
118
131
  In order to access the parsed arguments in any of your partial scripts, you
119
132
  may simply access the `$args` associative array.
@@ -152,32 +165,11 @@ $ ./download a --force
152
165
  downloading a with --force
153
166
  ```
154
167
 
155
- ## Examples
156
-
157
- The `bashly.yml` file can be set up to generate two types of scripts:
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 configuraiton 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 configuraiton for a script with commands
173
168
 
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
@@ -193,7 +185,7 @@ The `bashly.yml` configuration file consists of these types:
193
185
 
194
186
  ### Command options
195
187
 
196
- Unless otherwise specified, these definitiona can be used for both the root
188
+ Unless otherwise specified, these definitions can be used for both the root
197
189
  command and subcommands (under the `commands` definition).
198
190
 
199
191
  Option | Description
@@ -202,15 +194,18 @@ command and subcommands (under the `commands` definition).
202
194
  `short` | An additional, optional pattern - usually used to denote a one letter variation of the command name. You can add `*` as a suffix, to denote a "starts with" pattern - for example `short: m*`. *Applicable only in subcommands*.
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
- `default` | Setting this to `true` on any command, will make unrecognized command line arguments to be passed to this command. *Applicable only in subcommands*.
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
- `environment_variables` | Specify an array of environment variables needed by your script.
208
- `commands` | Specify the array of commands. 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
- `args` | Specify the array of positional arguments this script needs.
210
- `flags` | Specify the array of option flags this script needs.
200
+ `environment_variables` | Specify an array of [environment variables](#environment-variable-options) needed by your script.
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.
202
+ `args` | Specify the array of [positional arguments](#argument-options) this script needs.
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 Variable options
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,146 @@ 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
+ script.
353
+
354
+ In addition to suggesting subcommands and flags, you can instruct bashly to
355
+ also suggest files, directories, users and more. To do this, add another option
356
+ 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: [directory, user]
364
+
365
+ ```
366
+
367
+ Valid completion additions are:
368
+
369
+ | Keyword | Meaning
370
+ |-------------|---------------------
371
+ | `alias` | Alias names
372
+ | `arrayvar` | Array variable names
373
+ | `binding` | Readline key binding names
374
+ | `builtin` | Names of shell builtin commands
375
+ | `command` | Command names
376
+ | `directory` | Directory names
377
+ | `disabled` | Names of disabled shell builtins
378
+ | `enabled` | Names of enabled shell builtins
379
+ | `export` | Names of exported shell variables
380
+ | `file` | File names
381
+ | `function` | Names of shell functions
382
+ | `group` | Group names
383
+ | `helptopic` | Help topics as accepted by the help builtin
384
+ | `hostname` | Hostnames, as taken from the file specified by the HOSTFILE shell variable
385
+ | `job` | Job names
386
+ | `keyword` | Shell reserved words
387
+ | `running` | Names of running jobs
388
+ | `service` | Service names
389
+ | `signal` | Signal names
390
+ | `stopped` | Names of stopped jobs
391
+ | `user` | User names
392
+ | `variable` | Names of all shell variables
393
+
394
+ Note that these are taken from the [Programmable Completion Builtin][compgen],
395
+ and will simply be added using the `compgen -A action` command.
396
+
397
+
265
398
  ## Real World Examples
266
399
 
267
400
  - [Rush][rush] - a Personal Package Manager
@@ -274,9 +407,11 @@ set.
274
407
  If you experience any issue, have a question or a suggestion, or if you wish
275
408
  to contribute, feel free to [open an issue][issues].
276
409
 
410
+
411
+
277
412
  [issues]: https://github.com/DannyBen/bashly/issues
278
413
  [rush]: https://github.com/DannyBen/rush-cli
279
414
  [alf]: https://github.com/DannyBen/alf
280
415
  [git-changelog]: https://github.com/DannyBen/git-changelog
281
-
282
-
416
+ [completely]: https://github.com/DannyBen/completely
417
+ [compgen]: https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion-Builtins.html
@@ -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,50 @@
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_actions
35
+ completions ? completions.map { |c| "<#{c}>" } : []
36
+ end
37
+
38
+ def completion_words(with_version: false)
39
+ trivial_flags = %w[--help -h]
40
+ trivial_flags += %w[--version -v] if with_version
41
+ all = (
42
+ command_names + trivial_flags +
43
+ completion_flag_names + completion_actions
44
+ )
45
+
46
+ all.compact.uniq.sort
47
+ end
48
+
49
+ end
50
+ 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
- # TODO: This new format is only supported in Ruby >= 2.6
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
@@ -16,7 +16,6 @@ class String
16
16
  strip!
17
17
  split("\n").collect! do |line|
18
18
  if line.length > length
19
- line.gsub!(/([^\s]{#{length}})([^\s$])/, "\\1 \\2")
20
19
  line.gsub(/(.{1,#{length}})(\s+|$)/, "\\1\n").rstrip
21
20
  else
22
21
  line
@@ -9,12 +9,15 @@ module Bashly
9
9
  allowed
10
10
  arg
11
11
  catch_all
12
+ completions
12
13
  default
13
14
  dependencies
14
15
  description
15
16
  environment_variables
16
17
  examples
18
+ extensible
17
19
  flags
20
+ footer
18
21
  group
19
22
  help
20
23
  long
@@ -1,6 +1,8 @@
1
1
  module Bashly
2
2
  module Models
3
3
  class Command < Base
4
+ include Completions
5
+
4
6
  # Returns the name to be used as an action.
5
7
  # - If it is the root command, the action is "root"
6
8
  # - Else, it is all the parents, except the first tone (root) joined
@@ -41,6 +43,7 @@ module Bashly
41
43
  end
42
44
  end
43
45
 
46
+ # Returns a used defined help string for the catch_all directive
44
47
  def catch_all_help
45
48
  return nil unless catch_all
46
49
 
@@ -1,3 +1,3 @@
1
1
  module Bashly
2
- VERSION = "0.4.4"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -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
- <%- if default_command -%>
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 %>"
@@ -0,0 +1,2 @@
1
+ printf "<%= footer.gsub("\n", '\n').gsub('"', '\"') %>\n"
2
+ echo
@@ -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.4
4
+ version: 0.6.0
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-06-01 00:00:00.000000000 Z
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.3.0
165
+ version: 2.7.0
143
166
  required_rubygems_version: !ruby/object:Gem::Requirement
144
167
  requirements:
145
168
  - - ">="