kbsecret 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kbsecret/cli.rb +5 -1
- data/lib/kbsecret/cli/kbsecret-env +3 -0
- data/lib/kbsecret/cli/kbsecret-new +1 -4
- data/lib/kbsecret/cli/kbsecret-new-session +2 -0
- data/lib/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd2a0e23781f3ff9dee95614c891c6189b0f2c55
|
4
|
+
data.tar.gz: da14eb5eaff0117faf18f3f1f12930d1c9119137
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b45a84051c81d24ec69163ec858d7a2cb05d6ce97141497747429816aab6dde958db5580b31f6ed57be33517356efc73a4300d08487f7bb84cdf5f29ad7d761
|
7
|
+
data.tar.gz: 76b13c940c7d334d2df583f9ea22a198761690febf2c0dc68aa7cf20a87cc9f6cbb75585ab8dbbed66c0b0b14d9c62d1e1deaf87f3a2720cd581a4b1da12ffa4
|
data/lib/kbsecret/cli.rb
CHANGED
@@ -3,11 +3,15 @@
|
|
3
3
|
require "colored2"
|
4
4
|
require "slop"
|
5
5
|
require "dreck"
|
6
|
+
require "abbrev"
|
6
7
|
|
7
8
|
module KBSecret
|
8
9
|
# An encapsulation of useful methods for kbsecret's CLI.
|
9
10
|
# Most methods in this class assume that they are being called from the context of
|
10
11
|
class CLI
|
12
|
+
# Abbreviations for record types (e.g., `env` for `environment`).
|
13
|
+
TYPE_ALIASES = Hash.new { |_, k| k }.update(Abbrev.abbrev(Record.record_types)).freeze
|
14
|
+
|
11
15
|
# @return [Slop::Result, nil] the result of option parsing, if requested
|
12
16
|
# via {#slop}
|
13
17
|
attr_reader :opts
|
@@ -115,7 +119,7 @@ module KBSecret
|
|
115
119
|
# @note {#slop} and {#dreck} should be called before this, depending on whether
|
116
120
|
# options or arguments are being tested for a valid session.
|
117
121
|
def ensure_type!(where = :option)
|
118
|
-
type = where == :option ? @opts[:type] : @args[:type]
|
122
|
+
type = TYPE_ALIASES[where == :option ? @opts[:type] : @args[:type]]
|
119
123
|
Record.class_for type
|
120
124
|
end
|
121
125
|
|
@@ -15,6 +15,7 @@ cmd = CLI.create do |c|
|
|
15
15
|
o.string "-s", "--session", "the session to search in", default: :default
|
16
16
|
o.bool "-a", "--all", "retrieve all environment records, not just listed ones"
|
17
17
|
o.bool "-v", "--value-only", "print only the environment value, not the key"
|
18
|
+
o.bool "-n", "--no-export", "print only VAR=val keypairs without `export`"
|
18
19
|
end
|
19
20
|
|
20
21
|
unless c.opts.all?
|
@@ -39,6 +40,8 @@ selected_records = if cmd.opts.all?
|
|
39
40
|
selected_records.each do |record|
|
40
41
|
if cmd.opts.value_only?
|
41
42
|
puts record.value
|
43
|
+
elsif cmd.opts.no_export?
|
44
|
+
puts record.to_assignment
|
42
45
|
else
|
43
46
|
puts record.to_export
|
44
47
|
end
|
@@ -7,9 +7,6 @@ require "tty-prompt"
|
|
7
7
|
|
8
8
|
include KBSecret
|
9
9
|
|
10
|
-
# allows for abbreviated types (e.g., `kbsecret new env ...`)
|
11
|
-
TYPE_ALIASES = Hash.new { |_, k| k }.update(Abbrev.abbrev(Record.record_types)).freeze
|
12
|
-
|
13
10
|
cmd = CLI.create do |c|
|
14
11
|
c.slop do |o|
|
15
12
|
o.banner = <<~HELP
|
@@ -42,7 +39,7 @@ end
|
|
42
39
|
|
43
40
|
type = cmd.args[:type]
|
44
41
|
label = cmd.args[:label]
|
45
|
-
resolved_type = TYPE_ALIASES[type]
|
42
|
+
resolved_type = CLI::TYPE_ALIASES[type]
|
46
43
|
|
47
44
|
if cmd.session.record?(label) && !cmd.opts.force?
|
48
45
|
cmd.die "Refusing to overwrite an existing record without --force."
|
@@ -37,6 +37,8 @@ if cmd.opts[:team]
|
|
37
37
|
|
38
38
|
Config.configure_session(session_label, team: cmd.opts[:team], root: session_label)
|
39
39
|
else
|
40
|
+
cmd.die "Missing `-r', `--root' option." unless cmd.opts[:root]
|
41
|
+
|
40
42
|
cmd.opts[:users].each do |user|
|
41
43
|
cmd.die "Nonexistent Keybase user: '#{user}'." unless Keybase::API.user? user
|
42
44
|
end
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kbsecret
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Woodruff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fpm
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.7
|
159
|
+
version: '0.7'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.7
|
166
|
+
version: '0.7'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: slop
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|