So far all the help sections were statically generated from the YAML
files, however sometimes you may want to list things in the help
messages that depend on what is loaded in Rizin (e.g. plugins, etc.).
This patch adds support for a details_cb that provides a dynamically
created RzCmdDescDetail array.
* Cleanup RzAnalysisRzil when freeing RzAnalysis
* Fix str leaking in rz_core_write_string_at
* Fix buf leaking in rz_core_yank_paste
* Fix memleak in json unit tests
* Fix features leaking in RzBinInfo
* Fix features leaking in RzAsm
* Fix memleaks in RzTable
* Fix test_str_search memleaks
* Fix memleak in test_io.c
* Fix memleaks in RzBuf and test_buf.c
* Fix memleaks in test_cmd.c
* Fix memleaks in test_config.c
* Fix memleaks in RzCons
* Fix hashes leaking in test_bin.c
* Fix memleaks in test_id_storage.c
* Fix memleaks in test_il*.c and adjust APIs
* `<cmd>?` allows to list the sub-commands of <cmd>. If <cmd> has no
sub-commands, the full help of <cmd> is printed instead.
* `<cmd>??` allows to always list the full help of <cmd>. Useful when
<cmd> is both the name of a group and a command itself.
* output modes are only listed as part of the full help and not
considered as sub-commands.
* fix a bug where `<cmd><mode>?` was just printing the list of
sub-commands of <cmd> instead of the full help of <cmd><mode>.
Some commands might have one of the output modes as default one. If
that's the case, RzCmd should be aware of that so that it can
initializes everything needed for that default mode.
For example, if command `c` supports TABLE, JSON and QUIET and you want
to have `c`(with no suffix) print the TABLE mode, the parser would have
to initialize the RzTable data structures anyway, so it must be aware of
it.
Removed unused code and comments.
Removed dead code
Moved print method outside class.c
Moved json method outside class.c
Removed yc_w_refs and i_mref which never worked.
Fixed set_flags method to work as intended.
Fixed various parsing errors.
Fixed many memory leaks.
Fixed "insecure" rz_cons_printf warning.
removed `#define V`, `#define U` and `#define _`
Implemented newshell calls.
Optimized code.
Refactoring rz_bin_java_get_field_offsets
Avoid loading static core plugins when not needed.
Removed useless `if 0`
* Print proper error message when command does not exist
* Improve error messages on wrong arguments or wrong help
* Fix cmd_w test
* Check char * and avoid calling old input commands
* Fix english
* Check for NULLs and fix memleak
* Disable colors on Windows because terminal looks bad otherwise
* Use environment on Windows to set PATH and make sure unit tests use
the compiled libraries and not the installed ones
* Define ssize_t on Windows as well by using SSIZE_T
Update test_analysis_block.c
Update test_intervaltree.c
Update test_unum.c
Describe the list of arguments each command expects, so we can
automatically construct the argument strings in the help messages.
These info can also be used to check the user is passing the right
number of arguments to commands, auto completion, etc.
When the summary cannot be placed on a single line of the screen and the
user is in interactive mode, this PR ensures the summary of the command
wraps in the best possible way, without ruining the alignment.
- Rename DEFINE_CMD_ARGV_GROUP_WITH_CHILD with .._GROUP_EXEC ##newshell
- Make sure ARGV RzCmdDesc do not have children ##newshell
Also enable WARNING level logs by default, so that warnings generated
during rizin initialization, and before RzConfig is initialized, can be
logged.
Let's not use that structure just for examples of commands, we can make
it more generic and use it for other detailed section as well (e.g.
`pf??`, `ae??`, etc.)
* No more FS plugins in rizin
* Fix retrieval of cmddesc with GROUP involved ##newshell
* Add w6d/w6e argv-style handlers ##newshell
* Add OLDINPUT_SPECIAL for special characters ##newshell
* Convert % to a argv command ##newshell
* Hide `=` from command handlers that use eq_sep_args ##newshell
Command handlers like `env`, `%` or `*` expect arguments with an equal
as a separator. So far `=` was visible as an arg_identifier to make sure
that existing handlers could still work. This is not required anymore,
as all commands that use eq_sep_args are now converted to a argv-style
handler.
* Convert * command to argv-style ##newshell
* Convert R_CMD_DESC_TYPE_GROUP to INNER
* Avoid confusing "group_" prefixes by splitting cmddesc ##newshell
Create "group" command descriptor and give them their own help, to avoid
dupping fields such as group_summary, group_args_str, etc. By having a
separate help structure for the grouping node we make the cmd_api code
easier because it doesn't need to distinguish between
group_summary/summary, group_args_str/args_str, etc. and we avoid few
bytes for each command descriptor help structure, since most of them
did not use group_* fields.
* Other simplification in cmd_api due to split GROUP/exec cb.
* Handle R_CMD_DESC_TYPE_GROUP in r_cmd_call_parsed_args
* Add GROUP RCmdDesc type and fix where the args_str is shown
* Adjust color of `[?]`
* Differentiate between cmd<?> and cmd[?]
<?> when cmd is not valid by itself
[?] when cmd is valid but there are also other sub-commands available
* Fix usage for commands like `w` that are both commands and groups
* Do not automatically switch to detail=2 for leaf commands
* Fix test due to change in `?`/`??` behaviour
* Add RCmdDesc and use it for newshell to call command handlers
* Keep supporting existing RCorePlugin commands
* Properly free RCmdDesc tree
* Remove help from API because not used
* Check for cp->call before using it
* Set res to 0 because otherwise it could exit too early
* Remove r_cmd_call_long API because never used
* Remove r_cmd_add_long because never used
* Remove r_cmd_args and fix some spaces
* Add RCmdParsedArgs and unit tests
* Introduce r_cmd_call_parsed_args and use it in cmd.c
* Introduce RCmdParsedArgs in cmd.c