Skip to content

Commit

Permalink
remove put args sugaring (#103)
Browse files Browse the repository at this point in the history
Thanks!
  • Loading branch information
EvysGarden authored Oct 22, 2023
1 parent 8d93985 commit c95b22c
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ mod command;

use anyhow::Result;
use clap::Parser;
use command::put;
use command::Command;

#[derive(Debug, Parser)]
Expand All @@ -16,13 +15,10 @@ use command::Command;
pub struct Args {
/// The command to run.
#[clap(subcommand)]
pub command: Option<Command>,
pub command: Command,

#[clap(flatten)]
config_args: ConfigArgs,

#[clap(flatten)]
put_args: put::PutArgs,
}

#[derive(Debug, Parser)]
Expand Down Expand Up @@ -97,10 +93,7 @@ pub enum TimeDisplayMode {

impl Args {
pub fn run(self) -> Result<()> {
match self.command {
None => self.put_args.run(&self.config_args)?,
Some(command) => command.run(&self.config_args)?,
}
self.command.run(&self.config_args)?;
Ok(())
}
}

0 comments on commit c95b22c

Please sign in to comment.