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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73c6d89c7a836a7f9b8d75bbb1bde93a27792dbfbdc4c8cc563b0f1b4127f811
4
- data.tar.gz: fe93e67911337c48cd21c8207bec071de5c5991bbbcccb96fdfc36b2728c346c
3
+ metadata.gz: 155240a1418a0de58a8d3bd88fe97d607cb5f68ea6655f4b3e82ad6628683dad
4
+ data.tar.gz: 99224076df4e631f41e7aef1f0b8a713ff458887943303dbfd691af4e5ddd875
5
5
  SHA512:
6
- metadata.gz: e91c2c5df102632b00cb823943381c4b1548c2baec16bb72c58724b5e0f790cc2eddac774e96efcc072bd8283efdc356e3ef77a39374659030f1fb4ff4c58ce4
7
- data.tar.gz: 70cb85135e88d82902dd3f30e2cd8428f6534480d49c75dfb79001525b31c687bfb11c0df3cc35afe97f41a88e9aa32fc48626539c6788cff0c1c607efbf0a33
6
+ metadata.gz: c8cfc74bf58e2886e28c3ab58f3d04955a57dbbcc4bffe9f450a472651df70f2ab3e1585dc21b1118a1f14e5ae8a1703076f56ff5215f19d623c3420c1883b65
7
+ data.tar.gz: 6c0c9f2f7b5916067b016bac45a3088d349298aff18e6b90e554e7ce2791476d8a5865800e0bbe334d2b07146f8a14b6cd68312a82af43ad6aedc5ffde585106
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  ![Awskeyring](https://raw.githubusercontent.com/tristanmorgan/awskeyring/main/awskeyring-144.png)
4
4
 
5
+ * ![Build Passing](https://github.com/tristanmorgan/awskeyring/actions/workflows/ruby.yml/badge.svg)
5
6
  * [![Gem Version](https://img.shields.io/gem/v/awskeyring)](https://badge.fury.io/rb/awskeyring)
6
7
  * [![license MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)
7
8
  * [![All Downloads](https://img.shields.io/gem/dt/awskeyring)](https://rubygems.org/gems/awskeyring)
@@ -6,7 +6,7 @@ require 'json'
6
6
  # Version const and query of latest.
7
7
  module Awskeyring
8
8
  # The Gem's version number
9
- VERSION = '1.12.0'
9
+ VERSION = '1.12.1'
10
10
  # The Gem's homepage
11
11
  HOMEPAGE = 'https://github.com/tristanmorgan/awskeyring'
12
12
 
@@ -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, *command) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
190
- if command.empty?
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, command.join(' '))
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" "December 2023" "" ""
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.0
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: 2023-12-04 00:00:00.000000000 Z
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.0
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.0
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: []