shithub: orca

Download patch

ref: b739e547c36e2b6d7aa5e5e3d133199cbc5b08b1
parent: 88b49d29bc4732d508a7f1e39804531f41f2affc
author: cancel <cancel@cancel.fm>
date: Tue Dec 4 11:36:59 EST 2018

Rename `orca` target to `cli`, rename `tui` target to `orca`

--- a/README.md
+++ b/README.md
@@ -34,18 +34,18 @@
 
 ### 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
 
-### 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,10 +67,24 @@
 - `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
 
--- 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>   Number of timesteps to simulate.\n"
       "                  Must be 0 or a positive integer.\n"
--- a/tool
+++ b/tool
@@ -8,7 +8,7 @@
     build <config> <target>
         Compile orca.
         Configs: debug, release
-        Targets: orca, tui
+        Targets: orca, cli
         Output: build/<config>/<target>
     clean
         Removes build/
@@ -221,14 +221,14 @@
 
   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.
--- 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 <number> Set cosmetic margins.\n"
       "                       Default: 2\n"