Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Autocomplete for exec and long flags #80

Merged
merged 2 commits into from
Jun 25, 2021
Merged

Autocomplete for exec and long flags #80

merged 2 commits into from
Jun 25, 2021

Conversation

tristanmorgan
Copy link
Owner

Description

Fixes a regression where flags on the exec-command were not getting completions. Also adds a workaround for autocomplete not working when a double dash is the start of a long flag ("--" tab...) by pulling from the raw ARGV variable.

Did you run the Tests?

  • Rubocop
  • Rspec
  • Filemode
  • Yard

Comment on lines +540 to +549
# add warning about old keys
def age_check_and_get(account:, no_token:)
cred = Awskeyring.get_valid_creds(account: account, no_token: no_token)

maxage = Awskeyring.key_age
age = (Time.new - cred[:updated]).div Awskeyring::Awsapi::ONE_DAY
warn I18n.t('message.age_check', account: account, age: age) unless age < maxage

cred
end
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved down from above.

Comment on lines +452 to 459
# when a double dash is parsed it is dropped from the args but we need it
def fix_args(curr, prev)
if prev.nil?
[ARGV[1], ARGV[2]]
else
[curr, prev]
end
end
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 line not covered by tests, sorry. but ARGV stubbing is tricky.

@tristanmorgan tristanmorgan merged commit d9d0be8 into main Jun 25, 2021
@tristanmorgan tristanmorgan deleted the exec-complete branch June 25, 2021 06:40
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants