1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use crate::cli::{Subcommand, SubcommandCallback};
use crate::context::Context;
use clap::{ArgMatches, Command};
use factorio_bot_core::miette::Result;
use factorio_bot_core::paris::info;

impl Subcommand for ThisCommand {
  fn name(&self) -> &str {
    "play"
  }
  fn build_command(&self) -> Command<'static> {
    Command::new(self.name()).about("play")
  }
  fn build_callback(&self) -> SubcommandCallback {
    |args, context| Box::pin(run(args, context))
  }
}

#[allow(clippy::unused_async)]
async fn run(_matches: ArgMatches, _context: &mut Context) -> Result<()> {
  info!("hello world");
  Ok(())
}

struct ThisCommand {}
pub fn build() -> Box<dyn Subcommand> {
  Box::new(ThisCommand {})
}