Skip to content

Commit 65c6232

Browse files
committed
fix: Open when in a git repo, but no remote
1 parent c950284 commit 65c6232

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "magic-opener"
3-
version = "0.3.2"
3+
version = "0.3.3"
44
edition = "2024"
55
description = "An 'open' replacement that tries to do the right thing."
66
readme = "README.md"

src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ fn main() {
6161
let remote_path = match GitRepository::url(&current_dir, &paths) {
6262
Ok(url) => url,
6363
Err(RepositoryError::NoSuchRemote(_)) => {
64-
println!("Found a Git repository, but no remote URL is set.");
64+
debug!("Found a Git repository, but no remote URL is set.");
6565
current_dir.clone()
6666
}
6767
Err(e) => {
68-
println!("Unknown error while trying to get remote URL: {e}");
68+
eprintln!("Unknown error while trying to get remote URL: {e}");
6969
return;
7070
}
7171
};
@@ -114,13 +114,13 @@ fn main() {
114114
return;
115115
}
116116

117-
let mut args = vec![remote_path.as_str()];
118-
119-
if remote_path.contains("://") {
120-
args.insert(0, "--background");
121-
}
117+
let args = if remote_path.contains("://") {
118+
vec!["--background".to_string(), remote_path]
119+
} else {
120+
paths
121+
};
122122

123-
debug!("Opening with args: {:?}", args);
123+
debug!("Opening with args: {args:?}");
124124

125125
let _ = Command::new(OPEN).args(&args).exec();
126126
}

0 commit comments

Comments
 (0)