You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
487 B
Plaintext
22 lines
487 B
Plaintext
# 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
|
|
}
|
|
}
|
|
} |