Rizin
unix-like reverse engineering framework and cli tools
rz_cmd_desc_arg_t Struct Reference

#include <rz_cmd.h>

Public Attributes

const char * name
 
bool optional
 
bool no_space
 
RzCmdArgType type
 
int flags
 
const char * default_value
 
union {
   const char **   choices
 
   RzCmdArgChoiceCb   choices_cb
 
}; 
 

Detailed Description

A description of an argument of a RzCmdDesc.

Definition at line 219 of file rz_cmd.h.

Member Data Documentation

◆ 

union { ... }

Additional data which is type specific.

◆ choices

const char** rz_cmd_desc_arg_t::choices

List of possible values in case type is RZ_CMD_ARG_TYPE_CHOICES.

Definition at line 270 of file rz_cmd.h.

Referenced by cmd_descs_generate.Arg::get_cstructure().

◆ choices_cb

RzCmdArgChoiceCb rz_cmd_desc_arg_t::choices_cb

Callback used to generate a list of possible values in case type is RZ_CMD_ARG_TYPE_CHOICES. When this is specified, choices is ignored.

Definition at line 275 of file rz_cmd.h.

Referenced by cmd_descs_generate.Arg::_get_union(), cmd_descs_generate.Arg::decl(), and cmd_descs_generate.Arg::get_cstructure().

◆ default_value

const char* rz_cmd_desc_arg_t::default_value

Default value for the argument, if it is not specified. This field shall be used only when optional is true.

Definition at line 262 of file rz_cmd.h.

Referenced by cmd_descs_generate.Arg::__str__().

◆ flags

int rz_cmd_desc_arg_t::flags

Flag of the argument, used to modify the behaviour of this argument. See RZ_CMD_ARG_FLAG_ values.

Definition at line 257 of file rz_cmd.h.

Referenced by cmd_descs_generate.Arg::__str__().

◆ name

◆ no_space

bool rz_cmd_desc_arg_t::no_space

True if no space should be displayed before this argument in the help. By default it is false and a space is displayed before this argument.

Definition at line 249 of file rz_cmd.h.

Referenced by cmd_descs_generate.Arg::__str__().

◆ optional

bool rz_cmd_desc_arg_t::optional

True if the argument is optional. If argument X is optional, then all arguments after X can only be specified if X was provided as well and they don't need to be set as optional.

Example: CMDNAME <mandatory-arg0> [<optional-arg1> <optional-arg2> [<optional-arg3> [optional-arg4]]] <mandatory-arg0> has optional=false <optional-arg1> has optional=true <optional-arg2> has optional=false (it can be specified only if arg1 was specified as well, so it doesn't need to be optional) <optional-arg3> has optional=true <optional-arg4> has optional=true Given the above:

  • CMDNAME a0 is a valid command
  • CMDNAME a0 a1 a2 is a valid command
  • CMDNAME a0 a1 is not a valid command, because if a1 is specified, also a2 has to be
  • CMDNAME a0 a1 a2 a3 is a valid command
  • CMDNAME a0 a1 a2 a3 a4 is a valid command

Definition at line 244 of file rz_cmd.h.

Referenced by cmd_descs_generate.Arg::__str__().

◆ type


The documentation for this struct was generated from the following file: