pull help message from readme

This commit is contained in:
Joseph Montanaro 2021-10-22 12:35:09 -07:00
parent ad29f04660
commit 0ea49d3534

22
ui.nim
View File

@ -2,22 +2,12 @@ import os, math, strutils, strformat
import fixedseq, game, simulation
const help =
"""cup - Probability calculator for the board game CamelUp
Usage:
cup [-i] SPACE:STACK [...SPACE:STACK] [DICE]
SPACE refers to a numbered board space (1-16).
STACK refers to a stack of camel colors from bottom to top, e.g.
YBR (Yellow, Blue, Red, with Red on top).
DICE refers to the set of dice that have already been rolled,
e.g. GPR (Green, Purple, Red)
Options:
-i Interactive mode (currently unimplemented)
-h Show this message and exit
"""
const help = block:
# can't use regex, fortunately we are looking for a straightforward separator
let readme = slurp("./README.md")
let endPos = rfind(readme, "```") - 1
let startPos = rfind(readme, "```", last = endPos) + 4
readme[startPos..endPos]
# =============================