diff --git a/README.md b/README.md index 3ceded2..e3254a1 100644 --- a/README.md +++ b/README.md @@ -34,17 +34,17 @@ make clean # removes build/ ### Build Script -Run `./tool --help` to see usage info. +Run `./tool --help` to see usage info. Examples: ```sh -./tool build debug tui - # debug build of the terminal ui - # binary placed at build/debug/tui - -./tool -c clang-7 build release tui +./tool -c clang-7 build release orca # build the terminal ui with a compiler named # clang-7, with optimizations enabled. - # binary placed at build/release/tui + # binary placed at build/release/orca + +./tool build debug cli + # debug build of the headless CLI interpreter + # binary placed at build/debug/cli ./tool clean # same as make clean, removes build/ @@ -52,26 +52,13 @@ Run `./tool --help` to see usage info. ## Run -### CLI interpreter - -The CLI (`orca` binary) reads from a file and runs the orca simulation for 1 timestep (default) or a specified number (`-t` option) and writes the resulting state of the grid to stdout. - -```sh -orca [-t timesteps] infile -``` - -You can also make orca read from stdin: -```sh -echo -e "...\na34\n..." | orca /dev/stdin -``` - ### Interactive terminal UI ```sh -tui [options] [file] +orca [options] [file] ``` -Run the interactive terminal UI, useful for debugging or observing behavior. +Run the interactive terminal UI, useful for debugging or observing behavior. Pass `-h` or `--help` to see command-line argument usage. #### Controls @@ -80,11 +67,25 @@ Run the interactive terminal UI, useful for debugging or observing behavior. - `A`-`Z`, `a`-`z`, `0`-`9`, and other printable characters: write character to grid at cursor - Spacebar: step the simulation one tick - `ctrl+u`: undo +- `/`: change into or out of key-trigger mode (for the `!` operator) - `[` and `]`: Adjust cosmetic grid rulers horizontally - `{` and `}`: Adjust cosmetic grid rulers vertically - `(` and `)`: resize grid horizontally - `_` and `+`: resize grid vertically +### CLI interpreter + +The CLI (`cli` binary) reads from a file and runs the orca simulation for 1 timestep (default) or a specified number (`-t` option) and writes the resulting state of the grid to stdout. + +```sh +cli [-t timesteps] infile +``` + +You can also make `cli` read from stdin: +```sh +echo -e "...\na34\n..." | cli /dev/stdin +``` + ## Extras - Support this project through [Patreon](https://patreon.com/100). diff --git a/cli_main.c b/cli_main.c index 116e151..92db5ff 100644 --- a/cli_main.c +++ b/cli_main.c @@ -8,7 +8,7 @@ static void usage() { // clang-format off fprintf(stderr, - "Usage: orca [options] infile\n\n" + "Usage: cli [options] infile\n\n" "Options:\n" " -t Number of timesteps to simulate.\n" " Must be 0 or a positive integer.\n" diff --git a/tool b/tool index b997cd9..2cb0b5b 100755 --- a/tool +++ b/tool @@ -8,7 +8,7 @@ Commands: build Compile orca. Configs: debug, release - Targets: orca, tui + Targets: orca, cli Output: build// clean Removes build/ @@ -221,14 +221,14 @@ build_target() { add source_files gbuffer.c field.c mark.c bank.c sim.c case "$2" in - orca|cli) + cli) add source_files cli_main.c - out_exe=orca + out_exe=cli ;; - tui) + orca|tui) add source_files tui_main.c add cc_flags -D_XOPEN_SOURCE_EXTENDED=1 - out_exe=tui + out_exe=orca if [[ $os = mac ]]; then # prefer homebrew version of ncurses if installed. Will give us better # terminfo, so we can use A_DIM in Terminal.app, etc. diff --git a/tui_main.c b/tui_main.c index e82b5cf..7ff08db 100644 --- a/tui_main.c +++ b/tui_main.c @@ -13,7 +13,7 @@ static void usage() { // clang-format off fprintf(stderr, - "Usage: tui [options] [file]\n\n" + "Usage: orca [options] [file]\n\n" "Options:\n" " --margins Set cosmetic margins.\n" " Default: 2\n"