prompt_manager 0.5.5 → 0.5.7

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: 5163d8125c7442be07115fd1fb8a20c143f28a05bd6cf9918ff987893ddb3ba9
4
- data.tar.gz: 5b5135be217b02f326c415d0a0eb902eadd57f3621b0787346ee2e0a38b6a419
3
+ metadata.gz: 67c677126888d0f13f742e3076db5f5942fc34a6f7afcfe43c16ec2f80724b8a
4
+ data.tar.gz: a0625fc2d3d136b80df73d5756cf929ba24f05280e7b5e6b35f4423c21979571
5
5
  SHA512:
6
- metadata.gz: 71a5744768aad0b1459d8b1dd0043070ec69f871e2723dff0ca1720c55f0d2aaa1a6080b4f00f6ee3eaa770872fa5cbf267b9a89a6cefdb3b5321a06192a942a
7
- data.tar.gz: 9a711c31b0a1029e2561bb5c0b2debe6239e5ed036ce49861c939bd56db8190b4d34e498d269ceb7556adf7bed500c47a0d52e65921a08558013479f7f14dc6c
6
+ metadata.gz: ca6489b13c3ef2168056904b9199c00badc6b22f431c952fb2084cdfd6d73f903ae31def4f23bcebec5b625d941a7022a243fed7bfd4632205f61e545b1e2187
7
+ data.tar.gz: ada13de6476cb6983d6256fd78979e4a4b55108a7f7612939d8e9d8873e247eb3e10bee336cccb5a0f34a4c24da02a00a3379f4c4cc7627d148e48dd98d5e671
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  ## Unreleased
2
2
 
3
3
  ## Released
4
+ ### [0.5.7] = 2025-06-25
5
+ - fixed a problem when the value of a parameter is an empty array
6
+ - fixed a failing test
7
+
8
+ ### [0.5.6] = 2025-06-04
9
+ - fixed a problem where shell integration was not working correctly for $(shell command)
10
+
4
11
  ### [0.5.5] = 2025-05-21
5
12
  - fixed bug in parameter substitution when value is an Array now uses last entry
6
13
 
@@ -147,7 +147,7 @@ class PromptManager::Prompt
147
147
  if values_hash.is_a?(Hash) && !values_hash.empty?
148
148
  values_hash.each do |key, value|
149
149
  value = value.last if value.is_a?(Array)
150
- input_text = input_text.gsub(key, value)
150
+ input_text = input_text.gsub(key, value.nil? ? '' : value)
151
151
  end
152
152
  end
153
153
  input_text
@@ -159,6 +159,21 @@ class PromptManager::Prompt
159
159
  def substitute_env_vars(input_text)
160
160
  return input_text unless envar?
161
161
 
162
+ # First, handle shell command substitution $(command)
163
+ input_text = input_text.gsub(/\$\(([^\)]+)\)/) do |match|
164
+ cmd = $1.strip
165
+ begin
166
+ # Execute the shell command and capture its output
167
+ result = `#{cmd}`.chomp
168
+ result.empty? ? match : result
169
+ rescue => e
170
+ # If command execution fails, log the error and keep the original text
171
+ warn "Shell command execution failed: #{e.message}"
172
+ match
173
+ end
174
+ end
175
+
176
+ # Then handle environment variables as before
162
177
  input_text.gsub(/\$(\w+)|\$\{(\w+)\}/) do |match|
163
178
  env_var = $1 || $2
164
179
  ENV[env_var] || match
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PromptManager
4
- VERSION = "0.5.5"
4
+ VERSION = "0.5.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prompt_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dewayne VanHoozer