bashly 0.3.3 → 0.3.4

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: 51726b1606a72cbed1bd541c1ec4043e1d3ee8fd84dcea162746cb953e6684f9
4
- data.tar.gz: 965346a4e52205af43220f893b9c30978df49f376f1067ce4a25d8a4dda3c0b8
3
+ metadata.gz: 7839064a69e5280ef2fcf0112ee9a4442912f99308a8c99dd3cf57c48fc905d2
4
+ data.tar.gz: '0923d678dd93f16ec6beb2bb796e679b355fe971fc7141910c5b62d025ccfc4b'
5
5
  SHA512:
6
- metadata.gz: bb165ce7cd9ed5a399d1792993d15e3939879e4462d23b89cb3ebad8e8964d75ab629c2ab5286b293a456a78d9daf567b2ac0235c00fc568da20cd4c201d2137
7
- data.tar.gz: b87760cde516cb1964a90ce6017ea922198d67530c741e95c1c75e6568d9bb57653b3ed79b5613307ef188827ada05f4f4c97ba4f7e576e07d15962a126fddbb
6
+ metadata.gz: ec45676addca44ee7ce775b505d368b29723ed689e890592608a96a36fc64f8570dfd15a2df3a82b6a7e4bd2081db6338d11de0b285488d4af8145a83205cdb1
7
+ data.tar.gz: cd6303a9834570a1d7a4a8d17ee796c72a116454cc1831af7a8897113419557840e1e1c94117abb06f9510dfb4b2aa4e7aafc67ce65eca2fcd0cd8ee56d0f8cd
data/README.md CHANGED
@@ -41,11 +41,11 @@ Bahsly is responsible for:
41
41
 
42
42
  - Generating a **single, standalone bash script**.
43
43
  - Generating **usage texts** and help screens, showing your tool's arguments,
44
- flags and subcommands (works for subcommands also).
44
+ flags and commands (works for subcommands also).
45
45
  - Parsing the user's command line and extracting:
46
46
  - Optional or required **positional arguments**.
47
47
  - Optional or required **option flags** (with or without flag arguments).
48
- - **Subcommands** (and sub-subcommands).
48
+ - **Commands** (and subcommands).
49
49
  - Standard flags (like **--help** and **--version**).
50
50
  - Providing you with a place to input your code for each of the functions
51
51
  your tool performs, and merging it back to the final script.
@@ -67,7 +67,7 @@ $ bashly init --minimal
67
67
  ```
68
68
 
69
69
  This will create a sample `src/bashly.yml` file.
70
- You can edit this file to specify which arguments, flags and subcommands you
70
+ You can edit this file to specify which arguments, flags and commands you
71
71
  need in your bash script.
72
72
 
73
73
  Then, generate an initial bash script and function placeholder scripts by
@@ -92,24 +92,24 @@ Examples
92
92
 
93
93
  The `bashly.yml` file can be set up to generate two types of scripts:
94
94
 
95
- 1. Script with subcommands (for example, like `docker` or `git`).
96
- 2. Script without subcommands (for example, like `ls`)
95
+ 1. Script with commands (for example, like `docker` or `git`).
96
+ 2. Script without commands (for example, like `ls`)
97
97
 
98
98
  This is detected automatically by the contents of the configuration: If it
99
- contains a `commands` definition, it will generate a script with subcommands.
99
+ contains a `commands` definition, it will generate a script with commands.
100
100
 
101
101
 
102
- ### Sample configuraiton for a script without subcommands
102
+ ### Sample configuraiton for a script without commands
103
103
 
104
104
  - Generate this script by running `bashly generate --minimal`
105
105
  - [See the initial sample bashly.yml file](examples/minimal/src/bashly.yml)
106
106
  - [See the generated bash script](examples/minimal/download)
107
107
 
108
- ### Sample configuraiton for a script with subcommands
108
+ ### Sample configuraiton for a script with commands
109
109
 
110
110
  - Generate this script by running `bashly generate`
111
- - [See the initial sample bashly.yml file](examples/subcommands/src/bashly.yml)
112
- - [See the generated bash script](examples/subcommands/cli)
111
+ - [See the initial sample bashly.yml file](examples/commands/src/bashly.yml)
112
+ - [See the generated bash script](examples/commands/cli)
113
113
 
114
114
 
115
115
  See the [examples](examples) folder for more examples.
@@ -140,13 +140,14 @@ command and subcommands (under the `commands` definition).
140
140
  `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*.
