diff --git a/adbyss/Cargo.toml b/adbyss/Cargo.toml index 9d0e994..5682346 100644 --- a/adbyss/Cargo.toml +++ b/adbyss/Cargo.toml @@ -90,7 +90,7 @@ items = [ ] [dependencies] -argyle = "0.7.*" +argyle = "0.7.2" dactyl = "0.7.*" fyi_msg = "0.13.*" libc = "0.2.*" diff --git a/adbyss/src/main.rs b/adbyss/src/main.rs index 381be8e..682a23d 100644 --- a/adbyss/src/main.rs +++ b/adbyss/src/main.rs @@ -77,6 +77,23 @@ fn _main() -> Result<(), AdbyssError> { // Parse CLI arguments. let args = Argue::new(FLAG_VERSION | FLAG_HELP)?; + // Check for invalid CLI options. + if let Some(boo) = args.check_keys( + &[ + b"--disable", + b"--quiet", + b"--show", + b"--stdout", + b"--systemd", + b"--yes", + b"-q", + b"-y", + ], + &[b"--config", b"-c"], + ) { + return Err(AdbyssError::InvalidCli(String::from_utf8_lossy(boo).into())); + } + // Load configuration. If the user specified one, go with that and print an // error if the path is invalid. Otherwise look for a config at the default // path and go with that if it exists. Otherwise just use the internal diff --git a/adbyss_core/src/error.rs b/adbyss_core/src/error.rs index e31123a..3a5aa1b 100644 --- a/adbyss_core/src/error.rs +++ b/adbyss_core/src/error.rs @@ -30,6 +30,8 @@ pub enum AdbyssError { HostsRead(Box), /// # Write error. HostsWrite(Box), + /// # Uknown CLI option. + InvalidCli(Box), /// # No Internet. NoInternet, /// # Root required. @@ -50,6 +52,7 @@ impl fmt::Display for AdbyssError { Self::HostsInvalid(path) => f.write_fmt(format_args!("Invalid hostfile: {path:?}")), Self::HostsRead(path) => f.write_fmt(format_args!("Unable to read hostfile: {path:?}")), Self::HostsWrite(path) => f.write_fmt(format_args!("Unable to write hostfile: {path:?}")), + Self::InvalidCli(s) => f.write_fmt(format_args!("Invalid/unknown option: {s}")), Self::NoInternet => f.write_str("No internet connection was available."), Self::Root => f.write_str("Adbyss requires root privileges."), Self::SourceFetch(src) => f.write_fmt(format_args!("Unable to fetch source: {}", src.as_str())),