feat: statistics flag, commented some more

This commit is contained in:
2025-12-29 20:00:29 -05:00
parent 3f9f3a603f
commit 351faa7e08
8 changed files with 64 additions and 49 deletions

View File

@@ -7,13 +7,14 @@ import (
// Extract the program configuration from the command-line arguments.
func FromArgs() (*Config, error) {
// Parse flags.
// Relevant flags.
verbose := flag.Bool("v", false, "Verbosity. If set, the program will print logs.")
explanation := flag.Bool("x", false, "Explanation. Whether or not to show all reduction steps.")
statistics := flag.Bool("s", false, "Statistics. If set, the process will print various statistics about the run.")
profile := flag.String("p", "", "CPU profiling. If set, the program will run a performance profile during execution.")
flag.Parse()
// Parse non-flag arguments.
// There must only be one input argument.
if flag.NArg() == 0 {
return nil, fmt.Errorf("no input given")
} else if flag.NArg() > 1 {
@@ -25,7 +26,7 @@ func FromArgs() (*Config, error) {
if flag.Arg(0) == "-" {
source = StdinSource{}
} else {
source = StringSource{data: flag.Arg(0)}
source = StringSource{Data: flag.Arg(0)}
}
return &Config{
@@ -33,5 +34,6 @@ func FromArgs() (*Config, error) {
Verbose: *verbose,
Explanation: *explanation,
Profile: *profile,
Statistics: *statistics,
}, nil
}