mirror of
https://github.com/itsjunetime/tdf.git
synced 2026-06-02 08:01:47 -04:00
Add --version flag
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- Add `--version` flag
|
||||||
|
|
||||||
# v0.4.1
|
# v0.4.1
|
||||||
|
|
||||||
- Add instructions for using new zoom/pan features to help page
|
- Add instructions for using new zoom/pan features to help page
|
||||||
|
|||||||
+15
-3
@@ -74,12 +74,24 @@ async fn main() -> Result<(), WrappedErr> {
|
|||||||
optional -w,--white-color white: String
|
optional -w,--white-color white: String
|
||||||
/// Custom black color, specified in css format (e.g "000000" or "rgb(0, 0, 0)")
|
/// Custom black color, specified in css format (e.g "000000" or "rgb(0, 0, 0)")
|
||||||
optional -b,--black-color black: String
|
optional -b,--black-color black: String
|
||||||
|
/// Print the version and exit
|
||||||
|
optional --version
|
||||||
/// PDF file to read
|
/// PDF file to read
|
||||||
required file: PathBuf
|
optional file: PathBuf
|
||||||
};
|
};
|
||||||
|
|
||||||
let path = flags
|
if flags.version {
|
||||||
.file
|
println!("{}", env!("CARGO_PKG_VERSION"));
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
let Some(file) = flags.file else {
|
||||||
|
return Err(WrappedErr(
|
||||||
|
"Please specify the file to open, e.g. `tdf ./my_example_pdf.pdf`".into()
|
||||||
|
));
|
||||||
|
};
|
||||||
|
|
||||||
|
let path = file
|
||||||
.canonicalize()
|
.canonicalize()
|
||||||
.map_err(|e| WrappedErr(format!("Cannot canonicalize provided file: {e}").into()))?;
|
.map_err(|e| WrappedErr(format!("Cannot canonicalize provided file: {e}").into()))?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user