mirror of
https://github.com/sayanarijit/xplr
synced 2024-11-04 18:00:14 +00:00
Implement --force-focus
This commit is contained in:
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"###;
|
||||
|
12
src/cli.rs
12
src/cli.rs
@ -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…
Reference in New Issue
Block a user