autocomplete icon indicating copy to clipboard operation
autocomplete copied to clipboard

[aws] Add `help` subcommand

Open AlanSyue opened this issue 2 years ago • 10 comments

Sanity checks

  • [X] My issue relates to a specific CLI completion spec (e.g. git checkout is missing options in git completion spec). If your issue is more general, please create your issue here: withfig/fig
  • [X] I have searched github.com/withfig/autocomplete/issues and there are no duplicates of my issue
  • [X] I would like to work on this.

What CLI tool does this relate to?

aws

Which statement makes the most sense?

This completion spec isn't complete

Issue Details

Add the help subcommand

  aws help
  aws <command> help
  aws <command> <subcommand> help

AlanSyue avatar May 27 '23 15:05 AlanSyue

Hi is this being worked on already ?

abhisht51 avatar Jun 07 '23 10:06 abhisht51

@abhisht51 Nope, welcome to contribute to it😀

AlanSyue avatar Jun 07 '23 11:06 AlanSyue

@AlanSyue will be my pleasure. Will take this up

abhisht51 avatar Jun 08 '23 06:06 abhisht51

Hi @AlanSyue, I have started work on this. Just wanted your feedback on the work since its a lot of spec addition, I would like to get it right on the first try.

Also, can you guide me on what you'd mean by aws <command> <subcommand> help because this would be super specific I am assuming?

For now, I have been tackling only. PR here

  aws help
  aws <command> help

abhisht51 avatar Jun 09 '23 05:06 abhisht51

@abhisht51 I think it should have a feature to put help after all commands rather than set it repeatedly, but I have no idea how to do that. Maybe we should ask @fedeci .

AWS CLI allows putting help after the subcommand, you can see the demo video below:

https://github.com/withfig/autocomplete/assets/33183531/40a320e5-9485-4811-8dc2-21c19f796428

AlanSyue avatar Jun 09 '23 13:06 AlanSyue

@AlanSyue @abhisht51, isPersistent should be the right way, but right now that property is only available for options. I can make it available for commands too later today! For the moment just assume isPersistent is available for subcommands, you can set it to true for the help subcommand and that will make it available for all children too!

ps: ignore typecheck failures and linting errors

fedeci avatar Jun 09 '23 16:06 fedeci

@fedeci I see, then I am assuming it will make my PR very short. I'd just have to set isPersistent:true to the aws.ts file's subcommand and that should be all right? If that is correct, I'd undo most of my changes and issue a new commit!

abhisht51 avatar Jun 10 '23 07:06 abhisht51

Yes! @abhisht51

fedeci avatar Jun 10 '23 11:06 fedeci

@fedeci I have made the change but I cannot test it for child subcommand yet. Would I need to merge some changes from master ? changes here

abhisht51 avatar Jun 10 '23 11:06 abhisht51

We should wait for the Subcommand interface to implement the isPersistent field so that we can use it to complete this feature. https://github.com/withfig/autocomplete-tools/blob/3c5f3daae19cee8c1bbbe26d41ff19be2b03fff4/types/index.d.ts#L481

AlanSyue avatar Jun 12 '23 15:06 AlanSyue