# SPDX-FileCopyrightText: 2021 RizinOrg <info@rizin.re>
# SPDX-License-Identifier: LGPL-3.0-only
---
name: cmd_system
commands:
  - name: "!"
    cname: system
    summary: Run command via system(3) with raw output. Grepping via '~' automatically forces use of '!!' instead.
    args:
      - name: command
        type: RZ_CMD_ARG_TYPE_STRING
        no_space: true
      - name: args
        type: RZ_CMD_ARG_TYPE_STRING
        flags: RZ_CMD_ARG_FLAG_ARRAY
        optional: true
    details:
      - name: Examples
        entries:
          - text: "!"
            arg_str: "ls"
            comment: "Execute the 'ls' command via system(3)"
          - text: "!"
            arg_str: bash -c "echo $RZ_SIZE"
            comment:
              Execute the 'echo' command via system(3) and bash. It prints the content of the environment variable
              '$RZ_SIZE'.
  - name: "!!"
    cname: system_to_cons
    summary: Run command via system(3) and pipe its stdout to rizin
    args:
      - name: command
        type: RZ_CMD_ARG_TYPE_STRING
        no_space: true
      - name: args
        type: RZ_CMD_ARG_TYPE_STRING
        flags: RZ_CMD_ARG_FLAG_ARRAY
        optional: true
    details:
      - name: Examples
        entries:
          - text: "!!"
            arg_str: "ls~txt"
            comment:
              Execute the 'ls' command via system(3) and grep for 'txt'. Note that 'ls' has different output if its
              stdout is piped.
