# reads a config file export def read_file [app: string, filename = "config.toml"] { get_path $app | path join $filename | open } # returns the path to an apps config dir export def get_path [app: string] { let local = ( $env.HOME | path join ".config" | path join $app ) if ( $local | path exists ) { $local } else { let etc_cfg = ( "/etc" | path join $app ) if ( $etc_cfg | path exists ) { $etc_cfg } else { mkdir $local $local } } }