summaryrefslogtreecommitdiff
path: root/oryxc/src/main.rs
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2026-03-02 22:12:06 +0100
committerThomas Voss <mail@thomasvoss.com> 2026-03-02 22:12:06 +0100
commitb903ea3d09abf7aba9c415c37b205076b1bc1631 (patch)
treed88110f025409fadbb326eace3c43c7d56ed1f11 /oryxc/src/main.rs
parentc05f72244edb9f7cd7566f4457d2052ff02e6791 (diff)
Add different error styles
Diffstat (limited to 'oryxc/src/main.rs')
-rw-r--r--oryxc/src/main.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/oryxc/src/main.rs b/oryxc/src/main.rs
index 60733fb..d0ce286 100644
--- a/oryxc/src/main.rs
+++ b/oryxc/src/main.rs
@@ -37,6 +37,17 @@ impl Flags {
Short('h') | Long("help") => flags.help = true,
Short('l') | Long("debug-lexer") => flags.debug_lexer = true,
Short('p') | Long("debug-parser") => flags.debug_parser = true,
+ Short('s') | Long("error-style") => {
+ /* TODO: Check for error (user could pass the flag twice) */
+ /* TODO: Don’t unwrap */
+ errors::ERROR_STYLE.set(
+ match parser.value()?.to_str().unwrap() {
+ "oneline" => errors::ErrorStyle::OneLine,
+ "standard" => errors::ErrorStyle::Standard,
+ _ => Err("invalid value for -s/--error-style")?,
+ },
+ );
+ },
Short('t') | Long("threads") => {
flags.threads = parser.value()?.parse()?;
if flags.threads == 0 {
@@ -64,7 +75,10 @@ impl Flags {
fn usage() {
eprintln!(
- concat!("Usage: {0} [-lp] [-t threads]\n", " {0} -h"),
+ concat!(
+ "Usage: {0} [-lp] [-s oneline|standard] [-t threads]\n",
+ " {0} -h",
+ ),
errors::progname().display()
);
}