Skip to content

Commit

Permalink
feat(sync): assume sync subcommand if none given
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Nov 22, 2023
1 parent 6a93563 commit ae8f7bf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions aw-sync/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ mod util;
#[clap(version = "0.1", author = "Erik Bjäreholt")]
struct Opts {
#[clap(subcommand)]
command: Commands,
command: Option<Commands>,

/// Host of instance to connect to.
#[clap(long, default_value = "127.0.0.1")]
Expand Down Expand Up @@ -124,7 +124,8 @@ fn main() -> Result<(), Box<dyn Error>> {

let client = AwClient::new(&opts.host, port, "aw-sync")?;

match opts.command {
// if opts.command is None, then we're using the default subcommand (Sync)
match opts.command.unwrap_or(Commands::Sync { host: None }) {
// Perform basic sync
Commands::Sync { host } => {
// Pull
Expand Down

0 comments on commit ae8f7bf

Please sign in to comment.