# SPDX-FileCopyrightText: 2021 RizinOrg <info@rizin.re>
# SPDX-License-Identifier: LGPL-3.0-only
---
name: cmd_eval
commands:
  - name: e
    cname: eval_getset
    summary: Get/Set value of config variable <key>
    args_str: " <key>[=<val|?>] [<key>[=<val|?>] ...]]"
    args:
      - name: key=value
        type: RZ_CMD_ARG_TYPE_EVAL_FULL
        flags: RZ_CMD_ARG_FLAG_ARRAY
    details:
      - name: Examples
        entries:
          - text: e
            arg_str: " asm.bytes"
            comment: "Show current value of config variable `asm.bytes`"
          - text: e
            arg_str: " asm.bytes=true"
            comment: "Set config variable `asm.bytes` to `true`"
          - text: e
            arg_str: " search.in=?"
            comment: "Show all possible values for config variable `search.in` together with description"
          - text: e
            arg_str: " asm.bytes=true asm.offset=false"
            comment: "Set asm.bytes to true and asm.offset to false"
  - name: el
    cname: eval_list
    type: RZ_CMD_DESC_TYPE_ARGV_STATE
    summary: List config variables with their descriptions
    modes:
      - RZ_OUTPUT_MODE_STANDARD
      - RZ_OUTPUT_MODE_JSON
      - RZ_OUTPUT_MODE_QUIET
      - RZ_OUTPUT_MODE_LONG
      - RZ_OUTPUT_MODE_LONG_JSON
    args:
      - name: key
        type: RZ_CMD_ARG_TYPE_EVAL_KEY
        optional: true
  - name: e-
    cname: eval_reset
    summary: Reset config variables
    args: []
  - name: e!
    cname: eval_bool_invert
    summary: Invert the boolean value of config variable <key>
    args:
      - name: key
        type: RZ_CMD_ARG_TYPE_EVAL_KEY
  - name: ec
    summary: Set color for given key (prompt, offset, ...)
    subcommands:
      - name: ec
        summary: List eval colors and keys
        cname: cmd_eval_color_list
        type: RZ_CMD_DESC_TYPE_ARGV_STATE
        modes:
          - RZ_OUTPUT_MODE_STANDARD
          - RZ_OUTPUT_MODE_JSON
        args:
          - name: key
            type: RZ_CMD_ARG_TYPE_STRING
            optional: true
          - name: color
            type: RZ_CMD_ARG_TYPE_STRING
            optional: true
      - name: ecl
        summary: List colors with descriptions
        cname: cmd_eval_color_list_help
        args: []
        details:
          - name: "Color Palette Keys"
            entries:
              - text: "comment"
                comment: "Color for code comments"
              - text: "usrcmt"
                comment: "Color for user comments"
              - text: "args"
                comment: "Color for function arguments"
              - text: "fname"
                comment: "Color for function names"
              - text: "floc"
                comment: "Color for function locations"
              - text: "fline"
                comment: "Color for function lines"
              - text: "flag"
                comment: "Color for flags"
              - text: "label"
                comment: "Color for labels"
              - text: "help"
                comment: "Color for help messages"
              - text: "flow"
                comment: "Color for control flow"
              - text: "flow2"
                comment: "Color for control flow (alternative)"
              - text: "prompt"
                comment: "Color for prompt"
              - text: "offset"
                comment: "Color for offsets"
              - text: "input"
                comment: "Color for user input"
              - text: "invalid"
                comment: "Color for invalid instructions"
              - text: "other"
                comment: "Color for other elements"
              - text: "b0x00"
                comment: "Color for null bytes (0x00)"
              - text: "b0x7f"
                comment: "Color for 0x7f bytes"
              - text: "b0xff"
                comment: "Color for 0xff bytes"
              - text: "math"
                comment: "Color for math operations"
              - text: "bin"
                comment: "Color for binary information"
              - text: "btext"
                comment: "Color for text in binary"
              - text: "push"
                comment: "Color for push instructions"
              - text: "pop"
                comment: "Color for pop instructions"
              - text: "crypto"
                comment: "Color for crypto instructions"
              - text: "jmp"
                comment: "Color for jump instructions"
              - text: "cjmp"
                comment: "Color for conditional jumps"
              - text: "call"
                comment: "Color for call instructions"
              - text: "nop"
                comment: "Color for nop instructions"
              - text: "ret"
                comment: "Color for return instructions"
              - text: "trap"
                comment: "Color for trap/interrupt instructions"
              - text: "ucall"
                comment: "Color for unknown calls"
              - text: "ujmp"
                comment: "Color for unknown jumps"
              - text: "swi"
                comment: "Color for software interrupts"
              - text: "cmp"
                comment: "Color for compare instructions"
              - text: "reg"
                comment: "Color for registers"
              - text: "creg"
                comment: "Color for changed registers"
              - text: "num"
                comment: "Color for numbers"
              - text: "mov"
                comment: "Color for move instructions"
              - text: "func_var"
                comment: "Color for function variables"
              - text: "func_var_type"
                comment: "Color for function variable types"
              - text: "func_var_addr"
                comment: "Color for function variable addresses"
              - text: "widget_bg"
                comment: "Color for widget background"
              - text: "widget_sel"
                comment: "Color for selected widget"
              - text: "meta"
                comment: "Color for metadata"
              - text: "ai.read"
                comment: "Color for memory read access"
              - text: "ai.write"
                comment: "Color for memory write access"
              - text: "ai.exec"
                comment: "Color for executable memory"
              - text: "ai.seq"
                comment: "Color for sequential memory"
              - text: "ai.ascii"
                comment: "Color for ASCII in memory"
              - text: "graph.box"
                comment: "Color for graph box"
              - text: "graph.box2"
                comment: "Color for graph box (alternative 2)"
              - text: "graph.box3"
                comment: "Color for graph box (alternative 3)"
              - text: "graph.box4"
                comment: "Color for graph box (alternative 4)"
              - text: "graph.true"
                comment: "Color for true branch in graph"
              - text: "graph.false"
                comment: "Color for false branch in graph"
              - text: "graph.ujump"
                comment: "Color for unknown jump in graph"
              - text: "graph.current"
                comment: "Color for current node in graph"
              - text: "graph.traced"
                comment: "Color for traced node in graph"
              - text: "diff.unknown"
                comment: "Color for unknown diff"
              - text: "diff.new"
                comment: "Color for new diff"
              - text: "diff.match"
                comment: "Color for matched diff"
              - text: "diff.unmatch"
                comment: "Color for unmatched diff"
              - text: "gui.cflow"
                comment: "Color for GUI control flow"
              - text: "gui.dataoffset"
                comment: "Color for GUI data offset"
              - text: "gui.background"
                comment: "Color for GUI background"
              - text: "gui.alt_background"
                comment: "Color for GUI alternate background"
              - text: "gui.border"
                comment: "Color for GUI border"
              - text: "wordhl"
                comment: "Color for highlighted word"
              - text: "linehl"
                comment: "Color for highlighted line"
      - name: ecc
        summary: Show palette in CSS
        cname: cmd_eval_color_display_palette_css
        args:
          - name: prefix
            type: RZ_CMD_ARG_TYPE_STRING
            optional: true
      - name: ecd
        summary: Set default palette
        cname: cmd_eval_color_set_default_palette
        args: []
      - name: ecH
        summary: Highlight word or an instruction
        subcommands:
          - name: ecH
            summary: List all the highlight rules
            cname: cmd_eval_color_highlight_list
            args: []
            modes:
              - RZ_OUTPUT_MODE_JSON
          - name: ecHi
            summary: Highlight current instruction with the given color as background
            cname: cmd_eval_color_highlight_current_instruction
            args:
              - name: color
                type: RZ_CMD_ARG_TYPE_STRING
          - name: ecHw
            summary: Highlight the word with the given color as background
            cname: cmd_eval_color_highlight_instruction_word
            args:
              - name: word
                type: RZ_CMD_ARG_TYPE_STRING
              - name: color
                type: RZ_CMD_ARG_TYPE_STRING
                optional: true
          - name: ecH.
            summary: Show highlight rule in current offset
            cname: cmd_eval_color_highlight_list_current
            args: []
          - name: ecH-*
            summary: Remove all highlights and hints
            cname: cmd_eval_color_highlight_remove_all
            args: []
          - name: ecH-
            summary: Remove all highlights on current instruction
            cname: cmd_eval_color_highlight_remove_current
            args: []
      - name: ecr
        summary: Set random palette
        cname: cmd_eval_color_set_random_palette
        args: []
      - name: ecs
        summary: Set a colorful palette
        cname: cmd_eval_color_set_colorful_palette
        args: []
      - name: eco
        summary: Load the provided theme or list the available themes
        subcommands:
          - name: eco
            summary: List the available themes
            cname: cmd_eval_color_load_theme
            type: RZ_CMD_DESC_TYPE_ARGV_STATE
            args:
              - name: theme
                type: RZ_CMD_ARG_TYPE_CHOICES
                choices_cb: rz_core_autocomplete_rotate_theme
                optional: true
            modes:
              - RZ_OUTPUT_MODE_JSON
              - RZ_OUTPUT_MODE_QUIET
          - name: eco.
            summary: Display current theme name
            cname: cmd_eval_color_list_current_theme
            args: []
          - name: ecoo
            summary: Reload current theme
            cname: cmd_eval_color_list_reload_current
            args: []
      - name: ecp
        summary: Load previuos color theme
        cname: cmd_eval_color_load_previous_theme
        args: []
      - name: ecn
        summary: Load next color theme
        cname: cmd_eval_color_load_next_theme
        args: []
  - name: ee
    cname: eval_editor
    summary: Open editor to change the value of config variable <key>
    args:
      - name: key
        type: RZ_CMD_ARG_TYPE_EVAL_KEY
  - name: er
    cname: eval_readonly
    summary: Set config variable <key> as read-only
    args:
      - name: key
        type: RZ_CMD_ARG_TYPE_EVAL_KEY
  - name: es
    cname: eval_spaces
    summary: List all config variable spaces or sub-keys/sub-spaces if a <key> is provided
    args:
      - name: key
        type: RZ_CMD_ARG_TYPE_EVAL_KEY
        optional: true
  - name: et
    cname: eval_type
    summary: Show type of given config variable <key>
    args:
      - name: key
        type: RZ_CMD_ARG_TYPE_EVAL_KEY
