config = {'quarto-path':'/my/example/project/path','obsidian-path':'/path/to/my/valult'}
save_config(config)Config
Command Line Interface
Creating / Reading Config
save_config
save_config (config)
Save config to file
load_config
load_config ()
Load config, creating default if it doesn’t exist
Let’s try it out! Let’s see if we can save a config:
Now, let’s try reading it and see if the file is the same:
t1 = load_config()
print(t1){'quarto-path': '/my/example/project/path', 'obsidian-path': '/path/to/my/valult'}
t1 = load_config()
print(t1)
test_eq(t1['obsidian-path'],config['obsidian-path'])
test_eq(t1['quarto-path'],config['quarto-path'])
print('\nIt works!'){'quarto-path': '/my/example/project/path', 'obsidian-path': '/path/to/my/valult'}
It works!
Setting/Updating Values
set_setting
set_setting (key, value)
Set a specific setting
get_setting
get_setting (key, default=None)
Get a specific setting
Let’s see if these work!
set_setting('author','Cooper Richason')t2 = get_setting('author')
print(t2)
test_eq('Cooper Richason',t2)
print('It works!')Cooper Richason
It works!
# Cleaning up Tests
ct = load_config()
ct.pop('obsidian-path')
ct.pop('quarto-path')
ct.pop('author')
save_config(t1)