diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-08-31 23:33:22 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-08-31 23:33:22 -0400 |
| commit | 5fc7577b5a3bc2c445522dfd5b287e1c6eddc3e9 (patch) | |
| tree | 34d44c9330dc3ec71fc850b95b3412a1ce292cb8 /examples/ini | |
| parent | a571ccffd795a595e990a3405dcf977aafc33c6c (diff) | |
Switch to using optional return values for list indexing.
Diffstat (limited to 'examples/ini')
| -rw-r--r-- | examples/ini/CHANGES.md | 4 | ||||
| -rw-r--r-- | examples/ini/ini.tm | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/examples/ini/CHANGES.md b/examples/ini/CHANGES.md index 42ae752c..636f9296 100644 --- a/examples/ini/CHANGES.md +++ b/examples/ini/CHANGES.md @@ -1,5 +1,9 @@ # Version History +## v1.1 + +Version bump for Tomo syntax changes. + ## v1.0 Initial version diff --git a/examples/ini/ini.tm b/examples/ini/ini.tm index 4dc27725..790b3abc 100644 --- a/examples/ini/ini.tm +++ b/examples/ini/ini.tm @@ -40,20 +40,20 @@ func main(path:Path, key:Text?) ") data := parse_ini(path) - if keys.length < 1 or keys[1] == '*' + if keys.length < 1 or keys[1]! == '*' say("$data") return - section := keys[1].lower() + section := keys[1]!.lower() section_data := data[section] or exit(" Invalid section name: \[31;1]$section\[] Valid names: \[1]$(", ".join([k.quoted() for k in data.keys]))\[] ") - if keys.length < 2 or keys[2] == '*' + if keys.length < 2 or keys[2]! == '*' say("$section_data") return - section_key := keys[2].lower() + section_key := keys[2]!.lower() value := section_data[section_key] or exit(" Invalid key: \[31;1]$section_key\[] Valid keys: \[1]$(", ".join([s.quoted() for s in section_data.keys]))\[] |