141
141
  `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.
142
142
  `version` | The string to display when using `--version`. *Applicable only in the main command*.
143
- `default` | Setting this to `yes` on any subcommand, will make unrecognized command line arguments to be passed to this command. *Applicable only in subcommands*.
143
+ `default` | Setting this to `yes` on any command, will make unrecognized command line arguments to be passed to this command. *Applicable only in subcommands*.
144
144
  `examples` | Specify an array of examples to show when using `--help`. Each example can have multiple lines.
145
145
  `environment_variables` | Specify an array of environment variables needed by your script.
146
- `commands` | Specify the array of subcommands. Each subcommand will have its own args and flags. Note: if `commands` is provided, you cannot specify flags or args at the same level.
146
+ `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.
147
147
  `args` | Specify the array of positional arguments this script needs.
148
148
  `flags` | Specify the array of option flags this script needs.
149
149
  `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.
150
+ `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.
150
151
 
151
152
  ### Argument options
152
153
 
@@ -7,7 +7,7 @@ module Bashly
7
7
  usage "bashly init [--minimal]"
8
8
  usage "bashly init (-h|--help)"
9
9
 
10
- option "-m --minimal", "Use a minimal configuration file (without subcommands)"
10
+ option "-m --minimal", "Use a minimal configuration file (without commands)"
11
11
 
12
12
  environment "BASHLY_SOURCE_DIR", "The path to use for creating the configuration file [default: src]"
13
13
 
@@ -13,6 +13,7 @@ module Bashly
13
13
  environment_variables
14
14
  examples
15
15
  flags
16
+ group
16
17
  help
17
18
  long
18
19
  name
@@ -28,12 +28,12 @@ module Bashly
28
28
  help ? "#{full_name} - #{summary}" : full_name
29
29
  end
30
30
 
31
- # Returns only the names of the subcommands (Commands)
31
+ # Returns only the names of the Commands
32
32
  def command_names
33
33
  commands.map &:name
34
34
  end
35
35
 
36
- # Returns an array of the subcommands (Commands)
36
+ # Returns an array of the Commands
37
37
  def commands
38
38
  return [] unless options["commands"]
39
39
  options["commands"].map do |options|
@@ -1,5 +1,5 @@
1
1
  name: download
2
- help: Sample minimal application without subcommands
2
+ help: Sample minimal application without commands
3
3
  version: 0.1.0
4
4
 
5
5
  args:
@@ -8,6 +8,7 @@ arguments: "Arguments:"
8
8
  commands: "Commands:"
9
9
  examples: "Examples:"
10
10
  environment_variables: "Environment Variables:"
11
+ group: "%{group} Commands:"
11
12
 
12
13
  # Usage helpers
13
14
  command_shortcut: "Shortcut: %{short}"
@@ -1,3 +1,3 @@
1
1
  module Bashly
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -1,9 +1,18 @@
1
1
  # :command.usage_commands
2
+ <%- unless commands.first.group -%>
2
3
  printf "<%= strings[:commands] %>\n"
4
+ <%- end -%>
3
5
  <%- maxlen = command_names.map(&:size).max -%>
4
6
  <%- commands.each do |command| -%>
5
7
  <%- summary = command.summary -%>
6
8
  <%- summary = strings[:default_command_summary] % { summary: summary } if command.default -%>
9
+ <%- if command.group -%>
10
+ <%- if command.name == commands.first.name -%>
11
+ printf "<%= strings[:group] % { group: command.group } %>\n"
12
+ <%- else -%>
13
+ printf "\n<%= strings[:group] % { group: command.group } %>\n"
14
+ <%- end -%>
15
+ <%- end -%>
7
16
  echo " <%= command.name.ljust maxlen %> <%= summary %>"
8
17
  <%- end -%>
9
18
  echo
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.3.3
4
+ version: 0.3.4
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: 2019-12-13 00:00:00.000000000 Z
11
+ date: 2019-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colsole