spring-shell icon indicating copy to clipboard operation
spring-shell copied to clipboard

Add `getCommand` method to withTarget function context

Open NPCDW opened this issue 1 year ago • 3 comments

An alias can be set when the command is registered, so I want to distinguish which command the user is using for more detailed prompts and statistics.

The version I am currently using is 3.0.1

NPCDW avatar Apr 07 '23 12:04 NPCDW

We have a support for command aliases but it's a bit unclear what you are asking? Would you mind giving more details, possible with command output examples.

jvalkeal avatar Apr 07 '23 16:04 jvalkeal

Sorry if my description confused you.

Does the image below express my question more clearly image

I hope you can add a method in the withTarget context to get the command or raw command entered by the user

NPCDW avatar Apr 08 '23 07:04 NPCDW

Ah right yes I can see how this would be more convenient for a user to know more about how things got resolved.

CommandContext has getRawArgs method but indeed you are not directly given access to a command itself(we obviously know that internally). Might also be nice to have a flag if it was resolved from an alias as those are usually used for backward compatibility and maybe user needs to get notified about it or whatever shell implementation could use it for.

jvalkeal avatar Apr 09 '23 15:04 jvalkeal