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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b1018788f796d0bfc6ae3756d69ad14784d53f5e71a8a9858fe7b6911c79b9b
4
- data.tar.gz: a629294b8364e4ba86fa1031f52e11266c835e2cfb371ecc479082d8f832afd9
3
+ metadata.gz: 49472f1f26b8949b20ca528c5c31222114081776021ae2136f4ce869192c53df
4
+ data.tar.gz: c663144dbd5aa9398d86d2d52593485e3bece7bdd10f18fbec1e3a4bb5c3e18d
5
5
  SHA512:
6
- metadata.gz: 983515e65dcdbdc13c2a63c64fda3524bfc383275b80a7a3950f94acd84cd84bb52a2e2e073b688fc6410f3e6d5f7f11d7fae843b7503c32e7935872c4cd8ca8
7
- data.tar.gz: 186305f0c99bc81f8093ca8cb987defe85afd879a29ec9eb653804e96498301b02a2e59cc388512f742d7363c103bbd958b6dca02d0ba48ac9f78f67fe59b1c0
6
+ metadata.gz: 2b6cb7dbb901da3888895fc2b01b036c9e3bfe10bc295d4adaed6fcf76748d3223b94933d9f71785cfb5766b0fd0788734076d2c36749117a7cea022ebbc1d94
7
+ data.tar.gz: da9ef8d6866ae4eaa8422932186fd061a1da733983664104629c959b198d136cff80e9488f804a59c54942629beb65919858ce4114a31fbcff47596ac7ca37c9
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
+ ## [0.0.3]
2
+
3
+ * Make use of single-command mode in Help command
4
+
1
5
  ## [0.0.2]
2
6
 
3
- * Add single command mode
7
+ * Add single-command mode
4
8
 
5
9
  ## [0.0.1]
6
10
 
@@ -12,21 +12,34 @@ module Foobara
12
12
  def execute
13
13
  print_usage
14
14
 
15
- if valid_argument?
16
- if argument_is_command?
17
- print_command_description
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
- print_available_actions
22
- print_available_commands
23
- end
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
- print_global_options
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
- output.puts "Usage: #{program_name} [GLOBAL_OPTIONS] [ACTION] [COMMAND_OR_TYPE] [COMMAND_INPUTS]"
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 = argument && command_registry.transformed_command_from_name(argument)
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.2
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-12 00:00:00.000000000 Z
11
+ date: 2024-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foobara