awskeyring 1.12.0 → 1.12.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 +1 -0
- data/lib/awskeyring/version.rb +1 -1
- data/lib/awskeyring_command.rb +23 -10
- data/man/awskeyring.5 +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 155240a1418a0de58a8d3bd88fe97d607cb5f68ea6655f4b3e82ad6628683dad
|
4
|
+
data.tar.gz: 99224076df4e631f41e7aef1f0b8a713ff458887943303dbfd691af4e5ddd875
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8cfc74bf58e2886e28c3ab58f3d04955a57dbbcc4bffe9f450a472651df70f2ab3e1585dc21b1118a1f14e5ae8a1703076f56ff5215f19d623c3420c1883b65
|
7
|
+
data.tar.gz: 6c0c9f2f7b5916067b016bac45a3088d349298aff18e6b90e554e7ce2791476d8a5865800e0bbe334d2b07146f8a14b6cd68312a82af43ad6aedc5ffde585106
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|

|
4
4
|
|
5
|
+
* 
|
5
6
|
* [](https://badge.fury.io/rb/awskeyring)
|
6
7
|
* [](https://opensource.org/licenses/MIT)
|
7
8
|
* [](https://rubygems.org/gems/awskeyring)
|
data/lib/awskeyring/version.rb
CHANGED
data/lib/awskeyring_command.rb
CHANGED
@@ -186,8 +186,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
186
186
|
method_option 'no-bundle', type: :boolean, aliases: '-b', desc: I18n.t('method_option.nobundle'), default: false
|
187
187
|
method_option 'no-token', type: :boolean, aliases: '-n', desc: I18n.t('method_option.notoken'), default: false
|
188
188
|
# execute an external command with env set
|
189
|
-
def exec(account, *
|
190
|
-
if
|
189
|
+
def exec(account, *exec) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
190
|
+
if exec.empty?
|
191
191
|
warn I18n.t('message.exec')
|
192
192
|
exit 1
|
193
193
|
end
|
@@ -199,7 +199,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
199
199
|
env_vars = Awskeyring::Awsapi.get_env_array(cred)
|
200
200
|
unbundle if options['no-bundle']
|
201
201
|
begin
|
202
|
-
pid = Process.spawn(env_vars,
|
202
|
+
pid = Process.spawn(env_vars, exec.join(' '))
|
203
203
|
Process.wait pid
|
204
204
|
exit 1 if Process.last_status.exitstatus.positive?
|
205
205
|
rescue Errno::ENOENT => e
|
@@ -456,7 +456,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
456
456
|
|
457
457
|
comp_lines = comp_line[0..(comp_point_str.to_i)].split
|
458
458
|
|
459
|
-
comp_type, sub_cmd = comp_type(comp_lines: comp_lines, prev: prev)
|
459
|
+
comp_type, sub_cmd = comp_type(comp_lines: comp_lines, prev: prev, curr: curr)
|
460
460
|
list = fetch_auto_resp(comp_type, sub_cmd)
|
461
461
|
puts list.select { |elem| elem.start_with?(curr) }.sort!.join("\n")
|
462
462
|
end
|
@@ -473,7 +473,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
473
473
|
end
|
474
474
|
|
475
475
|
# determine the type of completion needed
|
476
|
-
def comp_type(comp_lines:, prev:)
|
476
|
+
def comp_type(comp_lines:, prev:, curr:)
|
477
477
|
sub_cmd = sub_command(comp_lines)
|
478
478
|
comp_idx = comp_lines.rindex(prev)
|
479
479
|
|
@@ -484,19 +484,19 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
484
484
|
comp_type = :browser_type
|
485
485
|
else
|
486
486
|
comp_type = :command
|
487
|
-
comp_type = param_type(comp_idx, sub_cmd) unless sub_cmd.empty?
|
487
|
+
comp_type = param_type(comp_idx, sub_cmd, curr) unless sub_cmd.empty?
|
488
488
|
end
|
489
489
|
|
490
490
|
[comp_type, sub_cmd]
|
491
491
|
end
|
492
492
|
|
493
493
|
# check params for named params or fall back to flags
|
494
|
-
def param_type(comp_idx, sub_cmd)
|
495
|
-
types = %i[opt req]
|
494
|
+
def param_type(comp_idx, sub_cmd, curr)
|
495
|
+
types = %i[opt req rest]
|
496
496
|
param_list = method(sub_cmd).parameters.select { |elem| types.include? elem[0] }
|
497
497
|
if comp_idx.zero?
|
498
498
|
:command
|
499
|
-
elsif comp_idx > param_list.length
|
499
|
+
elsif comp_idx > param_list.length || curr.start_with?('-')
|
500
500
|
:flag
|
501
501
|
else
|
502
502
|
param_list[comp_idx - 1][1]
|
@@ -515,7 +515,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
515
515
|
end
|
516
516
|
|
517
517
|
# given a type return the right list for completions
|
518
|
-
def fetch_auto_resp(comp_type, sub_cmd)
|
518
|
+
def fetch_auto_resp(comp_type, sub_cmd) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodLength
|
519
519
|
case comp_type
|
520
520
|
when :command
|
521
521
|
list_commands
|
@@ -529,6 +529,8 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
529
529
|
Awskeyring.list_token_names
|
530
530
|
when :browser_type
|
531
531
|
Awskeyring.list_browsers
|
532
|
+
when :exec
|
533
|
+
list_exec
|
532
534
|
else
|
533
535
|
list_arguments(command: sub_cmd)
|
534
536
|
end
|
@@ -540,6 +542,17 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
|
|
540
542
|
commands.reject! { |elem| %w[autocomplete default decode].include?(elem) }
|
541
543
|
end
|
542
544
|
|
545
|
+
# list executables
|
546
|
+
def list_exec
|
547
|
+
list = []
|
548
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
549
|
+
list.concat(Dir.children(File.expand_path(path)))
|
550
|
+
rescue Errno::ENOENT
|
551
|
+
next
|
552
|
+
end
|
553
|
+
list.flatten
|
554
|
+
end
|
555
|
+
|
543
556
|
# list flags for a command
|
544
557
|
def list_arguments(command:)
|
545
558
|
options = self.class.all_commands[command].options.values
|
data/man/awskeyring.5
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "AWSKEYRING" "5" "
|
4
|
+
.TH "AWSKEYRING" "5" "June 2024" "" ""
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBAwskeyring\fR \- is a small tool to manage AWS account keys in the macOS Keychain
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awskeyring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tristan Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-iam
|
@@ -92,9 +92,9 @@ licenses:
|
|
92
92
|
metadata:
|
93
93
|
bug_tracker_uri: https://github.com/tristanmorgan/awskeyring/issues
|
94
94
|
changelog_uri: https://github.com/tristanmorgan/awskeyring/blob/main/CHANGELOG.md
|
95
|
-
documentation_uri: https://rubydoc.info/gems/awskeyring/1.12.
|
95
|
+
documentation_uri: https://rubydoc.info/gems/awskeyring/1.12.1
|
96
96
|
rubygems_mfa_required: 'true'
|
97
|
-
source_code_uri: https://github.com/tristanmorgan/awskeyring/tree/v1.12.
|
97
|
+
source_code_uri: https://github.com/tristanmorgan/awskeyring/tree/v1.12.1
|
98
98
|
wiki_uri: https://github.com/tristanmorgan/awskeyring/wiki
|
99
99
|
post_install_message:
|
100
100
|
rdoc_options: []
|