summaryrefslogtreecommitdiff
path: root/src/cli.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli.rs')
-rw-r--r--src/cli.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 909bcf0..07a7c7d 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -1289,9 +1289,18 @@ impl Opt {
}
}
- pub fn from_args_and_git_config(env: &DeltaEnv, assets: HighlightingAssets) -> Call<Self> {
- let args = std::env::args_os().collect::<Vec<_>>();
-
+ pub fn from_args_and_git_config(
+ args: Vec<OsString>,
+ env: &DeltaEnv,
+ assets: HighlightingAssets,
+ ) -> Call<Self> {
+ #[cfg(test)]
+ // Set argv[0] when called in tests:
+ let args = {
+ let mut args = args;
+ args.insert(0, OsString::from("delta"));
+ args
+ };
let matches = match Self::handle_help_and_version(&args) {
Call::Delta(t) => t,
msg => {