prompt_manager 0.5.5 → 0.5.6
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 +3 -0
- data/lib/prompt_manager/prompt.rb +15 -0
- 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: 7e471d6dde897f90fcedcabaacdd7a2fb78528b43f73812382b88da07ff655ef
|
4
|
+
data.tar.gz: d077a281f07a40eae6ab59caa06278d175abb42855088ccf98659fc97e95a003
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdb1c938936daa947678e48c27f55b4e7e66d05d2fbe791db4e45a3da94aebda1cdb2a7bb8f303e36b1d5c97a704d6a0588d2c852c6fd1e6c5f7c20ca1dabe6b
|
7
|
+
data.tar.gz: 83395ce83ea16edab586f36fec2e04370c573324053bb2cc0f59e81f0c3188a51408ac08b23ecfd095d7412a256ef264f713c1965ca6ac1cb014902e8814f5fb
|
data/CHANGELOG.md
CHANGED
@@ -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
|