cli: Don't allow missing config file
It's best to just error if the user is missing the config file, since we create it on profile init. This also gets rid of the privacy leak.
This commit is contained in:
parent
0d18a8fd9e
commit
6b4f055c36
|
|
@ -12,7 +12,7 @@
|
|||
//!
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{fs, io, str::FromStr};
|
||||
use std::{fs, io};
|
||||
|
||||
use serde::Serialize;
|
||||
use thiserror::Error;
|
||||
|
|
@ -163,15 +163,7 @@ impl Config {
|
|||
Ok(cfg) => {
|
||||
serde_json::from_reader(cfg).map_err(|e| ConfigError::Load(path.to_path_buf(), e))
|
||||
}
|
||||
Err(e) => {
|
||||
let Ok(user) = env::var("USER") else {
|
||||
return Err(ConfigError::Io(path.to_owned(), e));
|
||||
};
|
||||
let Ok(alias) = Alias::from_str(&user) else {
|
||||
return Err(ConfigError::Io(path.to_owned(), e));
|
||||
};
|
||||
Ok(Config::new(alias))
|
||||
}
|
||||
Err(e) => Err(ConfigError::Io(path.to_path_buf(), e)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue