menu_commander 0.1.2 → 0.1.3
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 +4 -4
- data/lib/menu_commander/command.rb +32 -10
- data/lib/menu_commander/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d7fe866ab431b21325f0e4f8adc8ff913bc76b3a50d0f8385fdf0dcf33dbf2c
|
4
|
+
data.tar.gz: c3bd55de579f4f8201680b1e7694f2156ba4ed60864c6532236019dc98ad4d56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a537d45c0513518ffed2540f4e0cba02018265da124322fee96a31399858a45b3c58f3fa2e9459fcf472775173c128b76e4d5a5c6100c7223d376fde9da8781c
|
7
|
+
data.tar.gz: '0986d862f6660ae0858bf0d6fb67d04d99ee24e4eb86e0da41c334e96e36c05b640cef3bca84c60c2f2d45dc3faedde1615b2479794ec6df9cea44bbdc7e80a8'
|
@@ -1,25 +1,32 @@
|
|
1
1
|
require 'mister_bin'
|
2
|
-
require 'colsole'
|
3
2
|
|
4
3
|
module MenuCommander
|
5
4
|
class Command < MisterBin::Command
|
6
|
-
include Colsole
|
7
|
-
|
8
5
|
help "Menu Commander"
|
9
|
-
|
6
|
+
|
7
|
+
usage "menu [CONFIG --dry --loop]"
|
10
8
|
usage "menu (-h|--help|--version)"
|
9
|
+
|
11
10
|
option "-d --dry", "Dry run - do not execute the command at the end, just show it"
|
11
|
+
option "-l --loop", "Reopen the menu after executing the selected command"
|
12
12
|
option "--version", "Show version number"
|
13
|
+
|
13
14
|
param "CONFIG", "The name of the menu config file without the .yml extension [default: menu]"
|
14
15
|
|
16
|
+
example "menu --dry"
|
17
|
+
example "menu production --loop"
|
18
|
+
example "menu -ld"
|
19
|
+
|
20
|
+
attr_reader :last_command
|
21
|
+
|
15
22
|
def run
|
16
23
|
raise Exit, VERSION if args['--version']
|
17
24
|
raise MenuNotFound.new(paths: menu_paths, config: config) unless menu_file
|
18
25
|
|
19
|
-
if args['--
|
20
|
-
|
26
|
+
if args['--loop']
|
27
|
+
run_looped_menu
|
21
28
|
else
|
22
|
-
|
29
|
+
run_menu
|
23
30
|
end
|
24
31
|
end
|
25
32
|
|
@@ -27,11 +34,26 @@ module MenuCommander
|
|
27
34
|
@menu ||= Menu.new menu_file
|
28
35
|
end
|
29
36
|
|
30
|
-
|
31
|
-
|
37
|
+
private
|
38
|
+
|
39
|
+
def run_looped_menu
|
40
|
+
loop do
|
41
|
+
run_menu
|
42
|
+
say ""
|
43
|
+
break if ENV['MENU_COMMANDER_ENV'] == 'test'
|
44
|
+
end
|
32
45
|
end
|
33
46
|
|
34
|
-
|
47
|
+
def run_menu
|
48
|
+
command = menu.call
|
49
|
+
@last_command = command
|
50
|
+
|
51
|
+
if args['--dry']
|
52
|
+
say "$ !txtpur!#{command}".strip
|
53
|
+
else
|
54
|
+
system command
|
55
|
+
end
|
56
|
+
end
|
35
57
|
|
36
58
|
def menu_file
|
37
59
|
@menu_file ||= menu_file!
|
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.3
|
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-10-
|
11
|
+
date: 2019-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mister_bin
|