menu_commander 0.1.0 → 0.1.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 +21 -0
- data/bin/menu +4 -0
- data/lib/menu_commander/cli.rb +1 -3
- data/lib/menu_commander/command.rb +5 -3
- data/lib/menu_commander/exceptions.rb +1 -0
- data/lib/menu_commander/menu.rb +4 -3
- data/lib/menu_commander/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4d53a183eadc9c1b1b4ae6c2a3945f5fab3c4cbf4c22d68242c6d8fc0a91ee8
|
4
|
+
data.tar.gz: 0d87631121b847fc344d5907846dd9d110477d4c0274fad5b6e52f6218e81a90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 419ac4ba40c923d195f393ef92e9ef246e0f40b25172b50b1197ad871cf7ed7ce170a6ee8234375e46b6ed1ade9c5a02c8d733119785566645ae1181d50e0769
|
7
|
+
data.tar.gz: 1b0db35c1a6700ec31b7505a9c89be3972e3f30f3344c7a711a98de7c4fc0b2099bea1055fd08e4c3bb7d3af87d15b3b1b4fd7919449b3ad5dc571b1fa757f61
|
data/README.md
CHANGED
@@ -145,6 +145,27 @@ menu:
|
|
145
145
|
branch: git branch
|
146
146
|
```
|
147
147
|
|
148
|
+
### Multi-line commands
|
149
|
+
|
150
|
+
Providing an array to a menu, will join the array with '&&' to a single
|
151
|
+
command. Alternatively, you can use a simple YAML multi-line string.
|
152
|
+
|
153
|
+
|
154
|
+
```yaml
|
155
|
+
# examples/multiline.yml
|
156
|
+
menu:
|
157
|
+
deploy:
|
158
|
+
- run tests
|
159
|
+
- git commit -am "automatic commit"
|
160
|
+
- git push
|
161
|
+
|
162
|
+
alternative: >
|
163
|
+
run tests &&
|
164
|
+
git commit -am "automatic commit" &&
|
165
|
+
git push
|
166
|
+
```
|
167
|
+
|
168
|
+
|
148
169
|
Menu File Location
|
149
170
|
--------------------------------------------------
|
150
171
|
|
data/bin/menu
CHANGED
data/lib/menu_commander/cli.rb
CHANGED
@@ -5,13 +5,15 @@ module MenuCommander
|
|
5
5
|
class Command < MisterBin::Command
|
6
6
|
include Colsole
|
7
7
|
|
8
|
-
help "
|
8
|
+
help "Menu Commander"
|
9
9
|
usage "menu [CONFIG --dry]"
|
10
|
-
usage "menu (-h|--help)"
|
11
|
-
option "-d --dry", "Dry run
|
10
|
+
usage "menu (-h|--help|--version)"
|
11
|
+
option "-d --dry", "Dry run - do not execute the command at the end, just show it"
|
12
|
+
option "--version", "Show version number"
|
12
13
|
param "CONFIG", "The name of the menu config file without the .yml extension [default: menu]"
|
13
14
|
|
14
15
|
def run
|
16
|
+
raise Exit, VERSION if args['--version']
|
15
17
|
raise MenuNotFound.new(paths: menu_paths, config: config) unless menu_file
|
16
18
|
|
17
19
|
if args['--dry']
|
data/lib/menu_commander/menu.rb
CHANGED
@@ -13,6 +13,8 @@ module MenuCommander
|
|
13
13
|
def call(menu = nil)
|
14
14
|
menu ||= config['menu']
|
15
15
|
response = select menu
|
16
|
+
response = response.join ' && ' if response.is_a? Array
|
17
|
+
|
16
18
|
if response.is_a? String
|
17
19
|
params = {}
|
18
20
|
placeholders(response).each do |key|
|
@@ -22,6 +24,7 @@ module MenuCommander
|
|
22
24
|
response % params
|
23
25
|
else
|
24
26
|
call response
|
27
|
+
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
@@ -61,9 +64,7 @@ module MenuCommander
|
|
61
64
|
|
62
65
|
def select(options, title = nil)
|
63
66
|
title = title ? "> #{title}:" : ">"
|
64
|
-
|
65
|
-
menu_config['filter'] = true if options.size > 10
|
66
|
-
prompt.select title, options, menu_config
|
67
|
+
prompt.select title, options, symbols: { marker: '>' }, per_page: 10, filter: true
|
67
68
|
|
68
69
|
rescue TTY::Reader::InputInterrupt
|
69
70
|
# :nocov:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: menu_commander
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.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: 2019-
|
11
|
+
date: 2019-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mister_bin
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.19'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.19'
|
55
55
|
description: Easily create menus for any command line tool using simple YAML configuration
|
56
56
|
email: db@dannyben.com
|
57
57
|
executables:
|