localvault 0.9.8 → 0.9.9

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: fb41c4ac2d8dd408f4e1add9e9d79a7ec8f3f9fc139a8c8575008d0c0a4dd53d
4
- data.tar.gz: d530b0a5e4924f270fe7386a6efb46feaf8ebd27f4b6474b288a6567fc31a9a5
3
+ metadata.gz: 3e609590f2d3491aeb43afb3bf63209d46ba2e2a69823dbbe23a189f742ad0a7
4
+ data.tar.gz: 17124f6838c5187862e9a3b6faa266a16dc8bf21c9ddabe2beec85d5396fefc5
5
5
  SHA512:
6
- metadata.gz: 48c14b4bca2e1de6e48e35f8fba1a44bfb63d2291d86e6a60b4c07baa9b07d77180b8e511c9ad1a93c80681f4ec4c17c885707bb6c50b24545f973c4d770adb2
7
- data.tar.gz: 56c1b8aa333146e7d2553e5c8a81dbaa8077f4185f5b76208086e72a886f2db253e8334232076ca7b6c16ee16bebad391713cbe472f1db75978bfbb7a6107370
6
+ metadata.gz: 2d992f96f563d6f7e4d86083cc25d26ebcfb2d226270bfcaeb6d0ad77b193149082552d88e263d8b58d6b419efdff27701ad2f697d47ebd51bf2cdf825c50ab4
7
+ data.tar.gz: 5ea129e738d979e86714dca84878f5dc333039f8ba4e1a49423909ec024c4308e1fa4b839dedd6243723b9614284909b9c1dc8e810125ba3bd44d86d53c9a34e
@@ -72,10 +72,26 @@ module LocalVault
72
72
  def get(key)
73
73
  vault = open_vault!
74
74
  value = vault.get(key)
75
+
75
76
  if value.nil?
76
- abort_with "Key '#{key}' not found in vault '#{vault.name}'"
77
- return
77
+ # Fall back to case-insensitive substring match
78
+ all_keys = vault.list
79
+ matches = all_keys.select { |k| k.downcase.include?(key.downcase) }
80
+
81
+ if matches.size == 1
82
+ value = vault.get(matches.first)
83
+ $stdout.puts value
84
+ return
85
+ elsif matches.size > 1
86
+ $stderr.puts "Error: Multiple keys match '#{key}'. Be more specific:"
87
+ matches.sort.each { |k| $stderr.puts " #{k}" }
88
+ return
89
+ else
90
+ abort_with "Key '#{key}' not found in vault '#{vault.name}'"
91
+ return
92
+ end
78
93
  end
94
+
79
95
  $stdout.puts value
80
96
  end
81
97
 
@@ -1,3 +1,3 @@
1
1
  module LocalVault
2
- VERSION = "0.9.8"
2
+ VERSION = "0.9.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localvault
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nauman Tariq