mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-30 20:34:49 +01:00
Change minor things
This commit is contained in:
parent
2a70ba4d69
commit
f9ca886ed9
3 changed files with 27 additions and 13 deletions
22
Cargo.lock
generated
22
Cargo.lock
generated
|
@ -310,6 +310,17 @@ dependencies = [
|
||||||
"objc2",
|
"objc2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bstr"
|
||||||
|
version = "1.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
"regex-automata 0.4.5",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bumpalo"
|
name = "bumpalo"
|
||||||
version = "3.14.0"
|
version = "3.14.0"
|
||||||
|
@ -1658,6 +1669,15 @@ dependencies = [
|
||||||
"libredox 0.0.2",
|
"libredox 0.0.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "os_str_bytes"
|
||||||
|
version = "6.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "overload"
|
name = "overload"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
|
@ -2187,7 +2207,9 @@ version = "3.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "da03fa3b94cc19e3ebfc88c4229c49d8f08cdbd1228870a45f0ffdf84988e14b"
|
checksum = "da03fa3b94cc19e3ebfc88c4229c49d8f08cdbd1228870a45f0ffdf84988e14b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"bstr",
|
||||||
"dirs",
|
"dirs",
|
||||||
|
"os_str_bytes",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -62,7 +62,7 @@ cliclack = "0.1.13"
|
||||||
bitflags = "2.4.2"
|
bitflags = "2.4.2"
|
||||||
serde = { version = "1.0.196", features = ["derive"] }
|
serde = { version = "1.0.196", features = ["derive"] }
|
||||||
toml = "0.8.10"
|
toml = "0.8.10"
|
||||||
shellexpand = "3.1.0"
|
shellexpand = { version = "3.1.0", features = ["path"] }
|
||||||
x11rb = { version = "0.13.0", default-features = false, features = ["composite"] }
|
x11rb = { version = "0.13.0", default-features = false, features = ["composite"] }
|
||||||
xkbcommon = { workspace = true }
|
xkbcommon = { workspace = true }
|
||||||
xdg = { workspace = true }
|
xdg = { workspace = true }
|
||||||
|
|
16
src/cli.rs
16
src/cli.rs
|
@ -56,15 +56,9 @@ impl Cli {
|
||||||
// oh my god rustfmt is starting to piss me off
|
// oh my god rustfmt is starting to piss me off
|
||||||
|
|
||||||
cli.config_dir = cli.config_dir.and_then(|dir| {
|
cli.config_dir = cli.config_dir.and_then(|dir| {
|
||||||
let Some(dir) = dir.to_str() else {
|
let new_dir = shellexpand::path::full(&dir);
|
||||||
warn!(
|
|
||||||
"Could not convert `--config-dir`'s argument to `&str`; unsetting `--config-dir`"
|
|
||||||
);
|
|
||||||
return None;
|
|
||||||
};
|
|
||||||
let new_dir = shellexpand::full(dir);
|
|
||||||
match new_dir {
|
match new_dir {
|
||||||
Ok(new_dir) => Some(PathBuf::from(new_dir.to_string())),
|
Ok(new_dir) => Some(new_dir.to_path_buf()),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
warn!("Could not shellexpand `--config-dir`'s argument: {err}; unsetting `--config-dir`");
|
warn!("Could not shellexpand `--config-dir`'s argument: {err}; unsetting `--config-dir`");
|
||||||
None
|
None
|
||||||
|
@ -147,7 +141,6 @@ impl std::fmt::Display for Lang {
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Pretty sure this function returns Result purely for testing which I don't *really* like
|
|
||||||
/// Generate a new config.
|
/// Generate a new config.
|
||||||
///
|
///
|
||||||
/// If `--non-interactive` is passed or the shell is non-interactive, this will not
|
/// If `--non-interactive` is passed or the shell is non-interactive, this will not
|
||||||
|
@ -289,13 +282,12 @@ fn generate_config(args: ConfigGen) -> anyhow::Result<()> {
|
||||||
None => {
|
None => {
|
||||||
assert!(interactive);
|
assert!(interactive);
|
||||||
|
|
||||||
let dir: String = cliclack::input("Choose a directory to place the config in:")
|
let dir: PathBuf = cliclack::input("Choose a directory to place the config in:")
|
||||||
.default_input(default_dir.to_string_lossy().as_ref())
|
.default_input(default_dir.to_string_lossy().as_ref())
|
||||||
.validate_interactively(dir_validator)
|
.validate_interactively(dir_validator)
|
||||||
.interact()?;
|
.interact()?;
|
||||||
|
|
||||||
let dir = shellexpand::full(&dir)?;
|
let mut dir = shellexpand::path::full(&dir)?.to_path_buf();
|
||||||
let mut dir = PathBuf::from(dir.to_string());
|
|
||||||
|
|
||||||
if dir.is_relative() {
|
if dir.is_relative() {
|
||||||
let mut new_dir = std::env::current_dir()?;
|
let mut new_dir = std::env::current_dir()?;
|
||||||
|
|
Loading…
Add table
Reference in a new issue