kbsecret 1.2.0 → 1.3.0.pre.1
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 +4 -4
- data/README.md +5 -5
- data/bin/kbsecret +6 -14
- data/lib/kbsecret/cli/command/abstract.rb +51 -0
- data/lib/kbsecret/cli/command/conf.rb +42 -0
- data/lib/kbsecret/cli/command/cp.rb +54 -0
- data/lib/kbsecret/cli/command/dump_fields.rb +53 -0
- data/lib/kbsecret/cli/command/env.rb +66 -0
- data/lib/kbsecret/cli/command/generator.rb +62 -0
- data/lib/kbsecret/cli/command/generators.rb +37 -0
- data/lib/kbsecret/cli/command/list.rb +48 -0
- data/lib/kbsecret/cli/command/login.rb +66 -0
- data/lib/kbsecret/cli/command/new.rb +82 -0
- data/lib/kbsecret/cli/command/pass.rb +51 -0
- data/lib/kbsecret/cli/command/raw_edit.rb +46 -0
- data/lib/kbsecret/cli/command/rm.rb +58 -0
- data/lib/kbsecret/cli/command/session.rb +128 -0
- data/lib/kbsecret/cli/command/sessions.rb +47 -0
- data/lib/kbsecret/cli/command/stash_file.rb +62 -0
- data/lib/kbsecret/cli/command/todo.rb +78 -0
- data/lib/kbsecret/cli/command.rb +45 -0
- data/lib/kbsecret/cli.rb +6 -4
- data/lib/kbsecret/config.rb +4 -3
- data/lib/kbsecret/record/abstract.rb +2 -2
- data/lib/kbsecret/record.rb +9 -7
- data/lib/kbsecret/version.rb +1 -1
- metadata +22 -20
- data/lib/kbsecret/cli/kbsecret-conf +0 -31
- data/lib/kbsecret/cli/kbsecret-cp +0 -44
- data/lib/kbsecret/cli/kbsecret-dump-fields +0 -39
- data/lib/kbsecret/cli/kbsecret-env +0 -53
- data/lib/kbsecret/cli/kbsecret-generator +0 -42
- data/lib/kbsecret/cli/kbsecret-generators +0 -28
- data/lib/kbsecret/cli/kbsecret-list +0 -36
- data/lib/kbsecret/cli/kbsecret-login +0 -53
- data/lib/kbsecret/cli/kbsecret-new +0 -68
- data/lib/kbsecret/cli/kbsecret-pass +0 -37
- data/lib/kbsecret/cli/kbsecret-raw-edit +0 -31
- data/lib/kbsecret/cli/kbsecret-rm +0 -44
- data/lib/kbsecret/cli/kbsecret-session +0 -105
- data/lib/kbsecret/cli/kbsecret-sessions +0 -38
- data/lib/kbsecret/cli/kbsecret-stash-file +0 -48
- data/lib/kbsecret/cli/kbsecret-todo +0 -47
@@ -1,38 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "kbsecret"
|
5
|
-
|
6
|
-
include KBSecret
|
7
|
-
|
8
|
-
cmd = CLI.create do |c|
|
9
|
-
c.slop do |o|
|
10
|
-
o.banner = <<~HELP
|
11
|
-
Usage:
|
12
|
-
kbsecret sessions [options]
|
13
|
-
HELP
|
14
|
-
|
15
|
-
o.bool "-a", "--show-all", "show each session in depth (i.e. metadata)"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
Config.session_labels.each do |sess_name|
|
20
|
-
session_hash = Config.session(sess_name)
|
21
|
-
session = cmd.guard { Session[sess_name] }
|
22
|
-
|
23
|
-
puts sess_name
|
24
|
-
|
25
|
-
next unless cmd.opts.show_all?
|
26
|
-
|
27
|
-
if session_hash[:team]
|
28
|
-
puts <<~DETAIL
|
29
|
-
\tTeam: #{session_hash[:team]}
|
30
|
-
\tSecrets root: #{session_hash[:root]} (#{session.path})
|
31
|
-
DETAIL
|
32
|
-
else
|
33
|
-
puts <<~DETAIL
|
34
|
-
\tUsers: #{session_hash[:users].join(", ")}
|
35
|
-
\tSecrets root: #{session_hash[:root]} (#{session.path})
|
36
|
-
DETAIL
|
37
|
-
end
|
38
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "kbsecret"
|
5
|
-
require "base64"
|
6
|
-
|
7
|
-
include KBSecret
|
8
|
-
|
9
|
-
cmd = CLI.create do |c|
|
10
|
-
c.slop do |o|
|
11
|
-
o.banner = <<~HELP
|
12
|
-
Usage:
|
13
|
-
kbsecret stash-file <record> [file]
|
14
|
-
HELP
|
15
|
-
|
16
|
-
o.string "-s", "--session", "the session to add to", default: :default
|
17
|
-
o.bool "-f", "--force", "force creation (ignore overwrites, etc.)"
|
18
|
-
o.bool "-b", "--base64", "encode the file as base64"
|
19
|
-
end
|
20
|
-
|
21
|
-
c.dreck errors: false do
|
22
|
-
string :label
|
23
|
-
string :filename
|
24
|
-
end
|
25
|
-
|
26
|
-
c.ensure_session!
|
27
|
-
end
|
28
|
-
|
29
|
-
label = cmd.args[:label]
|
30
|
-
filename = cmd.args[:filename]
|
31
|
-
|
32
|
-
cmd.die "Missing a record label to create." unless label
|
33
|
-
|
34
|
-
if cmd.session.record?(label) && !cmd.opts.force?
|
35
|
-
cmd.die "Refusing to overwrite an existing record without --force."
|
36
|
-
end
|
37
|
-
|
38
|
-
contents = if filename.empty? || filename == "-"
|
39
|
-
STDIN.read
|
40
|
-
elsif File.file?(filename)
|
41
|
-
File.read(filename)
|
42
|
-
else
|
43
|
-
cmd.die "That file doesn't exist."
|
44
|
-
end
|
45
|
-
|
46
|
-
contents = Base64.encode64(contents) if cmd.opts.base64?
|
47
|
-
|
48
|
-
cmd.guard { cmd.session.add_record(:unstructured, label, contents) }
|
@@ -1,47 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "kbsecret"
|
5
|
-
|
6
|
-
include KBSecret
|
7
|
-
|
8
|
-
cmd = CLI.create do |c|
|
9
|
-
c.slop cmds: %w[start suspend complete] do |o|
|
10
|
-
o.banner = <<~HELP
|
11
|
-
Usage:
|
12
|
-
kbsecret todo <start|suspend|complete> <record>
|
13
|
-
HELP
|
14
|
-
|
15
|
-
o.string "-s", "--session", "the session to search in", default: :default
|
16
|
-
end
|
17
|
-
|
18
|
-
c.dreck do
|
19
|
-
string :command
|
20
|
-
string :label
|
21
|
-
end
|
22
|
-
|
23
|
-
c.ensure_session!
|
24
|
-
end
|
25
|
-
|
26
|
-
label = cmd.args[:label]
|
27
|
-
todo = cmd.session[label]
|
28
|
-
|
29
|
-
cmd.die "No such record." unless todo
|
30
|
-
cmd.die "'#{todo}' is not a todo record." unless todo.type == :todo
|
31
|
-
|
32
|
-
case cmd.args[:command]
|
33
|
-
when "start"
|
34
|
-
cmd.die "That task is already started!" if todo.started?
|
35
|
-
todo.start!
|
36
|
-
puts "#{todo.label}: '#{todo.todo}' marked as started at #{todo.start}"
|
37
|
-
when "suspend"
|
38
|
-
cmd.die "That task is already suspended!" if todo.suspended?
|
39
|
-
todo.suspend!
|
40
|
-
puts "#{todo.label}: '#{todo.todo}' marked as suspended at #{todo.stop}"
|
41
|
-
when "complete"
|
42
|
-
cmd.die "That task is already completed!" if todo.completed?
|
43
|
-
todo.complete!
|
44
|
-
puts "#{todo.label}: '#{todo.todo}' marked as completed at #{todo.stop}"
|
45
|
-
else
|
46
|
-
cmd.die "Unknown subcommand: '#{cmd.args[:command]}'."
|
47
|
-
end
|