Skip to content

Commit

Permalink
feat(repl): rework repl a little bit and add some new command line op…
Browse files Browse the repository at this point in the history
…tions

see documentation
  • Loading branch information
d-biehl committed Nov 19, 2024
1 parent 5792ac7 commit 610b1f3
Show file tree
Hide file tree
Showing 6 changed files with 320 additions and 129 deletions.
139 changes: 89 additions & 50 deletions docs/03_reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,15 @@ Performs static code analysis to detect syntax errors, missing keywords or
variables, missing arguments, and more on the given *PATHS*. *PATHS* can be
files or directories. If no PATHS are given, the current directory is used.

Examples:
```
robotcode analyze code
robotcode analyze code --filter **/*.robot
robotcode analyze code tests/acceptance/first.robot
robotcode analyze code -mi DuplicateKeyword tests/acceptance/first.robot
robotcode --format json analyze code
```


**Usage:**
```text
Expand All @@ -285,7 +294,7 @@ robotcode analyze code [OPTIONS] [PATHS]...

- `-f, --filter PATTERN`

Glob pattern to filter files to analyze. Can be specified multiple times.
Glob pattern to filter files to analyze. Can be specified multiple times.


- `-v, --variable name:value`
Expand All @@ -303,6 +312,11 @@ robotcode analyze code [OPTIONS] [PATHS]...
Additional locations where to search test libraries and other extensions when they are imported. see `robot --pythonpath` option.


- `-mi, --modifiers-ignore CODE`

Specifies the diagnostics codes to ignore.


- `--help`

Show this message and exit.
Expand Down Expand Up @@ -610,17 +624,17 @@ robotcode debug [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...

- `--tcp [<ADDRESS>:]<PORT>`

Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port <port>`) *NOTE:* This option is mutually exclusive with options: pipe-server, mode, port, pipe-name.
Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port <port>`) *NOTE:* This option is mutually exclusive with options: port, pipe-server, mode, pipe-name.


- `--pipe-server NAME`

Run in `pipe-server` mode and listen at the given pipe name. (Equivalent to `--mode pipe-server --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: mode, port, tcp, bind, pipe-name.
Run in `pipe-server` mode and listen at the given pipe name. (Equivalent to `--mode pipe-server --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: bind, mode, port, tcp, pipe-name.


- `--mode [pipe-server|tcp]`
- `--mode [tcp|pipe-server]`

The mode to use for the debug launch server. *NOTE:* This option is mutually exclusive with options: pipe-server, tcp. [env var: ROBOTCODE_MODE; default: tcp]
The mode to use for the debug launch server. *NOTE:* This option is mutually exclusive with options: tcp, pipe-server. [env var: ROBOTCODE_MODE; default: tcp]


- `--port PORT`
Expand All @@ -635,7 +649,7 @@ robotcode debug [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...

- `--pipe-name NAME`

The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: pipe-server, port, tcp, bind. [env var: ROBOTCODE_PIPE_NAME]
The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: tcp, bind, pipe-server, port. [env var: ROBOTCODE_PIPE_NAME]


- `--version`
Expand All @@ -662,47 +676,47 @@ robotcode debug-launch [OPTIONS]
**Options:**
- `--stdio`

Run in `stdio` mode. (Equivalent to `--mode stdio`) *NOTE:* This option is mutually exclusive with options: mode, socket, port, tcp, bind, pipe, pipe-server, pipe-name. [env var: ROBOTCODE_STDIO]
Run in `stdio` mode. (Equivalent to `--mode stdio`) *NOTE:* This option is mutually exclusive with options: bind, socket, pipe, mode, port, tcp, pipe-server, pipe-name. [env var: ROBOTCODE_STDIO]


- `--tcp [<ADDRESS>:]<PORT>`

Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port <port>`) *NOTE:* This option is mutually exclusive with options: mode, socket, port, stdio, pipe, pipe-server, pipe-name.
Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port <port>`) *NOTE:* This option is mutually exclusive with options: socket, pipe, mode, port, stdio, pipe-server, pipe-name.


- `--socket [<ADDRESS>:]<PORT>`

Run in `socket` mode and connect to the given port. (Equivalent to `--mode socket --port <port>`) *NOTE:* This option is mutually exclusive with options: mode, port, tcp, stdio, pipe, pipe-server, pipe-name.
Run in `socket` mode and connect to the given port. (Equivalent to `--mode socket --port <port>`) *NOTE:* This option is mutually exclusive with options: pipe, mode, port, tcp, stdio, pipe-server, pipe-name.


- `--pipe NAME`

Run in `pipe` mode and connect to the given pipe name. (Equivalent to `--mode pipe --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: mode, socket, port, tcp, stdio, bind, pipe-server, pipe-name.
Run in `pipe` mode and connect to the given pipe name. (Equivalent to `--mode pipe --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: bind, socket, mode, port, tcp, stdio, pipe-server, pipe-name.


- `--pipe-server NAME`

Run in `pipe-server` mode and listen at the given pipe name. (Equivalent to `--mode pipe-server --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: mode, socket, port, tcp, stdio, bind, pipe, pipe-name.
Run in `pipe-server` mode and listen at the given pipe name. (Equivalent to `--mode pipe-server --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: bind, socket, pipe, mode, port, tcp, stdio, pipe-name.


- `--mode [stdio|tcp|socket|pipe|pipe-server]`

The mode to use for the debug launch server. *NOTE:* This option is mutually exclusive with options: socket, tcp, stdio, pipe, pipe-server. [env var: ROBOTCODE_MODE; default: stdio]
The mode to use for the debug launch server. *NOTE:* This option is mutually exclusive with options: socket, tcp, stdio, pipe-server, pipe. [env var: ROBOTCODE_MODE; default: stdio]


- `--port PORT`

The port to listen on or connect to. (Only valid for `tcp` and `socket mode`) *NOTE:* This option is mutually exclusive with options: pipe, pipe-server, pipe-name. [env var: ROBOTCODE_PORT; default: 6611; 1<=x<=65535]
The port to listen on or connect to. (Only valid for `tcp` and `socket mode`) *NOTE:* This option is mutually exclusive with options: pipe-server, pipe-name, pipe. [env var: ROBOTCODE_PORT; default: 6611; 1<=x<=65535]


- `--bind ADDRESS`

Specify alternate bind address. If no address is specified `localhost` is used. (Only valid for tcp and socket mode) *NOTE:* This option is mutually exclusive with options: pipe, pipe-server, pipe-name. [env var: ROBOTCODE_BIND; default: 127.0.0.1]
Specify alternate bind address. If no address is specified `localhost` is used. (Only valid for tcp and socket mode) *NOTE:* This option is mutually exclusive with options: pipe-server, pipe-name, pipe. [env var: ROBOTCODE_BIND; default: 127.0.0.1]


- `--pipe-name NAME`

The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: socket, port, tcp, stdio, bind, pipe, pipe-server. [env var: ROBOTCODE_PIPE_NAME]
The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: bind, socket, port, tcp, stdio, pipe-server, pipe. [env var: ROBOTCODE_PIPE_NAME]


- `--version`
Expand Down Expand Up @@ -812,14 +826,14 @@ robotcode discover all [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
Select tests/tasks or suites by longname.


- `--exclude-by-longname TEXT`
- `--version`

Excludes tests/tasks or suites by longname.
Show the version and exit.


- `--version`
- `--exclude-by-longname TEXT`

Show the version and exit.
Excludes tests/tasks or suites by longname.


- `--full-paths / --no-full-paths`
Expand Down Expand Up @@ -911,14 +925,14 @@ robotcode discover suites [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
Select tests/tasks or suites by longname.


- `--exclude-by-longname TEXT`
- `--version`

Excludes tests/tasks or suites by longname.
Show the version and exit.


- `--version`
- `--exclude-by-longname TEXT`

Show the version and exit.
Excludes tests/tasks or suites by longname.


- `--full-paths / --no-full-paths`
Expand Down Expand Up @@ -983,14 +997,14 @@ robotcode discover tags [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
Select tests/tasks or suites by longname.


- `--exclude-by-longname TEXT`
- `--version`

Excludes tests/tasks or suites by longname.
Show the version and exit.


- `--version`
- `--exclude-by-longname TEXT`

Show the version and exit.
Excludes tests/tasks or suites by longname.


- `--help`
Expand Down Expand Up @@ -1040,14 +1054,14 @@ robotcode discover tasks [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
Select tests/tasks or suites by longname.


- `--exclude-by-longname TEXT`
- `--version`

Excludes tests/tasks or suites by longname.
Show the version and exit.


- `--version`
- `--exclude-by-longname TEXT`

Show the version and exit.
Excludes tests/tasks or suites by longname.


- `--help`
Expand Down Expand Up @@ -1097,14 +1111,14 @@ robotcode discover tests [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
Select tests/tasks or suites by longname.


- `--exclude-by-longname TEXT`
- `--version`

Excludes tests/tasks or suites by longname.
Show the version and exit.


- `--version`
- `--exclude-by-longname TEXT`

Show the version and exit.
Excludes tests/tasks or suites by longname.


- `--help`
Expand Down Expand Up @@ -1132,42 +1146,42 @@ robotcode language-server [OPTIONS] [PATHS]...
**Options:**
- `--stdio`

Run in `stdio` mode. (Equivalent to `--mode stdio`) *NOTE:* This option is mutually exclusive with options: mode, socket, port, tcp, bind, pipe, pipe-name. [env var: ROBOTCODE_STDIO]
Run in `stdio` mode. (Equivalent to `--mode stdio`) *NOTE:* This option is mutually exclusive with options: bind, socket, pipe, mode, port, tcp, pipe-name. [env var: ROBOTCODE_STDIO]


- `--tcp [<ADDRESS>:]<PORT>`

Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port <port>`) *NOTE:* This option is mutually exclusive with options: mode, socket, port, stdio, pipe, pipe-name.
Run in `tcp` server mode and listen at the given port. (Equivalent to `--mode tcp --port <port>`) *NOTE:* This option is mutually exclusive with options: socket, pipe, mode, port, stdio, pipe-name.


- `--socket [<ADDRESS>:]<PORT>`

Run in `socket` mode and connect to the given port. (Equivalent to `--mode socket --port <port>`) *NOTE:* This option is mutually exclusive with options: mode, port, tcp, stdio, pipe, pipe-name.
Run in `socket` mode and connect to the given port. (Equivalent to `--mode socket --port <port>`) *NOTE:* This option is mutually exclusive with options: pipe, mode, port, tcp, stdio, pipe-name.


- `--pipe NAME`

Run in `pipe` mode and connect to the given pipe name. (Equivalent to `--mode pipe --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: mode, socket, port, tcp, stdio, bind, pipe-name.
Run in `pipe` mode and connect to the given pipe name. (Equivalent to `--mode pipe --pipe-name <name>`) *NOTE:* This option is mutually exclusive with options: bind, socket, mode, port, tcp, stdio, pipe-name.


- `--mode [pipe|socket|tcp|stdio]`
- `--mode [tcp|stdio|socket|pipe]`

The mode to use for the debug launch server. *NOTE:* This option is mutually exclusive with options: pipe, socket, tcp, stdio. [env var: ROBOTCODE_MODE; default: stdio]
The mode to use for the debug launch server. *NOTE:* This option is mutually exclusive with options: tcp, stdio, socket, pipe. [env var: ROBOTCODE_MODE; default: stdio]


- `--port PORT`

The port to listen on or connect to. (Only valid for `tcp` and `socket mode`) *NOTE:* This option is mutually exclusive with options: pipe, pipe-name. [env var: ROBOTCODE_PORT; default: 6610; 1<=x<=65535]
The port to listen on or connect to. (Only valid for `tcp` and `socket mode`) *NOTE:* This option is mutually exclusive with options: pipe-name, pipe. [env var: ROBOTCODE_PORT; default: 6610; 1<=x<=65535]


- `--bind ADDRESS`

Specify alternate bind address. If no address is specified `localhost` is used. (Only valid for tcp and socket mode) *NOTE:* This option is mutually exclusive with options: pipe, pipe-name. [env var: ROBOTCODE_BIND; default: 127.0.0.1]
Specify alternate bind address. If no address is specified `localhost` is used. (Only valid for tcp and socket mode) *NOTE:* This option is mutually exclusive with options: pipe-name, pipe. [env var: ROBOTCODE_BIND; default: 127.0.0.1]


- `--pipe-name NAME`

The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: socket, port, tcp, stdio, bind, pipe. [env var: ROBOTCODE_PIPE_NAME]
The pipe to listen on or connect to. (Only valid in `pipe` and `pipe-server` mode) *NOTE:* This option is mutually exclusive with options: bind, socket, port, tcp, stdio, pipe. [env var: ROBOTCODE_PIPE_NAME]


- `--version`
Expand Down Expand Up @@ -1363,16 +1377,41 @@ robotcode repl [OPTIONS] [FILES]...
Additional locations where to search test libraries and other extensions when they are imported. see `robot --pythonpath` option.


- `-d, --outputdir dir`
- `-k, --show-keywords`

Where to create output files. see `robot --outputdir` option.
Executed keywords will be shown in the output.


- `-i, --inspect`

Activate inspection mode. This forces a prompt to appear after the REPL script is executed.


- `-d, --outputdir DIR`

Where to create output files. see `robot --outputdir` option.


- `-o, --output FILE`

XML output file. see `robot --output` option.


- `-r, --report FILE`

HTML output file. see `robot --report` option.


- `-l, --log FILE`

HTML log file. see `robot --log` option.


- `-x, --xunit FILE`

xUnit output file. see `robot --xunit` option.


- `--help`

Show this message and exit.
Expand Down Expand Up @@ -1407,14 +1446,14 @@ robotcode robot [OPTIONS] [ROBOT_OPTIONS_AND_ARGS]...
Select tests/tasks or suites by longname.


- `--exclude-by-longname TEXT`
- `--version`

Excludes tests/tasks or suites by longname.
Show the version and exit.


- `--version`
- `--exclude-by-longname TEXT`

Show the version and exit.
Excludes tests/tasks or suites by longname.


- `--help`
Expand Down
4 changes: 0 additions & 4 deletions packages/repl/src/robotcode/repl/Repl/repl.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys
from typing import List

from ..__version__ import __version__

Expand All @@ -13,6 +12,3 @@ def repl(self) -> None:

def exit(self, exit_code: int = 0) -> None:
sys.exit(exit_code)

def keywords(self) -> List[str]:
return ["repl", "exit"]
Loading

0 comments on commit 610b1f3

Please sign in to comment.