From 0ea49d3534d1dbb6110514e8b48ffe7942dad6c7 Mon Sep 17 00:00:00 2001 From: Joseph Montanaro Date: Fri, 22 Oct 2021 12:35:09 -0700 Subject: [PATCH] pull help message from readme --- ui.nim | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/ui.nim b/ui.nim index 8bdc688..2a004b3 100644 --- a/ui.nim +++ b/ui.nim @@ -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] # =============================