# SPDX-FileCopyrightText: 2021 RizinOrg <info@rizin.re>
# SPDX-License-Identifier: LGPL-3.0-only
---
name: cmd_remote
commands:
  - name: "R"
    cname: remote
    summary: List all open connections / Exec <cmd> at remote <fd>
    args_str: " [[<fd>] <cmd>]"
    args:
      - name: fd
        type: RZ_CMD_ARG_TYPE_NUM
        optional: true
      - name: cmd
        type: RZ_CMD_ARG_TYPE_CMD
  - name: R<
    cname: remote_send
    summary: Send output of local <cmd> to remote <fd>
    args:
      - name: fd
        type: RZ_CMD_ARG_TYPE_NUM
        optional: true
      - name: cmd
        type: RZ_CMD_ARG_TYPE_CMD
  - name: R!
    cname: remote_io_system_run_cmd
    summary: Run command via rz_io_system
    args:
      - name: cmd
        type: RZ_CMD_ARG_TYPE_CMD
    options: ""
  - name: R+
    cname: remote_add
    summary: Connect to remote host:port
    args:
      - name: "[proto://]host:port"
        type: RZ_CMD_ARG_TYPE_STRING
  - name: R-
    cname: remote_del
    summary: remove all hosts or host 'fd'
    args:
      - name: fd
        type: RZ_CMD_ARG_TYPE_NUM
        optional: true
  - name: R=
    cname: remote_open
    summary: Open remote session with host 'fd', 'q' to quit
    args:
      - name: fd
        type: RZ_CMD_ARG_TYPE_NUM
  - name: R!=
    cname: remote_mode_enable
    summary: Enable remote cmd mode, sending commands to remote <fd> server
    args:
      - name: fd
        type: RZ_CMD_ARG_TYPE_NUM
        default_value: "0"
  - name: "R=!"
    cname: remote_mode_disable
    summary: Disable remote cmd mode
    args: []
  - name: Rg
    summary: Start the gdbserver
    subcommands:
    - name: Rg
      cname: remote_gdb
      summary: Start the gdbserver.
      args:
        - name: port
          type: RZ_CMD_ARG_TYPE_NUM
        - name: file
          type: RZ_CMD_ARG_TYPE_STRING
        - name: args
          type: RZ_CMD_ARG_TYPE_STRING
          optional: true
    - name: Rg!
      cname: remote_gdb_debug
      summary: Start the gdbserver with debug protocol messages (like gdbserver --remote-debug).
      args:
        - name: port
          type: RZ_CMD_ARG_TYPE_NUM
        - name: file
          type: RZ_CMD_ARG_TYPE_STRING
        - name: args
          type: RZ_CMD_ARG_TYPE_STRING
          optional: true
  - name: Rh
    summary: HTTP webserver commands.
    subcommands:
    - name: Rh
      summary: Start the HTTP webserver in foreground.
      cname: remote_webserver_start_fg
      args:
        - name: "launch_browser"
          type: RZ_CMD_ARG_TYPE_CHOICES
          default_value: "no"
          choices:
            - "yes"
            - "no"
    - name: Rh*
      summary: Restart the HTTP webserver in foreground.
      cname: remote_webserver_restart_fg
      args: []
    - name: Rh--
      summary: Stop the HTTP webserver in foreground.
      cname: remote_webserver_stop_fg
      args: []
  - name: Rt
    cname: remote_tcp
    summary: Start the tcp server
    args:
      - name: "[host:]port"
        type: RZ_CMD_ARG_TYPE_STRING
      - name: cmd
        type: RZ_CMD_ARG_TYPE_CMD
        optional: true
