saja 0.1.0

Zero-configuration C build system
/*
 * Command-line option parsing.
 *
 * Copyright (C) 2026  Madeleine Choi
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

use std::path::PathBuf;

use clap::{ArgAction, Parser, Subcommand};

#[derive(Subcommand, PartialEq)]
pub enum Command {
    Build {
        #[arg(
            long,
            default_value = "debug",
            default_value_if("release", "true", Some("release")),
            help = "Build profile"
        )]
        profile: String,

        #[arg(long, help = "Build with release profile (equivalent to --profile=release)", action = ArgAction::SetTrue)]
        release: bool,

        #[arg(long, help = "Don't emit compile_commands.json", action = ArgAction::SetTrue)]
        no_compile_commands: bool,
    },

    Init,
}

#[derive(Parser)]
#[command(
    author = "Madeleine Choi <madeleine@choi.moe>",
    version = "0.1.0",
    about = "Saja is a zero-configuration build system for C."
)]
pub struct Arguments {
    #[arg(
        long,
        default_value = ".saja/",
        help = "Output directory for internal build files"
    )]
    pub build: PathBuf,

    #[arg(short, long, help = "Enable verbose logging", action = ArgAction::SetTrue)]
    pub verbose: bool,

    #[command(subcommand)]
    pub command: Command,
}