bashly 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -33
- data/lib/bashly/models/base.rb +1 -0
- data/lib/bashly/version.rb +1 -1
- data/lib/bashly/views/command/footer.erb +2 -0
- data/lib/bashly/views/command/usage.erb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca34648c628c4e7fe167d5f5b0d253792e9b4d3c494b253ed68d0127e4935572
|
4
|
+
data.tar.gz: 5247da7780a8424dd0a808ace6d182ed4284597e094122d94a8716bfca8f343b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2145d1f4125d762c3d583f560c4caa9f4b98cfc2500e7e7b9ac977f4284a190a150a26da6e935c4e59c689f5efcd627924a10091cff0d4d91f00c3f60d26b943
|
7
|
+
data.tar.gz: 9df4695f43e4c57371f876de1dee3eab587bb227b7b0ee51d52d1772faf119cbd59cb117f5a1e3cbb06ef49b5796cd02b6fecba685b733aa35c51442fe9baf19
|
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,19 +25,18 @@ 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)
|
34
|
-
- [Extensible
|
33
|
+
- [Extensible Scripts](#extensible-scripts)
|
35
34
|
- [Real World Examples](#real-world-examples)
|
36
35
|
- [Contributing / Support](#contributing--support)
|
37
36
|
|
38
37
|
---
|
39
38
|
|
39
|
+
|
40
40
|
## Installation
|
41
41
|
|
42
42
|
```shell
|
@@ -84,8 +84,17 @@ Bahsly is responsible for:
|
|
84
84
|
- **YAML parsing**.
|
85
85
|
- and more.
|
86
86
|
|
87
|
+
|
87
88
|
## Usage
|
88
89
|
|
90
|
+
The `bashly.yml` file can be set up to generate two types of scripts:
|
91
|
+
|
92
|
+
1. Script with commands (for example, like `docker` or `git`).
|
93
|
+
2. Script without commands (for example, like `ls`)
|
94
|
+
|
95
|
+
This is detected automatically by the contents of the configuration: If it
|
96
|
+
contains a `commands` definition, it will generate a script with commands.
|
97
|
+
|
89
98
|
In an empty directory, create a sample configuration file by running
|
90
99
|
|
91
100
|
```shell
|
@@ -153,32 +162,11 @@ $ ./download a --force
|
|
153
162
|
downloading a with --force
|
154
163
|
```
|
155
164
|
|
156
|
-
## Examples
|
157
165
|
|
158
|
-
|
159
|
-
|
160
|
-
1. Script with commands (for example, like `docker` or `git`).
|
161
|
-
2. Script without commands (for example, like `ls`)
|
162
|
-
|
163
|
-
This is detected automatically by the contents of the configuration: If it
|
164
|
-
contains a `commands` definition, it will generate a script with commands.
|
165
|
-
|
166
|
-
|
167
|
-
### Sample configuration for a script without commands
|
168
|
-
|
169
|
-
- Generate this script by running `bashly generate --minimal`
|
170
|
-
- [See the initial sample bashly.yml file](examples/minimal/src/bashly.yml)
|
171
|
-
- [See the generated bash script](examples/minimal/download)
|
172
|
-
|
173
|
-
### Sample configuration for a script with commands
|
174
|
-
|
175
|
-
- Generate this script by running `bashly generate`
|
176
|
-
- [See the initial sample bashly.yml file](examples/commands/src/bashly.yml)
|
177
|
-
- [See the generated bash script](examples/commands/cli)
|
178
|
-
|
179
|
-
|
180
|
-
See the [examples](examples) folder for more examples.
|
166
|
+
## Examples
|
181
167
|
|
168
|
+
The [examples folder](examples#readme) contains many detailed and documented
|
169
|
+
example configuration files, with their output.
|
182
170
|
|
183
171
|
|
184
172
|
## Configuration Reference
|
@@ -204,7 +192,7 @@ command and subcommands (under the `commands` definition).
|
|
204
192
|
`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.
|
205
193
|
`version` | The string to display when using `--version`. *Applicable only in the main command*.
|
206
194
|
`default` | Setting this to `true` on any command, will cause any unrecognized command line to be passed to this command. *Applicable only in subcommands*.
|
207
|
-
`extensible` | Specify that this command can be [externally extended](#extensible-
|
195
|
+
`extensible` | Specify that this command can be [externally extended](#extensible-scripts). *Applicable only in the main command*.
|
208
196
|
`examples` | Specify an array of examples to show when using `--help`. Each example can have multiple lines.
|
209
197
|
`environment_variables` | Specify an array of [environment variables](#environment-variable-options) needed by your script.
|
210
198
|
`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.
|
@@ -213,6 +201,7 @@ command and subcommands (under the `commands` definition).
|
|
213
201
|
`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`.
|
214
202
|
`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.
|
215
203
|
`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.
|
204
|
+
`footer` | Add a custom message that will be displayed at the end of the `--help` text.
|
216
205
|
|
217
206
|
### Argument options
|
218
207
|
|
@@ -249,9 +238,7 @@ The `-v` and `-h` flags will be used as the short options for `--version` and
|
|
249
238
|
`--help` respectively **only if you are not using them in any of your own
|
250
239
|
flags**.
|
251
240
|
|
252
|
-
### Environment
|
253
|
-
|
254
|
-
The below configuration generates this environment variable usage text:
|
241
|
+
### Environment variable options
|
255
242
|
|
256
243
|
If an environment variable is defined as required (false by default), the
|
257
244
|
execution of the script will be halted with a friendly error if it is not
|
@@ -264,7 +251,7 @@ set.
|
|
264
251
|
`required` | Specify if this variable is required.
|
265
252
|
|
266
253
|
|
267
|
-
## Extensible
|
254
|
+
## Extensible Scripts
|
268
255
|
|
269
256
|
You may configure your generated bash script to delegate any unknown command
|
270
257
|
to an external executable, by setting the `extensible` option to either `true`,
|
@@ -339,7 +326,6 @@ The generated script will execute `git status`.
|
|
339
326
|
See the [extensible-delegate example](examples/extensible-delegate).
|
340
327
|
|
341
328
|
|
342
|
-
|
343
329
|
## Real World Examples
|
344
330
|
|
345
331
|
- [Rush][rush] - a Personal Package Manager
|
data/lib/bashly/models/base.rb
CHANGED
data/lib/bashly/version.rb
CHANGED
@@ -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.5.
|
4
|
+
version: 0.5.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-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- lib/bashly/views/command/dependencies_filter.erb
|
103
103
|
- lib/bashly/views/command/environment_variables_filter.erb
|
104
104
|
- lib/bashly/views/command/fixed_flags_filter.erb
|
105
|
+
- lib/bashly/views/command/footer.erb
|
105
106
|
- lib/bashly/views/command/function.erb
|
106
107
|
- lib/bashly/views/command/initialize.erb
|
107
108
|
- lib/bashly/views/command/inspect_args.erb
|