Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

feat: Add verbose logging for git and LLM commands

Maximilian Roos2ea4775eb4d1
diff --git a/Cargo.lock b/Cargo.lock
index 748e2cec6..6dad8c20e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -563,6 +563,27 @@ dependencies = [
"crypto-common",
]
+[[package]]
+name = "directories"
+version = "6.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d"
+dependencies = [
+ "dirs-sys",
+]
+
+[[package]]
+name = "dirs-sys"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
+dependencies = [
+ "libc",
+ "option-ext",
+ "redox_users",
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "dlv-list"
version = "0.5.2"
@@ -599,6 +620,29 @@ dependencies = [
"cfg-if",
]
+[[package]]
+name = "env_filter"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2"
+dependencies = [
+ "log",
+ "regex",
+]
+
+[[package]]
+name = "env_logger"
+version = "0.11.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f"
+dependencies = [
+ "anstream",
+ "anstyle",
+ "env_filter",
+ "jiff",
+ "log",
+]
+
[[package]]
name = "equivalent"
version = "1.0.2"
@@ -892,6 +936,30 @@ version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
+[[package]]
+name = "jiff"
+version = "0.2.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49"
+dependencies = [
+ "jiff-static",
+ "log",
+ "portable-atomic",
+ "portable-atomic-util",
+ "serde",
+]
+
+[[package]]
+name = "jiff-static"
+version = "0.2.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
[[package]]
name = "js-sys"
version = "0.3.81"
@@ -919,6 +987,16 @@ version = "0.2.177"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
+[[package]]
+name = "libredox"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb"
+dependencies = [
+ "bitflags",
+ "libc",
+]
+
[[package]]
name = "linux-raw-sys"
version = "0.11.0"
@@ -975,9 +1053,9 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "once_cell_polyfill"
-version = "1.70.1"
+version = "1.70.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
+checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
[[package]]
name = "oorandom"
@@ -985,6 +1063,12 @@ version = "11.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e"
+[[package]]
+name = "option-ext"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
+
[[package]]
name = "ordered-multimap"
version = "0.7.3"
@@ -1090,6 +1174,21 @@ dependencies = [
"plotters-backend",
]
+[[package]]
+name = "portable-atomic"
+version = "1.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
+
+[[package]]
+name = "portable-atomic-util"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
+dependencies = [
+ "portable-atomic",
+]
+
[[package]]
name = "powerfmt"
version = "0.2.0"
@@ -1134,9 +1233,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.101"
+version = "1.0.102"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
+checksum = "8e0f6df8eaa422d97d72edcd152e1451618fed47fabbdbd5a8864167b1d4aff7"
dependencies = [
"unicode-ident",
]
@@ -1176,6 +1275,17 @@ dependencies = [
"crossbeam-utils",
]
+[[package]]
+name = "redox_users"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"
+dependencies = [
+ "getrandom 0.2.16",
+ "libredox",
+ "thiserror",
+]
+
[[package]]
name = "regex"
version = "1.12.2"
@@ -1424,9 +1534,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
-version = "2.0.107"
+version = "2.0.108"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a26dbd934e5451d21ef060c018dae56fc073894c5a7896f882928a76e6d081b"
+checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917"
dependencies = [
"proc-macro2",
"quote",
@@ -1475,6 +1585,26 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683"
+[[package]]
+name = "thiserror"
+version = "2.0.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8"
+dependencies = [
+ "thiserror-impl",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "2.0.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
[[package]]
name = "time"
version = "0.3.44"
@@ -2019,9 +2149,12 @@ dependencies = [
"clap_complete",
"config",
"criterion",
+ "directories",
+ "env_logger",
"etcetera",
"insta",
"insta-cmd",
+ "log",
"rayon",
"regex",
"rstest",
diff --git a/Cargo.toml b/Cargo.toml
index 85da73949..ac1a669a4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,7 +24,10 @@ chrono = "0.4"
clap = { version = "4.5", features = ["derive"] }
clap_complete = "4.5"
config = "0.15"
+directories = "6.0"
+env_logger = "0.11"
etcetera = "0.10"
+log = "0.4"
rayon = "1.11"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
diff --git a/src/git.rs b/src/git.rs
index fc42de55b..c820d052e 100644
--- a/src/git.rs
+++ b/src/git.rs
@@ -529,16 +529,40 @@ impl Repository {
cmd.args(args);
cmd.current_dir(&self.path);
+ // Log: $ git <args> [worktree]
+ // TODO: Guard with log::log_enabled! if args.join() overhead becomes measurable
+ if self.path.to_str() == Some(".") {
+ log::debug!("$ git {}", args.join(" "));
+ } else {
+ let worktree = self
+ .path
+ .file_name()
+ .and_then(|n| n.to_str())
+ .unwrap_or("?");
+ log::debug!("$ git {} [{}]", args.join(" "), worktree);
+ }
+
let output = cmd
.output()
.map_err(|e| GitError::CommandFailed(e.to_string()))?;
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
+ // Log errors with ! prefix
+ for line in stderr.trim().lines() {
+ log::debug!(" ! {}", line);
+ }
return Err(GitError::CommandFailed(stderr.into_owned()));
}
- Ok(String::from_utf8_lossy(&output.stdout).into_owned())
+ let stdout = String::from_utf8_lossy(&output.stdout).into_owned();
+ if !stdout.is_empty() {
+ // Log output indented
+ for line in stdout.trim().lines() {
+ log::debug!(" {}", line);
+ }
+ }
+ Ok(stdout)
}
/// Run a git command and return whether it succeeded (exit code 0).
@@ -559,11 +583,27 @@ impl Repository {
cmd.args(args);
cmd.current_dir(&self.path);
+ // Log: $ git <args> [worktree]
+ if self.path.to_str() == Some(".") {
+ log::debug!("$ git {}", args.join(" "));
+ } else {
+ let worktree = self
+ .path
+ .file_name()
+ .and_then(|n| n.to_str())
+ .unwrap_or("?");
+ log::debug!("$ git {} [{}]", args.join(" "), worktree);
+ }
+
let output = cmd
.output()
.map_err(|e| GitError::CommandFailed(e.to_string()))?;
- Ok(output.status.success())
+ let success = output.status.success();
+ if !success {
+ log::debug!(" → exit code: non-zero");
+ }
+ Ok(success)
}
}
diff --git a/src/llm.rs b/src/llm.rs
index 7065d460e..cf53d1e1a 100644
--- a/src/llm.rs
+++ b/src/llm.rs
@@ -109,6 +109,12 @@ fn try_generate_commit_message(
prompt.push_str("</git-info>\n\n");
// Execute LLM command
+ log::debug!("$ {} {}", command, args.join(" "));
+ log::debug!(" System: {}", user_instruction);
+ for line in prompt.lines() {
+ log::debug!(" {}", line);
+ }
+
let output = process::Command::new(command)
.args(args)
.arg("--system")
@@ -181,6 +187,12 @@ fn try_generate_llm_message(
let full_prompt = format!("{}\n\n{}", context, prompt);
// Execute LLM command with prompt via stdin
+ log::debug!("$ {} {}", command, args.join(" "));
+ log::debug!(" Prompt (stdin):");
+ for line in full_prompt.lines() {
+ log::debug!(" {}", line);
+ }
+
let mut child = process::Command::new(command)
.args(args)
.stdin(Stdio::piped())
diff --git a/src/main.rs b/src/main.rs
index f5e2133a4..adefe43fa 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -31,6 +31,10 @@ pub enum OutputFormat {
#[command(version = env!("VERGEN_GIT_DESCRIBE"))]
#[command(disable_help_subcommand = true)]
struct Cli {
+ /// Enable verbose output (show git commands and debug info)
+ #[arg(long, short = 'v', global = true)]
+ verbose: bool,
+
#[command(subcommand)]
command: Commands,
}
@@ -184,6 +188,62 @@ enum Commands {
fn main() {
let cli = Cli::parse();
+ // Configure logging based on --verbose flag or RUST_LOG env var
+ env_logger::Builder::from_env(
+ env_logger::Env::default().default_filter_or(if cli.verbose { "debug" } else { "off" }),
+ )
+ .format(|buf, record| {
+ use anstyle::Style;
+ use std::io::Write;
+
+ let msg = record.args().to_string();
+
+ // Map thread ID to a single character (a-z, then A-Z)
+ let thread_id = format!("{:?}", std::thread::current().id());
+ let thread_num = thread_id
+ .strip_prefix("ThreadId(")
+ .and_then(|s| s.strip_suffix(")"))
+ .and_then(|s| s.parse::<usize>().ok())
+ .map(|n| {
+ if n <= 26 {
+ char::from(b'a' + (n - 1) as u8)
+ } else if n <= 52 {
+ char::from(b'A' + (n - 27) as u8)
+ } else {
+ '?'
+ }
+ })
+ .unwrap_or('?');
+
+ let dim = Style::new().dimmed();
+
+ // Commands start with $, make only the command bold (not $ or [worktree])
+ if let Some(rest) = msg.strip_prefix("$ ") {
+ let bold = Style::new().bold();
+
+ // Split: "git command [worktree]" -> ("git command", " [worktree]")
+ if let Some(bracket_pos) = rest.find(" [") {
+ let command = &rest[..bracket_pos];
+ let worktree = &rest[bracket_pos..];
+ writeln!(
+ buf,
+ "{dim}[{thread_num}]{dim:#} $ {bold}{command}{bold:#}{worktree}"
+ )
+ } else {
+ writeln!(buf, "{dim}[{thread_num}]{dim:#} $ {bold}{rest}{bold:#}")
+ }
+ } else if msg.starts_with(" ! ") {
+ // Error output - show in red
+ use anstyle::{AnsiColor, Color};
+ let red = Style::new().fg_color(Some(Color::Ansi(AnsiColor::Red)));
+ writeln!(buf, "{dim}[{thread_num}]{dim:#} {red}{msg}{red:#}")
+ } else {
+ // Regular output with thread ID
+ writeln!(buf, "{dim}[{thread_num}]{dim:#} {msg}")
+ }
+ })
+ .init();
+
let result = match cli.command {
Commands::Init { shell, cmd } => {
let mut cli_cmd = Cli::command();
diff --git a/tests/snapshots/integration__integration_tests__init__init_bash.snap b/tests/snapshots/integration__integration_tests__init__init_bash.snap
index d4c5cdd6b..1e67b1732 100644
--- a/tests/snapshots/integration__integration_tests__init__init_bash.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_bash.snap
@@ -165,7 +165,7 @@ _wt() {
case "${cmd}" in
wt)
- opts="-h -V --help --version init configure-shell config list switch remove push merge completion complete"
+ opts="-v -h -V --verbose --help --version init configure-shell config list switch remove push merge completion complete"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -179,7 +179,7 @@ _wt() {
return 0
;;
wt__complete)
- opts="-h --help [ARGS]..."
+ opts="-v -h --verbose --help [ARGS]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -193,7 +193,7 @@ _wt() {
return 0
;;
wt__completion)
- opts="-h --help bash elvish fish nushell oil powershell xonsh zsh"
+ opts="-v -h --verbose --help bash elvish fish nushell oil powershell xonsh zsh"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -207,7 +207,7 @@ _wt() {
return 0
;;
wt__config)
- opts="-h --help init list"
+ opts="-v -h --verbose --help init list"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -221,7 +221,7 @@ _wt() {
return 0
;;
wt__config__init)
- opts="-h --help"
+ opts="-v -h --verbose --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -235,7 +235,7 @@ _wt() {
return 0
;;
wt__config__list)
- opts="-h --help"
+ opts="-v -h --verbose --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -249,7 +249,7 @@ _wt() {
return 0
;;
wt__configure__shell)
- opts="-y -h --shell --cmd --yes --help"
+ opts="-y -v -h --shell --cmd --yes --verbose --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -271,7 +271,7 @@ _wt() {
return 0
;;
wt__init)
- opts="-h --cmd --help <SHELL>"
+ opts="-v -h --cmd --verbose --help <SHELL>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -289,7 +289,7 @@ _wt() {
return 0
;;
wt__list)
- opts="-h --format --branches --help"
+ opts="-v -h --format --branches --verbose --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -307,7 +307,7 @@ _wt() {
return 0
;;
wt__merge)
- opts="-s -k -m -f -h --squash --keep --message --no-verify --force --help [TARGET]"
+ opts="-s -k -m -f -v -h --squash --keep --message --no-verify --force --verbose --help [TARGET]"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -329,7 +329,7 @@ _wt() {
return 0
;;
wt__push)
- opts="-h --allow-merge-commits --help [TARGET]"
+ opts="-v -h --allow-merge-commits --verbose --help [TARGET]"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -343,7 +343,7 @@ _wt() {
return 0
;;
wt__remove)
- opts="-h --help"
+ opts="-v -h --verbose --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -357,7 +357,7 @@ _wt() {
return 0
;;
wt__switch)
- opts="-c -b -x -f -h --create --base --execute --force --no-config-commands --help <BRANCH>"
+ opts="-c -b -x -f -v -h --create --base --execute --force --no-config-commands --verbose --help <BRANCH>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
diff --git a/tests/snapshots/integration__integration_tests__init__init_bash_custom_prefix.snap b/tests/snapshots/integration__integration_tests__init__init_bash_custom_prefix.snap
index 44a5ad96b..bf6f7430c 100644
--- a/tests/snapshots/integration__integration_tests__init__init_bash_custom_prefix.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_bash_custom_prefix.snap
@@ -167,7 +167,7 @@ _wt() {
case "${cmd}" in
wt)
- opts="-h -V --help --version init configure-shell config list switch remove push merge completion complete"
+ opts="-v -h -V --verbose --help --version init configure-shell config list switch remove push merge completion complete"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -181,7 +181,7 @@ _wt() {
return 0
;;
wt__complete)
- opts="-h --help [ARGS]..."
+ opts="-v -h --verbose --help [ARGS]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -195,7 +195,7 @@ _wt() {
return 0
;;
wt__completion)
- opts="-h --help bash elvish fish nushell oil powershell xonsh zsh"
+ opts="-v -h --verbose --help bash elvish fish nushell oil powershell xonsh zsh"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -209,7 +209,7 @@ _wt() {
return 0
;;
wt__config)
- opts="-h --help init list"
+ opts="-v -h --verbose --help init list"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -223,7 +223,7 @@ _wt() {
return 0
;;
wt__config__init)
- opts="-h --help"
+ opts="-v -h --verbose --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -237,7 +237,7 @@ _wt() {
return 0
;;
wt__config__list)
- opts="-h --help"
+ opts="-v -h --verbose --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -251,7 +251,7 @@ _wt() {
return 0
;;
wt__configure__shell)
- opts="-y -h --shell --cmd --yes --help"
+ opts="-y -v -h --shell --cmd --yes --verbose --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -273,7 +273,7 @@ _wt() {
return 0
;;
wt__init)
- opts="-h --cmd --help <SHELL>"
+ opts="-v -h --cmd --verbose --help <SHELL>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -291,7 +291,7 @@ _wt() {
return 0
;;
wt__list)
- opts="-h --format --branches --help"
+ opts="-v -h --format --branches --verbose --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -309,7 +309,7 @@ _wt() {
return 0
;;
wt__merge)
- opts="-s -k -m -f -h --squash --keep --message --no-verify --force --help [TARGET]"
+ opts="-s -k -m -f -v -h --squash --keep --message --no-verify --force --verbose --help [TARGET]"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -331,7 +331,7 @@ _wt() {
return 0
;;
wt__push)
- opts="-h --allow-merge-commits --help [TARGET]"
+ opts="-v -h --allow-merge-commits --verbose --help [TARGET]"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -345,7 +345,7 @@ _wt() {
return 0
;;
wt__remove)
- opts="-h --help"
+ opts="-v -h --verbose --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -359,7 +359,7 @@ _wt() {
return 0
;;
wt__switch)
- opts="-c -b -x -f -h --create --base --execute --force --no-config-commands --help <BRANCH>"
+ opts="-c -b -x -f -v -h --create --base --execute --force --no-config-commands --verbose --help <BRANCH>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
diff --git a/tests/snapshots/integration__integration_tests__init__init_fish.snap b/tests/snapshots/integration__integration_tests__init__init_fish.snap
index 69ce31e31..43e1e90ee 100644
--- a/tests/snapshots/integration__integration_tests__init__init_fish.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_fish.snap
@@ -112,7 +112,7 @@ end
# Static completions (commands and flags)
# Print an optspec for argparse to handle cmd's options that are independent of any subcommand.
function __fish_wt_global_optspecs
- string join \n h/help V/version
+ string join \n v/verbose h/help V/version
end
function __fish_wt_needs_command
@@ -136,6 +136,7 @@ function __fish_wt_using_subcommand
contains -- $cmd[1] $argv
end
+complete -c wt -n "__fish_wt_needs_command" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_needs_command" -s h -l help -d 'Print help'
complete -c wt -n "__fish_wt_needs_command" -s V -l version -d 'Print version'
complete -c wt -n "__fish_wt_needs_command" -f -a "init" -d 'Generate shell integration code'
@@ -147,6 +148,7 @@ complete -c wt -n "__fish_wt_needs_command" -f -a "remove" -d 'Finish current wo
complete -c wt -n "__fish_wt_needs_command" -f -a "push" -d 'Push changes between worktrees'
complete -c wt -n "__fish_wt_needs_command" -f -a "merge" -d 'Merge worktree into target branch'
complete -c wt -n "__fish_wt_using_subcommand init" -l cmd -d 'Command prefix (default: wt)' -r
+complete -c wt -n "__fish_wt_using_subcommand init" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand init" -s h -l help -d 'Print help'
complete -c wt -n "__fish_wt_using_subcommand configure-shell" -l shell -d 'Specific shell to configure (default: all shells with existing config files)' -r -f -a "bash\t''
elvish\t''
@@ -158,32 +160,43 @@ xonsh\t''
zsh\t''"
complete -c wt -n "__fish_wt_using_subcommand configure-shell" -l cmd -d 'Command prefix (default: wt)' -r
complete -c wt -n "__fish_wt_using_subcommand configure-shell" -s y -l yes -d 'Skip confirmation prompt'
+complete -c wt -n "__fish_wt_using_subcommand configure-shell" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand configure-shell" -s h -l help -d 'Print help'
+complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list" -s h -l help -d 'Print help'
complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list" -f -a "init" -d 'Initialize global configuration file with examples'
complete -c wt -n "__fish_wt_using_subcommand config; and not __fish_seen_subcommand_from init list" -f -a "list" -d 'List all configuration files and their locations'
+complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from init" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from init" -s h -l help -d 'Print help'
+complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from list" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand config; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help'
complete -c wt -n "__fish_wt_using_subcommand list" -l format -d 'Output format' -r -f -a "table\t'Human-readable table format'
json\t'JSON format'"
complete -c wt -n "__fish_wt_using_subcommand list" -l branches -d 'Also display branches that don\'t have worktrees'
+complete -c wt -n "__fish_wt_using_subcommand list" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand list" -s h -l help -d 'Print help (see more with \'--help\')'
complete -c wt -n "__fish_wt_using_subcommand switch" -s b -l base -d 'Base branch to create from (only with --create)' -r
complete -c wt -n "__fish_wt_using_subcommand switch" -s x -l execute -d 'Execute command after switching' -r
complete -c wt -n "__fish_wt_using_subcommand switch" -s c -l create -d 'Create a new branch'
complete -c wt -n "__fish_wt_using_subcommand switch" -s f -l force -d 'Skip confirmation prompt'
complete -c wt -n "__fish_wt_using_subcommand switch" -l no-config-commands -d 'Skip executing post-start commands from project config'
+complete -c wt -n "__fish_wt_using_subcommand switch" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand switch" -s h -l help -d 'Print help'
+complete -c wt -n "__fish_wt_using_subcommand remove" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand remove" -s h -l help -d 'Print help'
complete -c wt -n "__fish_wt_using_subcommand push" -l allow-merge-commits -d 'Allow pushing merge commits (non-linear history)'
+complete -c wt -n "__fish_wt_using_subcommand push" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand push" -s h -l help -d 'Print help'
complete -c wt -n "__fish_wt_using_subcommand merge" -s m -l message -d 'Custom instruction for commit message generation' -r
complete -c wt -n "__fish_wt_using_subcommand merge" -s s -l squash -d 'Squash all commits into one before merging'
complete -c wt -n "__fish_wt_using_subcommand merge" -s k -l keep -d 'Keep worktree after merging (don\'t remove)'
complete -c wt -n "__fish_wt_using_subcommand merge" -l no-verify -d 'Skip pre-merge checks'
complete -c wt -n "__fish_wt_using_subcommand merge" -s f -l force -d 'Skip approval prompts for commands'
+complete -c wt -n "__fish_wt_using_subcommand merge" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand merge" -s h -l help -d 'Print help'
+complete -c wt -n "__fish_wt_using_subcommand completion" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand completion" -s h -l help -d 'Print help'
+complete -c wt -n "__fish_wt_using_subcommand complete" -s v -l verbose -d 'Enable verbose output (show git commands and debug info)'
complete -c wt -n "__fish_wt_using_subcommand complete" -s h -l help -d 'Print help'
----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__init__init_zsh.snap b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
index 7ef6cf154..d688c176a 100644
--- a/tests/snapshots/integration__integration_tests__init__init_zsh.snap
+++ b/tests/snapshots/integration__integration_tests__init__init_zsh.snap
@@ -121,6 +121,8 @@ _wt() {
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" : \
+'-v[Enable verbose output (show git commands and debug info)]' \
+'--verbose[Enable verbose output (show git commands and debug info)]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
@@ -137,6 +139,8 @@ _wt() {
(init)
_arguments "${_arguments_options[@]}" : \
'--cmd=[Command prefix (default\: wt)]:CMD:_default' \
+'-v[Enable verbose output (show git commands and debug info)]' \
+'--verbose[Enable verbose output (show git commands and debug info)]' \
'-h[Print help]' \
'--help[Print help]' \
':shell -- Shell to generate code for (bash, fish, zsh):_default' \
@@ -148,12 +152,16 @@ _arguments "${_arguments_options[@]}" : \
'--cmd=[Command prefix (default\: wt)]:CMD:_default' \
'-y[Skip confirmation prompt]' \
'--yes[Skip confirmation prompt]' \
+'-v[Enable verbose output (show git commands and debug info)]' \
+'--verbose[Enable verbose output (show git commands and debug info)]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(config)
_arguments "${_arguments_options[@]}" : \
+'-v[Enable verbose output (show git commands and debug info)]' \
+'--verbose[Enable verbose output (show git commands and debug info)]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_wt__config_commands" \
@@ -168,12 +176,16 @@ _arguments "${_arguments_options[@]}" : \
case $line[1] in
(init)
_arguments "${_arguments_options[@]}" : \
+'-v[Enable verbose output (show git commands and debug info)]' \
+'--verbose[Enable verbose output (show git commands and debug info)]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" : \
+'-v[Enable verbose output (show git commands and debug info)]' \
+'--verbose[Enable verbose output (show git commands and debug info)]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
@@ -187,6 +199,8 @@ _arguments "${_arguments_options[@]}" : \
'--format=[Output format]:FORMAT:((table\:"Human-readable table format"
json\:"JSON format"))' \
'--branches[Also display branches that don'\''t have worktrees]' \
+'-v[Enable verbose output (show git commands and debug info)]' \
+'--verbose[Enable verbose output (show git commands and debug info)]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
@@ -202,6 +216,8 @@ _arguments "${_arguments_options[@]}" : \
'-f[Skip confirmation prompt]' \
'--force[Skip confirmation prompt]' \
'--no-config-commands[Skip executing post-start commands from project config]' \
+'-v[Enable verbose output (show git commands and debug info)]' \
+'--verbose[Enable verbose output (show git commands and debug info)]' \
'-h[Print help]' \
'--help[Print help]' \
':branch -- Branch name or worktree path:_default' \
@@ -209,6 +225,8 @@ _arguments "${_arguments_options[@]}" : \
;;
(remove)
_arguments "${_arguments_options[@]}" : \
+'-v[Enable verbose output (show git commands and debug info)]' \
+'--verbose[Enable verbose output (show git commands and debug info)]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
@@ -216,6 +234,8 @@ _arguments "${_arguments_options[@]}" : \
(push)
_arguments "${_arguments_options[@]}" : \
'--allow-merge-commits[Allow pushing merge commits (non-linear history)]' \
+'-v[Enable verbose output (show git commands and debug info)]' \
+'--verbose[Enable verbose output (show git commands and debug info)]' \
'-h[Print help]' \
'--help[Print help]' \
'::target -- Target branch (defaults to default branch):_default' \
@@ -232,6 +252,8 @@ _arguments "${_arguments_options[@]}" : \
'--no-verify[Skip pre-merge checks]' \
'-f[Skip approval prompts for commands]' \
'--force[Skip approval prompts for commands]' \
+'-v[Enable verbose output (show git commands and debug info)]' \
+'--verbose[Enable verbose output (show git commands and debug info)]' \
'-h[Print help]' \
'--help[Print help]' \
'::target -- Target branch to merge into (defaults to default branch):_default' \
@@ -239,6 +261,8 @@ _arguments "${_arguments_options[@]}" : \
;;
(completion)
_arguments "${_arguments_options[@]}" : \
+'-v[Enable verbose output (show git commands and debug info)]' \
+'--verbose[Enable verbose output (show git commands and debug info)]' \
'-h[Print help]' \
'--help[Print help]' \
':shell -- Shell to generate completions for:(bash elvish fish nushell oil powershell xonsh zsh)' \
@@ -246,6 +270,8 @@ _arguments "${_arguments_options[@]}" : \
;;
(complete)
_arguments "${_arguments_options[@]}" : \
+'-v[Enable verbose output (show git commands and debug info)]' \
+'--verbose[Enable verbose output (show git commands and debug info)]' \
'-h[Print help]' \
'--help[Print help]' \
'*::args -- Arguments to complete:_default' \