stutter / examples / global_config.v
22 lines · 18 sloc · 287 bytes · 0c355e9d3499f38b7165fd530ac3b1c25dbf93b2
Raw
1@[has_globals]
2module main
3
4import stutter
5
6__global config = stutter.Config{
7 name: 'demo'
8 defaults: 'gap := 4'
9 skip_file: true
10}.read()
11
12struct Settings {
13 gap int
14}
15
16fn main() {
17 settings := config.decode(Settings{}) or {
18 eprintln(err)
19 exit(1)
20 }
21 println(settings.gap)
22}
23