From 835eb7e89627eea923bfd57bdacba7065c6b1d4c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 15 Sep 2024 16:42:42 -0400 Subject: Add optional:or_exit(...) --- examples/ini.tm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/ini.tm') diff --git a/examples/ini.tm b/examples/ini.tm index 50668793..afd71a30 100644 --- a/examples/ini.tm +++ b/examples/ini.tm @@ -32,13 +32,13 @@ func parse_ini(path:Path)->{Text:{Text:Text}}: func main(path:Path, key:Text): keys := key:split($Pattern"/") if keys.length > 2: - exit(1, message=" + exit(" Too many arguments! $_USAGE ") if not path:is_file() or path:is_pipe(): - exit(code=1, "Could not read file: $(path.text_content)") + exit("Could not read file: $(path.text_content)") data := parse_ini(path) if keys.length < 1 or keys[1] == '*': @@ -47,7 +47,7 @@ func main(path:Path, key:Text): section := keys[1]:lower() if not data:has(section): - exit(1, message="Invalid section name: $section; valid names: $(", ":join([k:quoted() for k in data.keys]))") + exit("Invalid section name: $section; valid names: $(", ":join([k:quoted() for k in data.keys]))") section_data := data:get(section) if keys.length < 2 or keys[2] == '*': @@ -56,6 +56,6 @@ func main(path:Path, key:Text): section_key := keys[2]:lower() if not section_data:has(section_key): - exit(1, message="Invalid key: $section_key; valid keys: $(", ":join(section_data.keys))") + exit("Invalid key: $section_key; valid keys: $(", ":join(section_data.keys))") say(section_data:get(section_key)) -- cgit v1.2.3