ed

[hare] The standard editor
Log | Files | Refs | README | LICENSE

commit af82d6b3db88a3af3281be29992904dd92d3d313
parent d2b6e43d61fc8fb96290ab84f4cb7505e703b041
Author: Byron Torres <b@torresjrjr.com>
Date:   Fri,  5 Jan 2024 23:38:57 +0000

make help list global

Diffstat:
Mmain.ha | 17+++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/main.ha b/main.ha @@ -29,13 +29,14 @@ type InputMode = enum { type Error = !(...InteractionError | ParseError | CmdError); +def help: [_]getopt::help = [ + "standard line editor", + ('p', "prompt", "set the command prompt"), + ('s', "suppress byte counts and '!' prompt"), + "[file]", +]; + export fn main() void = { - const help: [_]getopt::help = [ - "standard line editor", - ('p', "prompt", "set the command prompt"), - ('s', "suppress byte counts and '!' prompt"), - "[file]", - ]; const main_cmd = getopt::parse(os::args, help...); defer getopt::finish(&main_cmd); @@ -71,7 +72,7 @@ export fn main() void = { }; if (len(main_cmd.args) > 1) { - exit_usage(help); + exit_usage(); }; if (len(main_cmd.args) == 1) { @@ -142,7 +143,7 @@ export fn main() void = { // dumpbuffer(&s.buf); }; -fn exit_usage(help: []getopt::help) never = { +fn exit_usage() never = { getopt::printusage(os::stderr, os::args[0], help)!; os::exit(1); };