cod_cli/
lib.rs

1pub mod auth;
2pub mod issue;
3pub mod label;
4pub mod milestone;
5pub mod notification;
6pub mod pull_request;
7pub mod repo;
8pub mod user;
9
10use clap::{CommandFactory, Parser};
11use clap_complete::Shell;
12
13pub const LOGO: &str = include_str!("logo.txt");
14
15pub fn generate_completion(shell: Shell, bin_name: &str) {
16    let cmd = &mut MainArgs::command();
17    clap_complete::generate(shell, cmd, bin_name, &mut std::io::stdout());
18}
19
20/// Codeberg CLI app
21#[derive(Parser, Debug)]
22#[command(name = "cod", version, before_long_help = LOGO)]
23pub enum MainArgs {
24    #[command(subcommand)]
25    Auth(auth::AuthArgs),
26
27    #[command(subcommand)]
28    User(user::UserArgs),
29
30    #[command(subcommand)]
31    Issue(issue::IssueArgs),
32
33    #[command(subcommand)]
34    Pull(pull_request::PullRequestArgs),
35
36    #[command(subcommand)]
37    Label(label::LabelArgs),
38
39    #[command(subcommand)]
40    Repo(repo::RepoArgs),
41
42    #[command(subcommand)]
43    Milestone(milestone::MilestoneArgs),
44
45    #[command(subcommand)]
46    Notification(notification::NotificationArgs),
47
48    /// Print completion script
49    Completion {
50        /// Shell to generate completion for
51        shell: Shell,
52    },
53}