1pub mod cli;
10pub mod client;
11pub mod commands;
12pub mod config;
13pub mod editor;
14pub mod output;
15
16use std::ffi::OsString;
17
18use clap::{CommandFactory, Parser};
19
20use crate::cli::{Cli, Command};
21
22pub fn run<I, T>(argv: I) -> anyhow::Result<()>
25where
26 I: IntoIterator<Item = T>,
27 T: Into<OsString> + Clone,
28{
29 let cli = Cli::try_parse_from(argv)?;
30 match cli.command {
31 Command::Auth(c) => commands::auth::run(c),
32 Command::Repo(c) => commands::repo::run(c),
33 Command::Issue(c) => commands::issue::run(c),
34 Command::Pr(c) => commands::pr::run(c),
35 Command::Run(c) => commands::run::run(c),
36 Command::Org(c) => commands::org::run(c),
37 Command::Release(c) => commands::release::run(c),
38 Command::Api(c) => commands::api::run(c),
39 Command::Backup(c) => commands::backup::run(c),
40 Command::Completion { shell } => {
41 let mut cmd = Cli::command();
45 clap_complete::generate(
46 clap_complete::Shell::from(shell),
47 &mut cmd,
48 "runtime",
49 &mut std::io::stdout(),
50 );
51 Ok(())
52 }
53 }
54}