leeloo 0.0.10 → 0.0.11

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
  SHA1:
3
- metadata.gz: 21794ba02cc97061ed8ae02b5ea0b5302c5ed499
4
- data.tar.gz: 0b07492f3b58fcbf79a239ebcdf2ad8cf106b842
3
+ metadata.gz: ce89a8b48445f8a5afe2487a5ed49a8d0c3ec44c
4
+ data.tar.gz: 268ef25fd70970d0d19e0426b062ed104d0ae362
5
5
  SHA512:
6
- metadata.gz: eb305a8ed35ee6a85318a8753f6cf54a0b5d5c6decc9c96d4abcc10f5f6afae9ef50a11ecb551907ed14e194a1ffb4a3c50e53b8c669e1e96db38976eddcd7d0
7
- data.tar.gz: 2812b7046a6b18e532e9412a2fba0356d4f0738dc7d833bf3395f1f46a563d61298ee1ebb9473cb1cd22385b5b736ec51f2d2c56a6065af25192c1c4f8b2268d
6
+ metadata.gz: 6038afa0d03ed117af88448ed7d234e60f3a16804c02ca5261f431671da6f134cfad761bcb31e98b6d8c782775b74ba2cbcc40ab5cc7eaf4a217bcc282d96b4f
7
+ data.tar.gz: 3cb154d289f0f9a97641c2a4a480de6963ed784642372501dbafe56181655d3c88f5c4c088c9494f7f4702a29a11578e743e471fa1f8912df2e07af5be3cb5c9
@@ -32,9 +32,11 @@ module Leeloo
32
32
  command :"list-keystore" do |c|
33
33
  c.syntax = 'leeloo list'
34
34
  c.description = "Display keystores list"
35
+ c.option '--ascii', nil, 'display secrets without unicode tree'
36
+
35
37
  c.action do |args, options|
36
38
 
37
- Config::list_keystores
39
+ Config::list_keystores options.ascii
38
40
  end
39
41
  end
40
42
  alias_command :keystore, :"list-keystore"
@@ -43,13 +45,16 @@ module Leeloo
43
45
  c.syntax = 'leeloo list secret [options]'
44
46
  c.description = "Display secrets list of keystore"
45
47
  c.option '--keystore STRING', String, 'a selected keystore'
48
+ c.option '--ascii', nil, 'display secrets without unicode tree'
46
49
 
47
50
  c.action do |args, options|
48
51
  options.default :keystore => Config.default['keystore']
49
- Secret::list Config.get_keystore(options.keystore)
52
+
53
+ Secret::list Config.get_keystore(options.keystore), options.ascii
50
54
  end
51
55
  end
52
56
  alias_command :list, :"list-secret"
57
+ alias_command :secrets, :"list-secret"
53
58
 
54
59
  command :"add-keystore" do |c|
55
60
  c.syntax = 'leeloo add keystore <name> <path>'
data/lib/leeloo/config.rb CHANGED
@@ -19,13 +19,17 @@ module Leeloo
19
19
  Config::add_keystore "private", "#{PATH}/private"
20
20
  end
21
21
 
22
- def self.list_keystores
23
- rows = []
24
- @@keystores.each do |keystore|
25
- is_default = '*' if keystore['name'] == @@default['keystore']
26
- rows << [keystore['name'], keystore['path'], is_default ]
22
+ def self.list_keystores(ascii)
23
+ if ascii
24
+ @@keystores.each { |keystore| puts keystore['name'] }
25
+ else
26
+ rows = []
27
+ @@keystores.each do |keystore|
28
+ is_default = '*' if keystore['name'] == @@default['keystore']
29
+ rows << [keystore['name'], keystore['path'], is_default ]
30
+ end
31
+ say Terminal::Table.new :headings => ['Name', 'Path', 'Default'], :rows => rows
27
32
  end
28
- say Terminal::Table.new :headings => ['Name', 'Path', 'Default'], :rows => rows
29
33
  end
30
34
 
31
35
  def self.load
data/lib/leeloo/secret.rb CHANGED
@@ -4,10 +4,18 @@ require 'git'
4
4
  require 'fileutils'
5
5
 
6
6
  module Leeloo
7
+
7
8
  class Secret
8
9
 
9
- def self.list(keystore)
10
- puts TTY::Tree.new("#{keystore}/secrets").render.gsub("\.gpg","")
10
+ def self.list(keystore, ascii)
11
+ if ascii
12
+ secrets = Dir.glob("#{keystore}/secrets/**/*.gpg")
13
+ .sort
14
+ .reject { |path| File.directory? path }
15
+ .each { |secret| puts secret.gsub(/#{keystore}\/secrets\//, '').gsub(/\.gpg/, '') }
16
+ else
17
+ puts TTY::Tree.new("#{keystore}/secrets").render.gsub(/\.gpg/, '')
18
+ end
11
19
  end
12
20
 
13
21
  def self.add_secret(keystore, name, secret)
@@ -1,4 +1,4 @@
1
1
  module Leeloo
2
- VERSION = '0.0.10'.freeze
2
+ VERSION = '0.0.11'.freeze
3
3
  DESCRIPTION = "The easiest way to share securely your secrets".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leeloo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvek