howzit 2.1.34 → 2.1.35

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: ae81c9417b55c96c640ddd014616581b1f9c0f0f0a97e11344b9b36bf32a00ea
4
- data.tar.gz: 52ac587c3b0315a50a8798c6c9714daa931d01d0383273c3fd5d061d20d5fac6
3
+ metadata.gz: 33c0053826d6797da462f0fdfa4cb505f91fd16fbff68b1feebf4e30b2e20a67
4
+ data.tar.gz: e9251bd45bc5ef8dc59a25ce2be80850eba66a3c9fbe9c1786b2f5637d2946e6
5
5
  SHA512:
6
- metadata.gz: d840417614ccdb60428112cd5b65c9310617844134090a5f98dbf40942a91cd8d3eaeb87fff5a96164ab1065e4eb5babef824b4cf237ac58bfa5fc5aa1139ae8
7
- data.tar.gz: 021be86757f28f7aa8cdc37dbe7ff3279e8eedcc7e8ac23934e99a56e9221fb1c207af826eed76ed92e234325db54d5b9d74c2c46f75be13b3aa2ab4ab9d1052
6
+ metadata.gz: 1c6e5cf35607d239357b4848b24893ae2091b04a4d264ed472c8ef0553c4c676c2e6417fb6af8d76e1333af2e5f9f050afd0fa8ec791a0a2ffe023297db63e59
7
+ data.tar.gz: d5af3431513b66d9f64b253ab1096470c67075780e893aae909b1991027358ea23ad7c759fc4e5dd0c23b95a4e8587879feb0b0964bb044b37fcfc3ce7354c8b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ### 2.1.35
2
+
3
+ 2026-01-14 04:36
4
+
5
+ #### CHANGED
6
+
7
+ - Variables are no longer rendered when displaying topics, showing the raw ${variable} syntax so users can see where variable substitution will occur
8
+
9
+ #### NEW
10
+
11
+ - Topic headers now display accepted variables with their defaults, e.g., "Deploy (increment:1, target:prod)"
12
+ - Variable placeholders (${VAR} and ${VAR:default}) are syntax highlighted in topic display with blue delimiters, bright white variable names, and yellow default values
13
+
1
14
  ### 2.1.34
2
15
 
3
16
  2026-01-09 10:22
@@ -1242,14 +1242,14 @@ module Howzit
1242
1242
  if Howzit.options[:run]
1243
1243
  Howzit.options[:paginate] = false
1244
1244
  summary = Howzit::RunReport.format
1245
- unless summary.empty?
1245
+ if summary.empty?
1246
+ Util.show(output.join("\n").strip, Howzit.options)
1247
+ else
1246
1248
  # Display main output first
1247
1249
  Util.show(output.join("\n").strip, Howzit.options)
1248
1250
  # Display report separately without highlighting to prevent markdown highlighter
1249
1251
  # from reformatting it based on item count
1250
1252
  Util.show(summary, { color: Howzit.options[:color], highlight: false, paginate: false, wrap: 0 })
1251
- else
1252
- Util.show(output.join("\n").strip, Howzit.options)
1253
1253
  end
1254
1254
  else
1255
1255
  Util.show(output.join("\n").strip, Howzit.options)
data/lib/howzit/topic.rb CHANGED
@@ -7,7 +7,7 @@ module Howzit
7
7
 
8
8
  attr_accessor :content
9
9
 
10
- attr_reader :title, :tasks, :prereqs, :postreqs, :results, :named_args, :directives
10
+ attr_reader :title, :tasks, :prereqs, :postreqs, :results, :named_args, :directives, :arg_definitions
11
11
 
12
12
  ##
13
13
  ## Initialize a topic object
@@ -32,6 +32,7 @@ module Howzit
32
32
 
33
33
  # Get named arguments from title
34
34
  def arguments
35
+ @arg_definitions = []
35
36
  return unless @title =~ /\(.*?\) *$/
36
37
 
37
38
  a = @title.match(/\((?<args>.*?)\) *$/)
@@ -39,6 +40,8 @@ module Howzit
39
40
 
40
41
  args.each_with_index do |arg, idx|
41
42
  arg_name, default = arg.split(/:/).map(&:strip)
43
+ # Store original definition for display purposes
44
+ @arg_definitions << (default ? "#{arg_name}:#{default}" : arg_name)
42
45
 
43
46
  @named_args[arg_name] = if Howzit.arguments && Howzit.arguments.count >= idx + 1
44
47
  Howzit.arguments[idx]
@@ -277,7 +280,13 @@ module Howzit
277
280
 
278
281
  output = []
279
282
  if opt[:header]
280
- output.push(@title.format_header)
283
+ # Include argument definitions in header if present
284
+ header_title = @title.dup
285
+ unless @arg_definitions.nil? || @arg_definitions.empty?
286
+ formatted_args = @arg_definitions.map { |arg| format_arg_definition(arg) }.join('{l}, '.c)
287
+ header_title += " {l}({x}#{formatted_args}{l}){x}".c
288
+ end
289
+ output.push(header_title.format_header)
281
290
  output.push('')
282
291
  end
283
292
  # Process conditional blocks first
@@ -302,11 +311,50 @@ module Howzit
302
311
  output.push("{bmK}\u{25B6} {bwK}#{title_code_block(Regexp.last_match.named_captures.symbolize_keys)}{x}".c)
303
312
  else
304
313
  l.wrap!(Howzit.options[:wrap]) if Howzit.options[:wrap].positive?
305
- output.push(l)
314
+ # Highlight variable placeholders in content
315
+ output.push(highlight_variables(l))
306
316
  end
307
317
  end
308
318
  Howzit.named_arguments = @named_args
309
- output.push('').map(&:render_arguments)
319
+ output.push('')
320
+ end
321
+
322
+ ##
323
+ ## Format an argument definition with syntax highlighting
324
+ ## Parentheses in blue, variable name in bright white, default in yellow
325
+ ##
326
+ ## @param arg [String] The argument definition (e.g., "var" or "var:default")
327
+ ##
328
+ ## @return [String] Colorized argument definition
329
+ ##
330
+ def format_arg_definition(arg)
331
+ if arg.include?(':')
332
+ name, default = arg.split(':', 2)
333
+ "{bw}#{name}{l}:{y}#{default}{x}".c
334
+ else
335
+ "{bw}#{arg}{x}".c
336
+ end
337
+ end
338
+
339
+ ##
340
+ ## Highlight variable placeholders in content
341
+ ## Format: ${variable} or ${variable:default}
342
+ ## Dollar sign and braces in blue, variable name in bright white, default in yellow
343
+ ##
344
+ ## @param text [String] The text to process
345
+ ##
346
+ ## @return [String] Text with highlighted variables
347
+ ##
348
+ def highlight_variables(text)
349
+ text.gsub(/\$\{([A-Za-z0-9_]+)(?::([^}]*))?\}/) do
350
+ var_name = Regexp.last_match(1)
351
+ default = Regexp.last_match(2)
352
+ if default
353
+ "{l}\\$\\{{bw}#{var_name}{l}:{y}#{default}{l}\\}{x}".c
354
+ else
355
+ "{l}\\$\\{{bw}#{var_name}{l}\\}{x}".c
356
+ end
357
+ end
310
358
  end
311
359
 
312
360
  include Comparable
@@ -3,5 +3,5 @@
3
3
  # Primary module for this gem.
4
4
  module Howzit
5
5
  # Current Howzit version.
6
- VERSION = '2.1.34'
6
+ VERSION = '2.1.35'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: howzit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.34
4
+ version: 2.1.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra