add -h flag and document flags

This commit is contained in:
NunoSempere 2024-10-01 09:56:31 +02:00
parent 3924027c31
commit 98225e4bb9
2 changed files with 17 additions and 2 deletions

BIN
fermi Executable file

Binary file not shown.

View File

@ -65,7 +65,8 @@ func (fs FilledSamples) Samples() []float64 {
}
/* Constants */
const HELP_MSG = " Operation | Variable assignment | Special\n" +
const HELP_MSG = "1. Grammar:\n" +
" Operation | Variable assignment | Special\n" +
" Operation: operator operand\n" +
" operator: (empty) | * | / | + | -\n" +
" operand: scalar | lognormal | beta | variable\n" +
@ -75,6 +76,7 @@ const HELP_MSG = " Operation | Variable assignment | Special\n" +
" Variable assignment and clear stack: =. variable_name\n" +
" Special commands: \n" +
" Comment: # this is a comment\n" +
" Summary stats: stats\n" +
" Clear stack: clear | c | .\n" +
" Print debug info: debug | d\n" +
" Print help message: help | h\n" +
@ -98,7 +100,16 @@ const HELP_MSG = " Operation | Variable assignment | Special\n" +
" 1 10\n" +
" + beta 1 100\n" +
" )\n" +
" exit\n"
" exit\n" +
"\n" +
"2. Command flags:\n" +
" -echo\n" +
" Specifies whether inputs should be echoed back. Useful if reading from a file\n." +
" -f string\n" +
" Specifies a file with a model to run\n" +
" -n int\n" +
" Specifies the number of samples to draw when using samples (default 100000)\n" +
" -h Shows help message\n"
const NORMAL90CONFIDENCE = 1.6448536269514727
const INIT_DIST Scalar = Scalar(1)
@ -450,8 +461,12 @@ func main() {
num_samples_flag := flag.Int("n", N_SAMPLES, "Specifies the number of samples to draw when using samples")
filename := flag.String("f", "", "Specifies a file with a model to run")
echo_flag := flag.Bool("echo", false, "Specifies whether inputs should be echoed back. Useful if reading from a file.")
help_flag := flag.Bool("h", false, "Shows help message")
flag.Parse()
N_SAMPLES = *num_samples_flag
if *help_flag {
fmt.Println(HELP_MSG)
}
var reader *bufio.Reader = nil
if *filename != "" {