Hyde46/hoard

Named parameters using `hoard pick` are not interpreted as expected

Closed this issue · 3 comments

hoard-rs 1.3.0
Built from source.

Tried setting up a command that uses multiple named parameters to build up a AWS ARN. The named parameters help remember the different parts that goes into the ARN.

Default config, so how I interpret the documentation is that anything in-between # and ! will be assigned as a named variable.

Expected:

✔ Enter parameter(#) nr 1 
~> aws rds describe-pending-maintenance-actions --resource-identifier arn:aws:rds:#region!:#account!:db:#instance-name! --region #region
 · foo
✔ Enter parameter(#) nr 2 
~> aws rds describe-pending-maintenance-actions --resource-identifier arn:aws:rds:foo:#account!:db:#instance-name! --region foo
 · bar
✔ Enter parameter(#) nr 3 
~> aws rds describe-pending-maintenance-actions --resource-identifier arn:aws:rds:foo:bar:db:#instance-name! --region foo
 · car
aws rds describe-pending-maintenance-actions --resource-identifier arn:aws:rds:foo:bar:db:car --region foo

Actual:

✔ Enter parameter(#) nr 1 
~> aws rds describe-pending-maintenance-actions --resource-identifier arn:aws:rds:#region!:#account!:db:#instance-name! --region #region!
 · foo
✔ Enter parameter(#) nr 2 
~> aws rds describe-pending-maintenance-actions --resource-identifier arn:aws:rds:fooregion!:#account!:db:#instance-name! --region #region!
 · bar
✔ Enter parameter(#) nr 3 
~> aws rds describe-pending-maintenance-actions --resource-identifier arn:aws:rds:fooregion!:baraccount!:db:#instance-name! --region #region!
 · car
✔ Enter parameter(#) nr 4 
~> aws rds describe-pending-maintenance-actions --resource-identifier arn:aws:rds:fooregion!:baraccount!:db:carinstance-name! --region #region!
 · dim
aws rds describe-pending-maintenance-actions --resource-identifier arn:aws:rds:fooregion!:baraccount!:db:carinstance-name! --region dimregion!

Tried running the command through the HoardCommand#replace_parameter function and there it seems to behave as expected. So not sure it there is anything wrong with my command or my expectations on how this should work.

Command yml:

  - name: rds-pending-maintenance
    namespace: aws cli 
    tags:
      - rds
      - maintenance
      - aws
    command: "aws rds describe-pending-maintenance-actions --resource-identifier arn:aws:rds:#region!:#account!:db:#instance-name! --region #region!"
    description: Prints pending maintenance actions on RDS instance

Thanks in advance 😃

Hey @MarkusAJacobsen thanks for the report! Your outlined expected behaviour is how it should work. If you choose your command with hoard list, it works ( Or through the shell plug-in installation with autocomplete )

It has been a long time since I last used hoard pick. I'll pick up this inconsistency!

Thanks for the quick feedback @Hyde46.
Works as expected via hoard list, I'll update the issue title.

Fixed (hopefully) with v1.3.1. Thanks again for pointing this out!