commit e2e0e160b4535d986b78999ec40e71fc42282717
parent e3deb729ceee13f2c713a840f5c575042b4b144d
Author: Daniel Barlow <dan@telent.net>
Date: Mon, 9 Aug 2021 09:38:16 +0100
"list" is an alias for "search"
Diffstat:
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/features/moss.feature b/features/moss.feature
@@ -22,6 +22,13 @@ Feature: command-line password management
When I view the secret "home/ebay"
Then I see the string "horsebattery"
+ Scenario: I can list secrets
+ Given I am using the example password store
+ When I list the secrets
+ Then I see the string "work/gmail"
+ And I see the string "home/yahoomail"
+ And I see the string "home/ebay"
+
Scenario: I can search for a secret
Given I am using the example password store
When I search for "mail"
@@ -42,4 +49,4 @@ Feature: command-line password management
Scenario: Different recipients can be set per subtree
- Scenario: I can list secrets
+
diff --git a/features/step_definitions/steps.rb b/features/step_definitions/steps.rb
@@ -63,6 +63,10 @@ When("I search for {string}") do |term|
@i_see = shell "#{MOSS} search #{term}"
end
+When("I list the secrets") do
+ @i_see = shell "#{MOSS} list"
+end
+
When("I edit {string}") do |name|
ENV["EDITOR"] = "./fixtures/fakedit.sh"
@i_see = shell "#{MOSS} edit #{name}"
diff --git a/moss.rb b/moss.rb
@@ -64,7 +64,7 @@ when 'edit'
raise "#{$!}"
end
end
-when 'search'
+when 'search','list'
term = parameters.join(" ")
files = Dir[STORE.join('**/*.age')].map {|n|
Pathname.new(n).relative_path_from(STORE).sub_ext('').to_s