packager/pkgr/src/commands/mod.rs

64 lines
1.6 KiB
Rust
Raw Normal View History

2023-07-16 19:00:09 +02:00
use crate::package::identifier::PackageIdentifier;
2023-07-17 11:50:19 +02:00
use clap::{Parser, Subcommand};
use log::error;
2023-07-16 19:00:09 +02:00
2023-07-17 11:50:19 +02:00
#[derive(Parser, Debug)]
#[clap(name = "pkgr", version = "0.1.0", author = "")]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
}
#[derive(Subcommand, Debug)]
2023-07-16 19:00:09 +02:00
pub enum Command {
2023-07-17 11:50:19 +02:00
/// Install a package
Install {
#[arg(short, long, default_value_t = false)]
build: bool,
package_identifier: PackageIdentifier,
},
/// Remove a package from the system
Remove {
package_identifier: PackageIdentifier,
},
/// List packages
List {
/// List installed packages
#[arg(short, long, default_value_t = true)]
installed: bool,
},
/// Update packages on the system
2023-07-16 19:00:09 +02:00
Update,
2023-07-17 11:50:19 +02:00
#[command(hide = true)]
None,
}
impl Command {
pub fn execute(&self) {
match self {
Command::Install {
build,
2023-07-17 11:50:51 +02:00
package_identifier: _,
2023-07-17 11:50:19 +02:00
} => {
if *build {
error!("Build is not yet implemented.");
} else {
error!("Install is not yet implemented.");
}
}
2023-07-17 11:50:51 +02:00
Command::Remove { package_identifier: _ } => {
2023-07-17 11:50:19 +02:00
error!("Remove is not yet implemented.");
}
2023-07-17 11:50:51 +02:00
Command::List { installed: _ } => {
2023-07-17 11:50:19 +02:00
error!("List is not yet implemented.");
}
Command::Update => {
error!("Update is not yet implemented.");
}
Command::None => {
error!("No command was specified.");
}
}
}
}