Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Bugreport command #28

Merged
merged 24 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0003d82
chore: fix simple error in workflow
bayou-brogrammer Jan 28, 2024
3742d78
add build.rs file for env info
bayou-brogrammer Jan 28, 2024
6877be2
add bug report command
bayou-brogrammer Jan 28, 2024
a970e9a
null out completions command
bayou-brogrammer Jan 28, 2024
df33912
Merge branch 'main' into bugreport-command
gmpinder Jan 28, 2024
714477e
Remove pedantic to allow shadow_rs to work
gmpinder Jan 28, 2024
54d617f
Add build.rs in +common target
gmpinder Jan 28, 2024
0634657
cleanup bug_report and add completions command
bayou-brogrammer Jan 28, 2024
6fb1fbf
Merge branch 'main' into bugreport-command
gmpinder Jan 28, 2024
2a4de86
fix: cleanup command
bayou-brogrammer Jan 28, 2024
fb6483f
chore: remove unused package
bayou-brogrammer Jan 28, 2024
3e654b7
Merge branch 'main' into bugreport-command
gmpinder Jan 28, 2024
e2bab54
feat: cleanup report code a bit
bayou-brogrammer Jan 29, 2024
91e497d
Merge branch 'main' into bugreport-command
bayou-brogrammer Jan 29, 2024
9468ea9
fix: fix git commit hash not showing
bayou-brogrammer Jan 29, 2024
16d4e1c
---- trying shit out. possible delete everything after this to fix br…
bayou-brogrammer Jan 29, 2024
34751e9
fix: recipe parsing
bayou-brogrammer Jan 29, 2024
0dbe089
Removed allow for unused imports and cleaned up the code
gmpinder Jan 29, 2024
9ee0dbe
Removed allow for unused imports and cleaned up the code
gmpinder Jan 29, 2024
0583dcd
fix: cleanup
bayou-brogrammer Jan 30, 2024
f6d513d
Use serde to print the entire file in the template
gmpinder Jan 30, 2024
9b892fc
Make get_modules recursive
gmpinder Jan 30, 2024
5c09dee
Handle error case for failed module parsing
gmpinder Jan 30, 2024
bdfaaeb
chore: remove powershell support
Jan 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
710 changes: 608 additions & 102 deletions Cargo.lock

Large diffs are not rendered by default.

45 changes: 35 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,42 @@ description = "A CLI tool built for creating Containerfile templates based on th
repository = "https://github.com/blue-build/cli"
license = "Apache-2.0"
categories = ["command-line-utilities"]
build = "build.rs"

[dependencies]
anyhow = "1"
askama = { version = "0.12.1", features = ["serde-json"] }
cfg-if = "1.0.0"
askama = { version = "0.12", features = ["serde-json"] }
chrono = "0.4"
clap = { version = "4", features = ["derive"] }
clap-verbosity-flag = "2.1.1"
derive_builder = "0.12.0"
env_logger = "0.10.1"
futures-util = { version = "0.3.30", optional = true }
indexmap = { version = "2.1.0", features = ["serde"] }
clap = { version = "4", features = ["derive", "cargo", "unicode"] }
clap-verbosity-flag = "2"
clap_complete = "4"
derive_builder = "0.13"
directories = "5"
env_logger = "0.11"
futures-util = { version = "0.3", optional = true }
indexmap = { version = "2", features = ["serde"] }
log = "0.4"
open = "5"
# update os module config and tests when upgrading os_info
os_info = "3.7.0"
podman-api = { version = "0.10.0", optional = true }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_yaml = "0.9.25"
serde_yaml = "0.9.30"
shadow-rs = { version = "0.26.1", default-features = false }
sigstore = { version = "0.8.0", optional = true }
tokio = { version = "1", features = ["full"], optional = true }
typed-builder = "0.18.0"
typed-builder = "0.18.1"
urlencoding = "2.1.3"
users = "0.11.0"
which = "6"

requestty = { version = "0.5", features = ["macros", "termion"] }
colorized = "1"
fuzzy-matcher = "0.3"
process_control = { version = "4.0.3", features = ["crossbeam-channel"] }
ratatui = "0.25.0"
crossterm = "0.27.0"

[features]
default = []
Expand All @@ -37,3 +52,13 @@ init = []

[dev-dependencies]
rusty-hook = "0.11.2"

[build-dependencies]
shadow-rs = { version = "0.26.1", default-features = false }
dunce = "1.0.4"

[profile.release]
lto = true
codegen-units = 1
strip = true
debug = false
1 change: 1 addition & 0 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ common:
COPY --keep-ts Cargo.* /app
COPY --keep-ts *.md /app
COPY --keep-ts LICENSE /app
COPY --keep-ts build.rs /app

DO cargo+INIT

Expand Down
3 changes: 3 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() -> shadow_rs::SdResult<()> {
shadow_rs::new()
}
55 changes: 45 additions & 10 deletions src/bin/bb.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
#![warn(clippy::pedantic, clippy::nursery)]

use clap::{Parser, Subcommand};
use clap::{command, crate_authors, Args, CommandFactory, Parser, Subcommand};
use clap_complete::{generate, Shell as CompletionShell};
use clap_verbosity_flag::{InfoLevel, Verbosity};
use env_logger::WriteStyle;
use log::trace;

use blue_build::{
self,
commands::{build, local, template, BlueBuildCommand},
commands::{bug_report, build, local, template, BlueBuildCommand},
};

#[cfg(feature = "init")]
use blue_build::commands::init;

shadow_rs::shadow!(shadow);

#[derive(Parser, Debug)]
#[command(name = "BlueBuild", author, version, about, long_about = None)]
#[clap(
name = "BlueBuild",
about,
long_about = None,
author=crate_authors!(),
version=shadow::PKG_VERSION,
long_version=shadow::CLAP_LONG_VERSION,
arg_required_else_help=true,
)]
struct BlueBuildArgs {
#[command(subcommand)]
command: CommandArgs,
Expand Down Expand Up @@ -60,6 +68,33 @@ enum CommandArgs {

#[cfg(feature = "init")]
New(init::NewCommand),

/// Create a pre-populated GitHub issue with information about your configuration
BugReport(bug_report::BugReportCommand),

/// Generate shell completions for your shell to stdout
Completions(CompletionsCommand),
}

#[derive(Debug, Clone, Args)]
pub struct CompletionsCommand {
#[clap(value_enum)]
shell: CompletionShell,
}

impl BlueBuildCommand for CompletionsCommand {
fn try_run(&mut self) -> anyhow::Result<()> {
log::debug!("Generating completions for {shell}", shell = self.shell);

generate(
self.shell,
&mut BlueBuildArgs::command(),
"bb",
&mut std::io::stdout().lock(),
);

Ok(())
}
}

fn main() {
Expand All @@ -71,18 +106,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(),
}
}
2 changes: 2 additions & 0 deletions src/commands.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#[cfg(feature = "init")]
pub mod init;

pub mod bug_report;
pub mod build;
pub mod local;
pub mod template;
pub mod utils;

use log::error;

Expand Down
Loading
Loading