Skip to content

Commit

Permalink
feat: auto-enabled verbosity for gix fetch/clone and add `--no-verb…
Browse files Browse the repository at this point in the history
…ose`.

I found myself always adding (and having to remember to add) the `-v` flag
for long-running operations so these should be able to default to a
higher verbosity level.

To counter that, there is a new `--no-verbose` flag to turn that off.
  • Loading branch information
Byron committed Dec 2, 2022
1 parent 1b7a35a commit 9814369
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 62 deletions.
23 changes: 12 additions & 11 deletions src/plumbing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ pub fn main() -> Result<()> {
progress = false;
progress_keep_open = false;
}
let auto_verbose = !progress && !args.no_verbose;

let should_interrupt = Arc::new(AtomicBool::new(false));
git_repository::interrupt::init_handler({
Expand All @@ -133,7 +134,7 @@ pub fn main() -> Result<()> {
};
prepare_and_run(
"clone",
verbose,
auto_verbose,
progress,
progress_keep_open,
core::repository::clone::PROGRESS_RANGE,
Expand All @@ -156,7 +157,7 @@ pub fn main() -> Result<()> {
};
prepare_and_run(
"fetch",
verbose,
auto_verbose,
progress,
progress_keep_open,
core::repository::fetch::PROGRESS_RANGE,
Expand Down Expand Up @@ -202,7 +203,7 @@ pub fn main() -> Result<()> {
{
prepare_and_run(
"remote-refs",
verbose,
auto_verbose,
progress,
progress_keep_open,
core::repository::remote::refs::PROGRESS_RANGE,
Expand All @@ -221,7 +222,7 @@ pub fn main() -> Result<()> {
#[cfg(feature = "gitoxide-core-async-client")]
{
let (_handle, progress) = async_util::prepare(
verbose,
auto_verbose,
"remote-refs",
Some(core::repository::remote::refs::PROGRESS_RANGE),
);
Expand Down Expand Up @@ -258,7 +259,7 @@ pub fn main() -> Result<()> {
free::Subcommands::CommitGraph(subcommands) => match subcommands {
free::commitgraph::Subcommands::Verify { path, statistics } => prepare_and_run(
"commitgraph-verify",
verbose,
auto_verbose,
progress,
progress_keep_open,
None,
Expand Down Expand Up @@ -339,7 +340,7 @@ pub fn main() -> Result<()> {
),
free::index::Subcommands::Verify => prepare_and_run(
"index-verify",
verbose,
auto_verbose,
progress,
progress_keep_open,
None,
Expand All @@ -353,7 +354,7 @@ pub fn main() -> Result<()> {
} => match cmd {
free::mailmap::Subcommands::Verify => prepare_and_run(
"mailmap-verify",
verbose,
auto_verbose,
progress,
progress_keep_open,
core::mailmap::PROGRESS_RANGE,
Expand Down Expand Up @@ -468,7 +469,7 @@ pub fn main() -> Result<()> {
verify,
} => prepare_and_run(
"pack-explode",
verbose,
auto_verbose,
progress,
progress_keep_open,
None,
Expand Down Expand Up @@ -500,7 +501,7 @@ pub fn main() -> Result<()> {
path,
} => prepare_and_run(
"pack-verify",
verbose,
auto_verbose,
progress,
progress_keep_open,
verify::PROGRESS_RANGE,
Expand Down Expand Up @@ -546,7 +547,7 @@ pub fn main() -> Result<()> {
),
free::pack::multi_index::Subcommands::Verify => prepare_and_run(
"pack-multi-index-verify",
verbose,
auto_verbose,
progress,
progress_keep_open,
core::pack::multi_index::PROGRESS_RANGE,
Expand Down Expand Up @@ -624,7 +625,7 @@ pub fn main() -> Result<()> {
},
} => prepare_and_run(
"verify",
verbose,
auto_verbose,
progress,
progress_keep_open,
core::repository::verify::PROGRESS_RANGE,
Expand Down
4 changes: 4 additions & 0 deletions src/plumbing/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ pub struct Args {
#[clap(long, short = 'v')]
pub verbose: bool,

/// Turn off verbose message display for commands where these are shown by default.
#[clap(long, conflicts_with("verbose"))]
pub no_verbose: bool,

/// Bring up a terminal user interface displaying progress visually
#[cfg(feature = "prodash-render-tui")]
#[clap(long, conflicts_with("verbose"))]
Expand Down
Loading

0 comments on commit 9814369

Please sign in to comment.