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 +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/prompt_manager/prompt.rb +16 -1
- data/lib/prompt_manager/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67c677126888d0f13f742e3076db5f5942fc34a6f7afcfe43c16ec2f80724b8a
|
4
|
+
data.tar.gz: a0625fc2d3d136b80df73d5756cf929ba24f05280e7b5e6b35f4423c21979571
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|