From 7869c7447a181316abbdd0e4ff9c4331d56a1984 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 22 Nov 2025 21:47:54 -0500 Subject: Fix command line aliases --- CHANGES.md | 1 + src/compile/cli.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 22a1249b..396e4a84 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -55,6 +55,7 @@ `foo.baz.method()` when `foo` is a `&Foo` and `baz.method()` takes a `&Baz`. - Optional paths no longer fail to compile when you check them for `none`. - Text replacement no longer infinitely loops when given an empty text to replace. + - Short CLI flag aliases now no longer use the first letter of the argument. ## v0.3 diff --git a/src/compile/cli.c b/src/compile/cli.c index e3d2329f..e5756521 100644 --- a/src/compile/cli.c +++ b/src/compile/cli.c @@ -144,7 +144,7 @@ Text_t compile_cli_arg_call(env_t *env, Text_t fn_name, type_t *fn_type, const c code = Texts(code, "{", quoted_text(Text$replace(Text$from_str(arg->name), Text("_"), Text("-"))), ", &", Texts("_$", Text$from_str(arg->name)), ", ", compile_type_info(arg->type), arg->default_val ? Text("") : Text(", .required=true"), - arg->alias ? Texts(", .short_flag=", quoted_text(Text$from_str(arg->name)), + arg->alias ? Texts(", .short_flag=", quoted_text(Text$from_str(arg->alias)), "[0]") // TODO: escape char properly : Text(""), -- cgit v1.2.3