Skip to content

Commit 436f63d

Browse files
committed
Allow -nt option anywhere in arguments
1 parent fb70ab2 commit 436f63d

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
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 = "exifgeo"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
edition = "2021"
55

66
[profile.release]

src/main.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,22 @@ impl ThumbMode {
4747
}
4848

4949
fn main() -> ExitCode {
50-
let dir = env::args_os()
51-
.nth(1)
52-
.map(PathBuf::from)
53-
.filter(|path| path.is_dir());
50+
let mut args: Vec<_> = env::args_os().skip(1).collect();
51+
let thumb_mode = if let Some(index) = args.iter().position(|arg| arg == "-nt") {
52+
args.remove(index);
53+
ThumbMode::None
54+
} else {
55+
ThumbMode::Exif
56+
};
57+
58+
let dir = args.first().map(PathBuf::from).filter(|path| path.is_dir());
5459
if dir.is_none() {
55-
eprintln!("Usage: exifgeo <directory>");
60+
eprintln!("Usage: exifgeo [-nt] <directory>");
61+
eprintln!(" -nt No thumbnails");
5662
return ExitCode::FAILURE;
5763
}
5864

5965
let thumbs_dir = "thumbs";
60-
let thumb_mode = ThumbMode::Exif;
6166
if let Err(e) = thumb_mode.create_dir(thumbs_dir) {
6267
eprintln!("Could not create {} directory: {}", thumbs_dir, e);
6368
return ExitCode::FAILURE;

0 commit comments

Comments
 (0)