awskeyring 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b18067d6aad4daed7c723e3b67cdd3983d66ae67
4
- data.tar.gz: 4975855826aadafe2631abcd7fa98658f15b0e18
3
+ metadata.gz: 2cc56e9c03339dd2516abf62a94d07dcccef3b50
4
+ data.tar.gz: d568b27b9b8648cfc5e72bc2aa033397d21163f3
5
5
  SHA512:
6
- metadata.gz: c50766e6d2fe027102d49c8cf71b1974806f2a248e28083927f0fd4a709179a33649d1432fd14f96c18d2df9c4c05b3188e114fc6feaa34b85d32ca6bc3d8a57
7
- data.tar.gz: 650c4c01e6202148a7ab063cc017739596bda2bffa9bc0b605a383d7fa211159abef6c61101d464d64d9878ea0abc69f24f59937af04bee8d7b438d23bfc1b06
6
+ metadata.gz: c153176f3d556eecd47ecd3dc7d1b825a187913e82a41f17e1fc514d9dc3ea49bf80d7f1cb624d6737c10199c1e7b4c1521eb809699be5ef30dba0ee0b318633
7
+ data.tar.gz: c6ec6d01d3ecaaf7c9bb3a22dc0ec361485f5fe1f864174cd43420923fd0ebf6a80cfb26592f970e771612ef84943e10b7c98af9a9a9810afa5b5b60e046006f
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Change Log
2
2
 
3
- ## [v0.5.1](https://github.com/vibrato/awskeyring/tree/v0.5.1) (2018-09-13)
3
+ ## [v0.5.2](https://github.com/vibrato/awskeyring/tree/v0.5.2) (2018-09-18)
4
+ [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.5.1...v0.5.2)
5
+
6
+ **Implemented enhancements:**
7
+
8
+ - More robust autocomplete. [\#30](https://github.com/vibrato/awskeyring/pull/30) ([tristanmorgan](https://github.com/tristanmorgan))
9
+
10
+ ## [v0.5.1](https://github.com/vibrato/awskeyring/tree/v0.5.1) (2018-09-12)
4
11
  [Full Changelog](https://github.com/vibrato/awskeyring/compare/v0.5.0...v0.5.1)
5
12
 
6
13
  **Implemented enhancements:**
@@ -1,4 +1,4 @@
1
1
  module Awskeyring
2
2
  # The Gems version number
3
- VERSION = '0.5.1'.freeze
3
+ VERSION = '0.5.2'.freeze
4
4
  end
@@ -13,7 +13,6 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
13
13
  I18n.backend.load_translations
14
14
 
15
15
  map %w[--version -v] => :__version
16
- map %w[--help -h] => :help
17
16
  map ['init'] => :initialise
18
17
  map ['con'] => :console
19
18
  map ['ls'] => :list
@@ -22,6 +21,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
22
21
  map ['rmr'] => :remove_role
23
22
  map ['rmt'] => :remove_token
24
23
  map ['rot'] => :rotate
24
+ map ['tok'] => :token
25
25
  map ['up'] => :update
26
26
 
27
27
  desc '--version, -v', I18n.t('__version.desc')
@@ -357,11 +357,21 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
357
357
 
358
358
  private
359
359
 
360
+ def age_check_and_get(account:, no_token:)
361
+ cred = Awskeyring.get_valid_creds(account: account, no_token: no_token)
362
+
363
+ maxage = Awskeyring.prefs[:keyage] || Awskeyring::DEFAULT_KEY_AGE
364
+ age = (Time.new - cred[:updated]).div Awskeyring::Awsapi::ONE_DAY
365
+ warn I18n.t('message.age_check', account: account, age: age) unless age < maxage
366
+
367
+ cred
368
+ end
369
+
360
370
  def comp_type(comp_line:, curr:, prev:)
361
371
  comp_len = comp_line.split.index(prev)
362
- sub_cmd = comp_line.split[1] if comp_len > 0
372
+ sub_cmd = sub_command(comp_line.split)
363
373
 
364
- comp_len = 3 if curr.start_with?('-') && !sub_cmd.nil?
374
+ comp_len = 3 if curr.start_with?('-')
365
375
 
366
376
  case prev
367
377
  when 'help'
@@ -373,14 +383,14 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
373
383
  [curr, comp_len, sub_cmd]
374
384
  end
375
385
 
376
- def age_check_and_get(account:, no_token:)
377
- cred = Awskeyring.get_valid_creds(account: account, no_token: no_token)
386
+ def sub_command(comp_lines)
387
+ return nil if comp_lines.nil? || comp_lines.length < 2
378
388
 
379
- maxage = Awskeyring.prefs[:keyage] || Awskeyring::DEFAULT_KEY_AGE
380
- age = (Time.new - cred[:updated]).div Awskeyring::Awsapi::ONE_DAY
381
- warn I18n.t('message.age_check', account: account, age: age) unless age < maxage
389
+ sub_cmd = comp_lines[1]
382
390
 
383
- cred
391
+ return sub_cmd if self.class.all_commands.keys.index(sub_cmd)
392
+
393
+ self.class.map[sub_cmd].to_s
384
394
  end
385
395
 
386
396
  def print_auto_resp(curr, len, sub_cmd)
@@ -405,7 +415,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
405
415
  end
406
416
 
407
417
  def list_arguments(command:)
408
- command = list_commands.find { |elem| elem.start_with?(command) }
418
+ exit 1 if command.empty?
409
419
  self.class.all_commands[command].options.values.map(&:aliases).flatten! +
410
420
  self.class.all_commands[command].options.values.map(&:switch_name)
411
421
  end
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: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tristan Morgan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-12 00:00:00.000000000 Z
11
+ date: 2018-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-iam