rizin icon indicating copy to clipboard operation
rizin copied to clipboard

Support separate help entries when number of arguments is different

Open ret2libc opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. Sometimes you want to have one command name to deal with multiple operations. A classical example is the "print" command, which can often be executed without arguments to print a list of items and with an argument to print the details of one specific item. Right now we have to put together the helps of both functionalities and everything has to be the same (e.g. the modes).

[0x00006b60]> t?
Usage: t[?]   # Types, noreturn, signatures, C parser and more
| t[j*] [<type>] # List all types / Show type information

Describe the solution you'd like It would be awesome to be able to specify two separate entries in the YAML files and use the same name for both of them but provide separate handlers. RzShell should be able to know which handler to call based on the number of arguments provided by the user.

[0x00006b60]> t?
Usage: t[?]   # Types, noreturn, signatures, C parser and more
| t[jtq*] # List all types
| t[j*] <type> # Show type information

Notice both commands have the same name (t, but they can have different modes available, different summary/description, etc.). One possible problem with that is how to get the description/summary. Because if you do t?? what do you want to get? The first? The second? Both? This shall be thought well.

Describe alternatives you've considered None.

Additional context None

ret2libc avatar Aug 09 '21 09:08 ret2libc