Skip to content

Commit 0a8bdf5

Browse files
committed
feat: make sub command required for better error message
1 parent 3e08b2b commit 0a8bdf5

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/main.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ mod database;
2828
#[command(version, about, long_about = None)]
2929
struct Args {
3030
#[command(subcommand)]
31-
pub command: Option<Commands>,
31+
pub command: Commands,
3232

3333
/// Path to the cli configuration file
3434
#[arg(short, long)]
@@ -165,13 +165,6 @@ async fn main() -> eyre::Result<()> {
165165

166166
let args = Args::parse();
167167

168-
let command = match args.command {
169-
Some(command) => command,
170-
None => {
171-
return Err(eyre::eyre!("please specify a command"));
172-
}
173-
};
174-
175168
// Load the create tenant config
176169
let config_raw = tokio::fs::read(args.config).await?;
177170
let config: CliConfiguration =
@@ -217,7 +210,7 @@ async fn main() -> eyre::Result<()> {
217210
}
218211
};
219212

220-
match command {
213+
match args.command {
221214
Commands::CreateRoot => {
222215
docbox_management::root::initialize::initialize(
223216
&db_provider,

0 commit comments

Comments
 (0)