foobara-sh-cli-connector 0.0.2 → 0.0.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/CHANGELOG.md +5 -1
- data/src/sh_cli_connector/commands/help.rb +35 -16
- 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: 49472f1f26b8949b20ca528c5c31222114081776021ae2136f4ce869192c53df
|
4
|
+
data.tar.gz: c663144dbd5aa9398d86d2d52593485e3bece7bdd10f18fbec1e3a4bb5c3e18d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b6cb7dbb901da3888895fc2b01b036c9e3bfe10bc295d4adaed6fcf76748d3223b94933d9f71785cfb5766b0fd0788734076d2c36749117a7cea022ebbc1d94
|
7
|
+
data.tar.gz: da9ef8d6866ae4eaa8422932186fd061a1da733983664104629c959b198d136cff80e9488f804a59c54942629beb65919858ce4114a31fbcff47596ac7ca37c9
|
data/CHANGELOG.md
CHANGED
@@ -12,21 +12,34 @@ module Foobara
|
|
12
12
|
def execute
|
13
13
|
print_usage
|
14
14
|
|
15
|
-
if
|
16
|
-
|
17
|
-
|
18
|
-
print_command_input_options
|
19
|
-
end
|
15
|
+
if single_command_mode?
|
16
|
+
print_command_description
|
17
|
+
print_command_input_options
|
20
18
|
else
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
if valid_argument?
|
20
|
+
if argument_is_command?
|
21
|
+
print_command_description
|
22
|
+
print_command_input_options
|
23
|
+
end
|
24
|
+
else
|
25
|
+
print_available_actions
|
26
|
+
print_available_commands
|
27
|
+
end
|
24
28
|
|
25
|
-
|
29
|
+
print_global_options
|
30
|
+
end
|
26
31
|
|
27
32
|
output_string
|
28
33
|
end
|
29
34
|
|
35
|
+
def single_command_mode?
|
36
|
+
command_connector.single_command_mode
|
37
|
+
end
|
38
|
+
|
39
|
+
def command_connector
|
40
|
+
request.command_connector
|
41
|
+
end
|
42
|
+
|
30
43
|
def print_usage
|
31
44
|
if argument
|
32
45
|
if valid_argument?
|
@@ -48,7 +61,13 @@ module Foobara
|
|
48
61
|
end
|
49
62
|
|
50
63
|
def print_usage_without_argument
|
51
|
-
|
64
|
+
usage = if single_command_mode?
|
65
|
+
"[INPUTS]"
|
66
|
+
else
|
67
|
+
"[GLOBAL_OPTIONS] [ACTION] [COMMAND_OR_TYPE] [COMMAND_INPUTS]"
|
68
|
+
end
|
69
|
+
|
70
|
+
output.puts "Usage: #{program_name} #{usage}"
|
52
71
|
end
|
53
72
|
|
54
73
|
def print_usage_for_argument
|
@@ -78,10 +97,6 @@ module Foobara
|
|
78
97
|
command_connector.program_name
|
79
98
|
end
|
80
99
|
|
81
|
-
def command_connector
|
82
|
-
request.command_connector
|
83
|
-
end
|
84
|
-
|
85
100
|
def command_registry
|
86
101
|
command_connector.command_registry
|
87
102
|
end
|
@@ -101,7 +116,11 @@ module Foobara
|
|
101
116
|
def command_class
|
102
117
|
return @command_class if defined?(@command_class)
|
103
118
|
|
104
|
-
@command_class =
|
119
|
+
@command_class = if single_command_mode?
|
120
|
+
command_registry.all_transformed_command_classes.first
|
121
|
+
else
|
122
|
+
argument && command_registry.transformed_command_from_name(argument)
|
123
|
+
end
|
105
124
|
end
|
106
125
|
|
107
126
|
def argument_is_action?
|
@@ -156,7 +175,7 @@ module Foobara
|
|
156
175
|
|
157
176
|
def print_command_input_options
|
158
177
|
output.puts
|
159
|
-
output.puts "Command inputs:"
|
178
|
+
output.puts single_command_mode? ? "Inputs:" : "Command inputs:"
|
160
179
|
output.puts
|
161
180
|
output.puts request.inputs_parser_for(command_class).parser.summarize
|
162
181
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara-sh-cli-connector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: foobara
|