Skip to content

Commit

Permalink
added --folder flag
Browse files Browse the repository at this point in the history
  • Loading branch information
rachancheet committed Mar 1, 2024
1 parent 8f22e6d commit edce14e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions wayshot/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ pub struct Cli {
/// Present a fuzzy selector for output/display selection
#[arg(long, alias = "chooseoutput", conflicts_with_all = ["slurp", "output"])]
pub choose_output: bool,

/// Arguments to call slurp with for selecting a region
#[arg(short, long, value_name = "folder")]
pub folder: Option<PathBuf>,
}
14 changes: 13 additions & 1 deletion wayshot/src/wayshot.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{
io::{stdout, BufWriter, Cursor, Write},
path::PathBuf,
process::Command,
};

Expand Down Expand Up @@ -60,7 +61,18 @@ fn main() -> Result<()> {
Some(pathbuf)
}
}
None => Some(utils::get_default_file_name(requested_encoding)),
None => {
let mut temp = PathBuf::new();
match cli.folder {
Some(path) => {
temp.push(path);
}
None => {}
}

temp.push(utils::get_default_file_name(requested_encoding));
Some(temp)
}
};

let wayshot_conn = WayshotConnection::new()?;
Expand Down

0 comments on commit edce14e

Please sign in to comment.