prompt_manager 0.5.4 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1961ec15cc2c3915f9fbc7d4c062b8652843684e39ba885abb5c2d470bf3b1f
4
- data.tar.gz: 3fc189bc89a8eb11c374fd5d27e857cc6da77757c46420f485ff8507eacd0f47
3
+ metadata.gz: 7e471d6dde897f90fcedcabaacdd7a2fb78528b43f73812382b88da07ff655ef
4
+ data.tar.gz: d077a281f07a40eae6ab59caa06278d175abb42855088ccf98659fc97e95a003
5
5
  SHA512:
6
- metadata.gz: cc25a726fc9a7ff1d29f05f636eba74edf40035a78d6918927ea79b1009c863d465860b4561c4ef1672c8df5c7f2dd69acc4457045c44177717eee83c2699729
7
- data.tar.gz: 29598f9c4d15e1f4781a028fa42c2c65f46ba2883880c8ed10f9e9c31353be1488256f6c3212a180615eff21a09a6681a1beb793b8417d0b50674469b002bdcb
6
+ metadata.gz: bdb1c938936daa947678e48c27f55b4e7e66d05d2fbe791db4e45a3da94aebda1cdb2a7bb8f303e36b1d5c97a704d6a0588d2c852c6fd1e6c5f7c20ca1dabe6b
7
+ data.tar.gz: 83395ce83ea16edab586f36fec2e04370c573324053bb2cc0f59e81f0c3188a51408ac08b23ecfd095d7412a256ef264f713c1965ca6ac1cb014902e8814f5fb
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  ## Unreleased
2
2
 
3
3
  ## Released
4
+ ### [0.5.6] = 2025-06-04
5
+ - fixed a problem where shell integration was not working correctly for $(shell command)
6
+
7
+ ### [0.5.5] = 2025-05-21
8
+ - fixed bug in parameter substitution when value is an Array now uses last entry
9
+
4
10
  ### [0.5.4] = 2025-05-18
5
11
  - fixed typo in the Prompt class envvar should have been envar which prevented shell integration from taking place.
6
12
 
@@ -146,6 +146,7 @@ class PromptManager::Prompt
146
146
  def substitute_values(input_text, values_hash)
147
147
  if values_hash.is_a?(Hash) && !values_hash.empty?
148
148
  values_hash.each do |key, value|
149
+ value = value.last if value.is_a?(Array)
149
150
  input_text = input_text.gsub(key, value)
150
151
  end
151
152
  end
@@ -158,6 +159,21 @@ class PromptManager::Prompt
158
159
  def substitute_env_vars(input_text)
159
160
  return input_text unless envar?
160
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
161
177
  input_text.gsub(/\$(\w+)|\$\{(\w+)\}/) do |match|
162
178
  env_var = $1 || $2
163
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.4"
4
+ VERSION = "0.5.6"
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.4
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dewayne VanHoozer