use clap::{Parser, Subcommand};
use crate::operations::OperationError;
pub fn failure_report(error: &OperationError) -> String {
match error {
OperationError::Invalid(failure) => failure.to_string(),
other => format!("Error: {other}"),
}
}
#[derive(Debug, Parser)]
#[command(name = "nbspec", version, about)]
pub struct Cli {
#[arg(long, global = true)]
pub notebook: Option<String>,
#[command(subcommand)]
pub command: Command,
}
#[derive(Debug, Subcommand)]
pub enum Command {
Create {
change_id: String,
#[arg(long)]
title: Option<String>,
},
Display {
change_id: String,
#[arg(long)]
full: bool,
},
Render {
change_id: String,
#[arg(long)]
diff: bool,
},
Merge {
change_id: String,
#[arg(long)]
force: bool,
},
Validate {
change_id: String,
},
}