mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Create a new doc if necessary in ta config set
This commit is contained in:
parent
53cba2b31e
commit
8e84bf0446
1 changed files with 10 additions and 4 deletions
|
@ -184,10 +184,16 @@ impl Settings {
|
||||||
.ok_or_else(|| anyhow!("Could not determine config file name"))?
|
.ok_or_else(|| anyhow!("Could not determine config file name"))?
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut document = fs::read_to_string(filename.clone())
|
let exists = filename.exists();
|
||||||
.context("Could not read existing configuration file")?
|
|
||||||
.parse::<Document>()
|
let mut document = if exists {
|
||||||
.context("Could not parse existing configuration file")?;
|
fs::read_to_string(filename.clone())
|
||||||
|
.context("Could not read existing configuration file")?
|
||||||
|
.parse::<Document>()
|
||||||
|
.context("Could not parse existing configuration file")?
|
||||||
|
} else {
|
||||||
|
Document::new()
|
||||||
|
};
|
||||||
|
|
||||||
// set the value as the correct type
|
// set the value as the correct type
|
||||||
match key {
|
match key {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue