withfig/autocomplete

[aws] Add `help` subcommand

AlanSyue opened this issue · 10 comments

Sanity checks

  • 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
  • I have searched github.com/withfig/autocomplete/issues and there are no duplicates of my issue
  • 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

Hi is this being worked on already ?

@abhisht51 Nope, welcome to contribute to it😀

@AlanSyue will be my pleasure. Will take this up

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 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:

2023-06-09.9.04.50.mov
fedeci commented

@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 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!

@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

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