pub mod cli;
pub mod client;
pub mod commands;
pub mod config;
pub mod editor;
pub mod output;
use std::ffi::OsString;
use clap::{CommandFactory, Parser};
use crate::cli::{Cli, Command};
pub fn run<I, T>(argv: I) -> anyhow::Result<()>
where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
{
let cli = Cli::try_parse_from(argv)?;
match cli.command {
Command::Auth(c) => commands::auth::run(c),
Command::Repo(c) => commands::repo::run(c),
Command::Issue(c) => commands::issue::run(c),
Command::Pr(c) => commands::pr::run(c),
Command::Run(c) => commands::run::run(c),
Command::Org(c) => commands::org::run(c),
Command::Release(c) => commands::release::run(c),
Command::Api(c) => commands::api::run(c),
Command::Backup(c) => commands::backup::run(c),
Command::Completion { shell } => {
let mut cmd = Cli::command();
clap_complete::generate(
clap_complete::Shell::from(shell),
&mut cmd,
"runtime",
&mut std::io::stdout(),
);
Ok(())
}
}
}