bashly 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: adc0195f1560e5851741b7b17ce2a4b6d825aa77a7f5f9cc6a808e6864b605b1
4
- data.tar.gz: 7c06088461ad5e62a3c5523aaebb49ade7fed0ae3cd111159390e50985913ae3
3
+ metadata.gz: 33745534735d1a93f143a68939db55de17d618457b6873e948149317671f772d
4
+ data.tar.gz: 4ab52cd6f154cce246454d924fb898e8a092b1d7bb6e171dc9ff95d8dccc46c2
5
5
  SHA512:
6
- metadata.gz: e7863f3863eaaf697aa26a7dfacbacc695f6eac61123fb85efa752c623a9cf3a853cff32dec314e347d5fb469d2b5168e4ddb7efc796db994b0ce2f713f0d7ca
7
- data.tar.gz: 79b400c668d45b6429c7945bb44402311b06f184d57547f55a6e983b91390b2feb79c6ebf7e7fe5be14454ad3d019e4f526710ca6d103f8f6746f9473558b16f
6
+ metadata.gz: f15b8e87c30fcb1bbec774ac101ef3f3225313df181bc78ab1786baa833e0c972ac01c4f451d20c2661c8383d3924fce182f737aa4f0579edfd27e3f006fa511
7
+ data.tar.gz: 7c51c2fd0b9564ba1be0e6a7b71b01176bbdc936da9d5382479ecbffee7671dd06e3c3c6172647b1c40d0d09d03ab347fecfe5f7464d1e0b90a4b49094116a88
data/README.md CHANGED
@@ -21,7 +21,9 @@ Create beautiful bash scripts from simple YAML configuration
21
21
  Installation
22
22
  --------------------------------------------------
23
23
 
24
- $ gem install bashly
24
+ ```shell
25
+ $ gem install bashly
26
+ ```
25
27
 
26
28
 
27
29
  What is Bashly
@@ -56,9 +58,11 @@ Usage
56
58
 
57
59
  In an empty directory, create a sample configuration file by running
58
60
 
59
- $ bashly init
60
- # or, to generate a simpler configuration:
61
- $ bashly init --minimal
61
+ ```shell
62
+ $ bashly init
63
+ # or, to generate a simpler configuration:
64
+ $ bashly init --minimal
65
+ ```
62
66
 
63
67
  This will create a sample `src/bashly.yml` file.
64
68
  You can edit this file to specify which arguments, flags and subcommands you
@@ -67,7 +71,9 @@ need in your bash script.
67
71
  Then, generate an initial bash script and function placeholder scripts by
68
72
  running
69
73
 
70
- $ bashly generate
74
+ ```shell
75
+ $ bashly generate
76
+ ```
71
77
 
72
78
  This will:
73
79
 
@@ -198,7 +204,7 @@ The below configuration generates this flag:
198
204
  Specify the output directory
199
205
  ```
200
206
 
201
- The flags's value will be available to you as `${args[--output]}` in your
207
+ The flag's value will be available to you as `${args[--output]}` in your
202
208
  bash function (regardless of whether the user provided ut with the long or
203
209
  short form).
204
210
 
@@ -91,3 +91,26 @@ config_show() {
91
91
  config_init
92
92
  cat "$CONFIG_FILE"
93
93
  }
94
+
95
+ # Return an array of the keys in the config file
96
+ # Usage:
97
+ #
98
+ # for k in $(config_keys); do
99
+ # echo "- $k = $(config_get "$k")";
100
+ # done
101
+ #
102
+ config_keys() {
103
+ key=$1
104
+ regex="^(.*)\s*="
105
+
106
+ config_init
107
+
108
+ keys=()
109
+ while IFS= read -r line || [ -n "$line" ]; do
110
+ if [[ $line =~ $regex ]]; then
111
+ key="${BASH_REMATCH[1]}"
112
+ keys+=("$key")
113
+ fi
114
+ done < "$CONFIG_FILE"
115
+ echo ${keys[@]}
116
+ }
@@ -1,3 +1,3 @@
1
1
  module Bashly
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -8,7 +8,7 @@ case $action in
8
8
 
9
9
  <%- commands.each do |command| -%>
10
10
  <%= command.aliases.join " | " %> )
11
- action=<%= command.name %>
11
+ action="<%= command.name %>"
12
12
  shift
13
13
  <%= command.name %>_parse_args "$@"
14
14
  shift $#
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.2.1
4
+ version: 0.2.2
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-11-21 00:00:00.000000000 Z
11
+ date: 2019-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colsole