foobara-sh-cli-connector 0.0.6 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57a0df47928d8b15c6476bb3e27675c5024b309cd6e9ea5674f45705e6808752
4
- data.tar.gz: e73fe6dc8440af0ba5ad6fff065d6a6a4b64e117c976888980658b1a8bdcd198
3
+ metadata.gz: f62157a31d383d3c3187cdf5e31c486c4fefbddfbc43f160386f874a1aac0278
4
+ data.tar.gz: cb677b2184da2e9bd351f7d2aecf1b80733b3fede34a8f25a47ca22a1e862743
5
5
  SHA512:
6
- metadata.gz: 06dcb088825381e71f5d6ef8d13f7886d840b8de551463cf972ceec66f09e84b1e4013128932136ca52c76107488a03f69b07fb634b6d5bb02b36a2f439512cc
7
- data.tar.gz: 72af7268de883dc4f15c841ca16eca2b630b5d81f24033e8139f4692e7ddf28c167d846fcf57dd5e629b3779048640a381a8ebe3391dc02a1e3c05b26fb2c2aa
6
+ metadata.gz: 48fa9bb84b785bad9890158df3a763a6d842d80e83b072c94c49254b630b89a40c065c8baa1ae982e9ec7ca10ef02ee549c959413630a5319b4f69d73f0bc914
7
+ data.tar.gz: '08d61fe32c10be33fde0254cd3e6b5d22d4fe0411546122e63146c5dd6e81a4de4f90739e6aae5b365d740affbcc29b3bb8c285e49fd69e6a228b876fe7d0c30'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.0.8] - 2024-11-30
2
+
3
+ * Add descriptions to available commands
4
+ * Add support for indent: option
5
+
1
6
  ## [0.0.6] - 2024-10-28
2
7
 
3
8
  * Handle CommandConnector namespace change
@@ -152,9 +152,14 @@ module Foobara
152
152
  output.puts
153
153
  output.puts "Available commands:"
154
154
  output.puts
155
- command_registry.each_transformed_command_class do |command_class|
156
- output.puts " #{command_class.full_command_name}"
155
+
156
+ table = command_registry.all_transformed_command_classes.map do |command_class|
157
+ [" #{command_class.full_command_name}", command_class.description]
157
158
  end
159
+
160
+ serializer = Serializers::CliTabularSerializer.new(indent: 2)
161
+
162
+ output.puts serializer.serialize(table)
158
163
  end
159
164
 
160
165
  def print_global_options
@@ -40,6 +40,10 @@ module Foobara
40
40
  end
41
41
 
42
42
  lines.each do |line|
43
+ if indent > 0
44
+ line = (" " * indent) + line
45
+ end
46
+
43
47
  io.puts line.rstrip
44
48
  end
45
49
  end
@@ -48,8 +52,6 @@ module Foobara
48
52
  end
49
53
 
50
54
  def column_widths(table)
51
- widths = []
52
-
53
55
  max_row_length = table.map(&:size).max
54
56
 
55
57
  widths = [0] * max_row_length
@@ -110,6 +112,17 @@ module Foobara
110
112
  end
111
113
  end
112
114
 
115
+ def indent
116
+ @indent ||= if declaration_data.is_a?(::Hash)
117
+ declaration_data[:indent]
118
+ elsif declaration_data.respond_to?(:indent)
119
+ # TODO: test this
120
+ # :nocov:
121
+ declaration_data.indent
122
+ # :nocov:
123
+ end || 0
124
+ end
125
+
113
126
  def min_final_column_width
114
127
  @min_final_column_width ||= begin
115
128
  config = declaration_data
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.6
4
+ version: 0.0.8
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-10-29 00:00:00.000000000 Z
11
+ date: 2024-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foobara
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements: []
82
- rubygems_version: 3.5.22
82
+ rubygems_version: 3.5.23
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Command-line connector for Foobara