feat: Bugreport command (#28)

Add a bug report + completions command(not complete yet) so that new
users can easily submit bugs to us, and I wanted completions for bb
(super easy with clap)

---------

Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
This commit is contained in:
Hikari 2024-01-31 08:51:13 -06:00 committed by GitHub
parent bdbbcea7cc
commit e069346e15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 1595 additions and 280 deletions

View file

@ -1,66 +1,6 @@
#![warn(clippy::pedantic, clippy::nursery)]
use clap::{Parser, Subcommand};
use clap_verbosity_flag::{InfoLevel, Verbosity};
use blue_build::commands::*;
use clap::Parser;
use env_logger::WriteStyle;
use log::trace;
use blue_build::{
self,
commands::{build, local, template, BlueBuildCommand},
};
#[cfg(feature = "init")]
use blue_build::commands::init;
#[derive(Parser, Debug)]
#[command(name = "BlueBuild", author, version, about, long_about = None)]
struct BlueBuildArgs {
#[command(subcommand)]
command: CommandArgs,
#[clap(flatten)]
verbosity: Verbosity<InfoLevel>,
}
#[derive(Debug, Subcommand)]
enum CommandArgs {
/// Build an image from a recipe
Build(build::BuildCommand),
/// Generate a Containerfile from a recipe
Template(template::TemplateCommand),
/// Upgrade your current OS with the
/// local image saved at `/etc/blue-build/`.
///
/// This requires having rebased already onto
/// a local archive already by using the `rebase`
/// subcommand.
///
/// NOTE: This can only be used if you have `rpm-ostree`
/// installed and if the `--push` and `--rebase` option isn't
/// used. This image will not be signed.
Upgrade(local::UpgradeCommand),
/// Rebase your current OS onto the image
/// being built.
///
/// This will create a tarball of your image at
/// `/etc/blue-build/` and invoke `rpm-ostree` to
/// rebase onto the image using `oci-archive`.
///
/// NOTE: This can only be used if you have `rpm-ostree`
/// installed.
Rebase(local::RebaseCommand),
/// Initialize a new Ublue Starting Point repo
#[cfg(feature = "init")]
Init(init::InitCommand),
#[cfg(feature = "init")]
New(init::NewCommand),
}
fn main() {
let args = BlueBuildArgs::parse();
@ -71,18 +11,18 @@ fn main() {
.write_style(WriteStyle::Always)
.init();
trace!("{args:#?}");
log::trace!("Parsed arguments: {args:#?}");
match args.command {
#[cfg(feature = "init")]
CommandArgs::Init(mut command) => command.run(),
#[cfg(feature = "init")]
CommandArgs::New(mut command) => command.run(),
CommandArgs::Template(mut command) => command.run(),
CommandArgs::Build(mut command) => command.run(),
CommandArgs::Rebase(mut command) => command.run(),
CommandArgs::Upgrade(mut command) => command.run(),
CommandArgs::Template(mut command) => command.run(),
CommandArgs::BugReport(mut command) => command.run(),
CommandArgs::Completions(mut command) => command.run(),
}
}