diff --git a/docs/cli.md b/docs/cli.md index 8a769cfe..db089710 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -68,6 +68,7 @@ prek install [OPTIONS] [HOOK|PROJECT]...
--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
--hook-type, -t hook-type--install-hooksCreate hook environments for all hooks used in the config file
+--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--overwrite, -fOverwrite existing hooks
@@ -133,6 +134,7 @@ prek install-hooks [OPTIONS] [HOOK|PROJECT]...never: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
+--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qUse quiet output.
@@ -216,6 +218,7 @@ prek run [OPTIONS] [HOOK|PROJECT]...pre-rebaseprepare-commit-msg--last-commitRun hooks against the last commit. Equivalent to --from-ref HEAD~1 --to-ref HEAD
--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qUse quiet output.
@@ -317,7 +320,8 @@ prek list [OPTIONS] [HOOK|PROJECT]...pygrepscriptsystem--no-progressHide all progress outputs.
+--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--output-format output-formatThe output format
[default: text]
Possible values:
@@ -366,7 +370,8 @@ prek uninstall [OPTIONS]never: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
---hook-type, -t hook-type--no-progressHide all progress outputs.
+--hook-type, -t hook-type--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qUse quiet output.
Repeating this option, e.g., -qq, will enable a silent mode in which prek will write no output to stdout.
never: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
+--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qUse quiet output.
@@ -436,6 +442,7 @@ prek validate-manifest [OPTIONS] [MANIFEST]...never: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
+--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qUse quiet output.
@@ -467,6 +474,7 @@ prek sample-config [OPTIONS]--config, -c configPath to alternate config file
--file, -f fileWrite the sample config to a file (.pre-commit-config.yaml by default)
--help, -hDisplay the concise help for this command
+--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qUse quiet output.
@@ -501,7 +509,8 @@ prek auto-update [OPTIONS]--freezeStore "frozen" hashes in rev instead of tag names
--help, -hDisplay the concise help for this command
--jobs, -j jobsNumber of threads to use
-[default: 3]
--no-progressHide all progress outputs.
+[default: 3]
--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qUse quiet output.
Repeating this option, e.g., -qq, will enable a silent mode in which prek will write no output to stdout.
never: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
+--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qUse quiet output.
@@ -579,6 +589,7 @@ prek cache gc [OPTIONS]never: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
+--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qUse quiet output.
@@ -609,6 +620,7 @@ prek cache clean [OPTIONS]never: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
+--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qUse quiet output.
@@ -657,7 +669,8 @@ prek init-template-dir [OPTIONS]pre-pushpre-rebaseprepare-commit-msg--no-allow-missing-configAssume cloned repos should have a pre-commit config
--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-allow-missing-configAssume cloned repos should have a pre-commit config
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qUse quiet output.
@@ -727,6 +740,7 @@ prek try-repo [OPTIONS] [HOOK|PROJECT]...pre-rebaseprepare-commit-msg--last-commitRun hooks against the last commit. Equivalent to --from-ref HEAD~1 --to-ref HEAD
--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qUse quiet output.
@@ -793,6 +807,7 @@ prek self update [OPTIONS] [TARGET_VERSION]never: Disables colored output--config, -c configPath to alternate config file
--help, -hDisplay the concise help for this command
+--log-file log-fileWrite trace logs to the specified file. If not specified, trace logs will be written to $PREK_HOME/prek.log
--no-progressHide all progress outputs.
For example, spinners or progress bars.
--quiet, -qUse quiet output.
diff --git a/src/cli/mod.rs b/src/cli/mod.rs index c549ab18..ec2dbb34 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -174,6 +174,15 @@ pub(crate) struct GlobalArgs { #[arg(global = true, short, long, action = ArgAction::Count)] pub(crate) verbose: u8, + /// Write trace logs to the specified file. + /// If not specified, trace logs will be written to `$PREK_HOME/prek.log`. + #[arg(global = true, long, value_name = "LOG_FILE", value_hint = ValueHint::FilePath)] + pub(crate) log_file: Option