commit 8f2b9182e9d2e371b716eabef58d831ede7c9072
parent 89ba82e2b88838b8a49b4dafa23a9cf746f76f03
Author: Daniel Barlow <dan@telent.net>
Date: Tue, 10 Aug 2021 18:02:15 +0100
extract method Moss#config
Diffstat:
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/moss.rb b/moss.rb
@@ -68,6 +68,14 @@ class Moss
File.exist?(pathname) or raise "Can't open #{pathname}: $!"
`age -i #{identity_file} -d #{pathname}`
end
+
+ def config
+ {
+ store: store.to_s,
+ identity_file: identity_file.to_s,
+ git: git_managed?
+ }
+ end
end
MOSS = Moss.new(STORE.parent)
@@ -141,12 +149,7 @@ when 'search','list'
puts n
end
when 'config'
- config = {
- store: STORE.to_s,
- identity_file: identity_file.to_s,
- git: MOSS.git_managed?
- }
- puts JSON.generate(config)
+ puts JSON.generate(MOSS.config)
when 'init'
keyfile = Pathname.new(parameters.first)
MOSS.create(keyfile)