summaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/args.rs5
-rw-r--r--helix-term/src/main.rs2
2 files changed, 7 insertions, 0 deletions
diff --git a/helix-term/src/args.rs b/helix-term/src/args.rs
index d16d7dfd..48c86633 100644
--- a/helix-term/src/args.rs
+++ b/helix-term/src/args.rs
@@ -14,6 +14,7 @@ pub struct Args {
pub build_grammars: bool,
pub split: Option<Layout>,
pub verbosity: u64,
+ pub log_file: Option<PathBuf>,
pub config_file: Option<PathBuf>,
pub files: Vec<(PathBuf, Position)>,
}
@@ -48,6 +49,10 @@ impl Args {
Some(path) => args.config_file = Some(path.into()),
None => anyhow::bail!("--config must specify a path to read"),
},
+ "--log" => match argv.next().as_deref() {
+ Some(path) => args.log_file = Some(path.into()),
+ None => anyhow::bail!("--log must specify a path to write"),
+ },
arg if arg.starts_with("--") => {
anyhow::bail!("unexpected double dash argument: {}", arg)
}
diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs
index d21d3e77..726bf9e3 100644
--- a/helix-term/src/main.rs
+++ b/helix-term/src/main.rs
@@ -67,6 +67,7 @@ FLAGS:
-g, --grammar {{fetch|build}} Fetches or builds tree-sitter grammars listed in languages.toml
-c, --config <file> Specifies a file to use for configuration
-v Increases logging verbosity each use for up to 3 times
+ --log Specifies a file to use for logging
(default file: {})
-V, --version Prints version information
--vsplit Splits all given files vertically into different windows
@@ -114,6 +115,7 @@ FLAGS:
return Ok(0);
}
+ let logpath = args.log_file.as_ref().cloned().unwrap_or(logpath);
setup_logging(logpath, args.verbosity).context("failed to initialize logging")?;
let config_dir = helix_loader::config_dir();