menu_commander 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/lib/menu_commander/command.rb +8 -8
- data/lib/menu_commander/menu.rb +6 -1
- data/lib/menu_commander/menu_options.rb +2 -0
- data/lib/menu_commander/polyfills/hash.rb +1 -1
- data/lib/menu_commander/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f80fb34ce5543c0fa380df41394bac243d8d136e120f362f0216eac6b0eff75
|
4
|
+
data.tar.gz: ff01a61baa3ab61a5c8e082eea7bef4e2e4270a5636ec298b0e4324662fe0fb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd6526bda9eea21153f3c3fa1dbf0a32878cdee6959b032ad60549b0e8e289b6ed63a50b7e35fb5f74656ae8305a0e5349e7623c81a9feaad73dfea250984ef9
|
7
|
+
data.tar.gz: 6048a220340c27657b03f7bfc742543345b2f675b4f3bc7c431a2f354bf30592da7025b683e7a6d27f3bd279bccdbcc65261ef3b1ebfdc4e8d93fda02a7f2354
|
data/README.md
CHANGED
@@ -300,6 +300,13 @@ options:
|
|
300
300
|
# When arg lists generate one item only it is auto-selected by default.
|
301
301
|
# Set this to false to disable this behavior
|
302
302
|
auto_select: false
|
303
|
+
|
304
|
+
# Show the command after execution
|
305
|
+
echo: true
|
306
|
+
|
307
|
+
# Marker to use when echoing the command
|
308
|
+
echo_marker: "==>"
|
309
|
+
|
303
310
|
```
|
304
311
|
|
305
312
|
> See: [examples/optons.yml](examples/options.yml)
|
@@ -46,6 +46,7 @@ module MenuCommander
|
|
46
46
|
loop do
|
47
47
|
run_menu
|
48
48
|
say ""
|
49
|
+
@menu = nil
|
49
50
|
break if ENV['MENU_COMMANDER_ENV'] == 'test'
|
50
51
|
end
|
51
52
|
end
|
@@ -54,14 +55,13 @@ module MenuCommander
|
|
54
55
|
command = menu.call
|
55
56
|
@last_command = command
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
end
|
58
|
+
execute = args['--dry'] ? false : true
|
59
|
+
say "$ !txtpur!#{command}".strip if args['--confirm'] or args['--dry']
|
60
|
+
|
61
|
+
execute = prompt.yes?("Execute?") if args['--confirm']
|
62
|
+
system command if execute
|
63
|
+
|
64
|
+
say "!txtblu!#{menu.options.echo_marker} #{command}".strip if menu.options.echo
|
65
65
|
end
|
66
66
|
|
67
67
|
def menu_file
|
data/lib/menu_commander/menu.rb
CHANGED
@@ -20,6 +20,7 @@ module MenuCommander
|
|
20
20
|
|
21
21
|
response.is_a?(String) ? evaluate(response) : call(response)
|
22
22
|
rescue MenuNavigation => e
|
23
|
+
puts "\n\n"
|
23
24
|
call e.menu
|
24
25
|
|
25
26
|
end
|
@@ -35,7 +36,11 @@ module MenuCommander
|
|
35
36
|
end
|
36
37
|
|
37
38
|
def combine_commands(command_array)
|
38
|
-
command_array.
|
39
|
+
if command_array.size == 1
|
40
|
+
command_array.first
|
41
|
+
else
|
42
|
+
command_array.map { |cmd| "(#{cmd})" }.join ' && '
|
43
|
+
end
|
39
44
|
end
|
40
45
|
|
41
46
|
def evaluate(response)
|