mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-01-06 08:09:09 +00:00
fix(cli config): create folder for config
This commit is contained in:
parent
056d1dce36
commit
12407fa6de
3 changed files with 7 additions and 5 deletions
|
@ -30,4 +30,4 @@ sentry-log = "0.32.2"
|
||||||
sentry-actix = "0.32.2"
|
sentry-actix = "0.32.2"
|
||||||
|
|
||||||
# zstd-sys v2.0.10 is broken: https://github.com/gyscos/zstd-rs/issues/268
|
# zstd-sys v2.0.10 is broken: https://github.com/gyscos/zstd-rs/issues/268
|
||||||
zstd-sys = "=2.0.9+zstd.1.5.5"
|
zstd-sys = "=2.0.9"
|
|
@ -20,6 +20,7 @@ use reqwest::{
|
||||||
use semver::{Version, VersionReq};
|
use semver::{Version, VersionReq};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{
|
use std::{
|
||||||
|
fs::create_dir_all,
|
||||||
hash::{DefaultHasher, Hash, Hasher},
|
hash::{DefaultHasher, Hash, Hasher},
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
|
@ -173,9 +174,10 @@ impl CliConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write(&self) -> anyhow::Result<()> {
|
pub fn write(&self) -> anyhow::Result<()> {
|
||||||
let cli_config_path = DIRS.config_dir().join("config.yaml");
|
let folder = DIRS.config_dir();
|
||||||
|
create_dir_all(folder)?;
|
||||||
serde_yaml::to_writer(
|
serde_yaml::to_writer(
|
||||||
&mut std::fs::File::create(cli_config_path.as_path())?,
|
&mut std::fs::File::create(folder.join("config.yaml"))?,
|
||||||
&self,
|
&self,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ pub enum EscapedPackageNameError<E> {
|
||||||
Invalid(String),
|
Invalid(String),
|
||||||
|
|
||||||
/// The package name is invalid
|
/// The package name is invalid
|
||||||
#[error("invalid package name")]
|
#[error(transparent)]
|
||||||
InvalidName(#[from] E),
|
InvalidName(#[from] E),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ pub enum FromStrPackageNameParseError<E> {
|
||||||
Invalid(String),
|
Invalid(String),
|
||||||
|
|
||||||
/// The package name is invalid
|
/// The package name is invalid
|
||||||
#[error("invalid name part")]
|
#[error(transparent)]
|
||||||
InvalidPart(#[from] E),
|
InvalidPart(#[from] E),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue