Add core CLI command structure and subcommands.
This commit is contained in:
1 parent
5c262fe425
commit
70dec5834e
19 files changed
+447
-1
No files matched your search
@@ -0,0 +1,41 @@
|
||||
use clap::{ Args, Subcommand };
|
||||
|
||||
use crate::cli::{ Exit, Command };
|
||||
|
||||
/// Manage the ELF symbol index.
|
||||
#[derive(Debug, Args)]
|
||||
pub struct Cache {
|
||||
#[command(subcommand)]
|
||||
pub action: CacheAction,
|
||||
}
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum CacheAction {
|
||||
Prune(Prune),
|
||||
}
|
||||
|
||||
impl CacheAction
|
||||
{
|
||||
pub fn command(&self) -> &dyn Command
|
||||
{
|
||||
match self {
|
||||
Self::Prune(c) => c,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Command for Cache
|
||||
{
|
||||
fn run(&self) -> anyhow::Result<Exit> { self.action.command().run() }
|
||||
|
||||
fn on_error(&self) -> Exit { self.action.command().on_error() }
|
||||
}
|
||||
|
||||
/// Drop index entries for package versions that are no longer installed.
|
||||
#[derive(Debug, Args)]
|
||||
pub struct Prune;
|
||||
|
||||
impl Command for Prune
|
||||
{
|
||||
fn run(&self) -> anyhow::Result<Exit> { todo!("keel cache prune") }
|
||||
}
|
||||
Reference in new issue
Block a user