Implement --force-focus

pull/395/head
Tom van Dijk 3 years ago committed by Arijit Basu
parent 3c8de699ca
commit 44f05c6e4b

@ -27,7 +27,8 @@ fn main() {
"$HOME/.config/xplr/init.lua")
-C, --extra-config <PATH>... Specifies extra config files to load
--on-load <MESSAGE>... Sends messages when xplr loads
--select <FILE> Selects the given paths."###;
--select <FILE> Selects the given paths.
--force-focus Focuses the given path, instead of entering it."###;
let args = r###"
<PATH> Path to focus on, or enter if directory"###;

@ -87,6 +87,18 @@ impl Cli {
}
}
"--force-focus" => {
let path = cli
.path
.as_ref()
.map(|x| x.clone())
.or(args.pop_front().map(PathBuf::from))
.unwrap_or(PathBuf::new());
cli.on_load.push(app::ExternalMsg::FocusPath(
path.to_string_lossy().to_string(),
));
}
// path
path => {
if cli.path.is_none() {

Loading…
Cancel
Save