From 07ce77bc972fc8794875cff2993a95fbab7397ae Mon Sep 17 00:00:00 2001 From: Samuel Kyletoft Date: Sun, 18 Apr 2021 14:10:35 +0200 Subject: [PATCH] --help --- cflisp-cli/src/help.txt | 16 ++++++++++++++++ cflisp-cli/src/main.rs | 10 ++++++++++ 2 files changed, 26 insertions(+) create mode 100644 cflisp-cli/src/help.txt diff --git a/cflisp-cli/src/help.txt b/cflisp-cli/src/help.txt new file mode 100644 index 0000000..907d1c5 --- /dev/null +++ b/cflisp-cli/src/help.txt @@ -0,0 +1,16 @@ +Usage cflisp [options] file... +Options: + +--help Print this page + +-x Prints numbers as hex instead +-c Disables comments (variable names mostly) +-p Prints the parsed tree structure of the program +-P Prints the parsed tree after structs have been simplified down to native types and after -O2 IR optimisations have been performed +-t Disables type checking +-s Prints the compiled code to stdout instead of a file +-a Calls qaflisp directly. Requires qaflisp to be on $PATH. Probably doesn't work on Windows +-o Sets the name of the output file (following argument) +-g Adds debug info. Disables removal of unused names and adds `ORG $20` to the top for easier digiflisp debugging +-O (/O1/O2) Enables optimisations. (If a level is specified it needs to be its own flag) +-k Disables interrupts after main has exited \ No newline at end of file diff --git a/cflisp-cli/src/main.rs b/cflisp-cli/src/main.rs index 9002ed5..67fa314 100644 --- a/cflisp-cli/src/main.rs +++ b/cflisp-cli/src/main.rs @@ -21,6 +21,16 @@ const QAFLISP: &str = "\\qaflisp.exe"; //Yes, this is a horrible mess fn main() { let args = env::args().skip(1).collect::>(); + + if args + .iter() + .map(String::as_str) + .any(|s| s == "--help" || s == "-help") + { + println!(include_str!("help.txt")); + process::exit(0); + } + let flags = args.iter().collect::(); let files = args .iter()