Browse Source

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

master
cancel 6 years ago
parent
commit
b739e547c3
  1. 45
      README.md
  2. 2
      cli_main.c
  3. 10
      tool
  4. 2
      tui_main.c

45
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).

2
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"

10
tool

@ -8,7 +8,7 @@ Commands:
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 @@ 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.

2
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"

Loading…
Cancel
Save