summaryrefslogtreecommitdiffstats
path: root/src/verb
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2022-06-18 07:47:22 +0200
committerCanop <cano.petrole@gmail.com>2022-06-18 07:47:22 +0200
commit46b3e1ca6d7139cc266f9ab9bdaa62cdb879f75f (patch)
treeea56453916b3b0cb92fff916cd3724179852b2d1 /src/verb
parentaabc38a9fe5b6f8a60105a2878f71f8424d22ce9 (diff)
parente757dfec3a878ae2f2745854175823cbb0ce2ccb (diff)
Merge branch 'issue-#535-ProgramNotFoundWindows' of github.com:Spacelord-XaN/broot into Spacelord-XaN-issue-#535-ProgramNotFoundWindows
Diffstat (limited to 'src/verb')
-rw-r--r--src/verb/builtin.rs48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/verb/builtin.rs b/src/verb/builtin.rs
index d626a1a..889c17d 100644
--- a/src/verb/builtin.rs
+++ b/src/verb/builtin.rs
@@ -101,12 +101,20 @@ pub fn builtin_verbs() -> Vec<Verb> {
internal(close_panel_ok),
internal(close_panel_cancel)
.with_key(key!(ctrl-w)),
+ #[cfg(unix)]
external(
"copy {newpath}",
"cp -r {file} {newpath:path-from-parent}",
StayInBroot,
)
.with_shortcut("cp"),
+ #[cfg(windows)]
+ external(
+ "copy {newpath}",
+ "xcopy /Q /H /Y /I {file} {newpath:path-from-parent}",
+ StayInBroot,
+ )
+ .with_shortcut("cp"),
#[cfg(feature = "clipboard")]
internal(copy_line)
.with_key(key!(alt-c)),
@@ -133,24 +141,49 @@ pub fn builtin_verbs() -> Vec<Verb> {
#[cfg(feature="clipboard")]
internal(input_paste)
.with_key(key!(ctrl-v)),
+ #[cfg(unix)]
external(
"mkdir {subpath}",
"mkdir -p {subpath:path-from-directory}",
StayInBroot,
)
.with_shortcut("md"),
+ #[cfg(windows)]
+ external(
+ "mkdir {subpath}",
+ "cmd /c mkdir {subpath:path-from-directory}",
+ StayInBroot,
+ )
+ .with_shortcut("md"),
+ #[cfg(unix)]
external(
"move {newpath}",
"mv {file} {newpath:path-from-parent}",
StayInBroot,
)
.with_shortcut("mv"),
+ #[cfg(windows)]
+ external(
+ "move {newpath}",
+ "cmd /c move /Y {file} {newpath:path-from-parent}",
+ StayInBroot,
+ )
+ .with_shortcut("mv"),
+ #[cfg(unix)]
external(
"move_to_panel",
"mv {file} {other-panel-directory}",
StayInBroot,
)
.with_shortcut("mvp"),
+ #[cfg(windows)]
+ external(
+ "move_to_panel",
+ "cmd /c move /Y {file} {other-panel-directory}",
+ StayInBroot,
+ )
+ .with_shortcut("mvp"),
+ #[cfg(unix)]
external(
"rename {new_filename:file-name}",
"mv {file} {parent}/{new_filename}",
@@ -158,6 +191,14 @@ pub fn builtin_verbs() -> Vec<Verb> {
)
.with_auto_exec(false)
.with_key(key!(f2)),
+ #[cfg(windows)]
+ external(
+ "rename {new_filename:file-name}",
+ "cmd /c move /Y {file} {parent}/{new_filename}",
+ StayInBroot,
+ )
+ .with_auto_exec(false)
+ .with_key(key!(f2)),
internal_bang(start_end_panel)
.with_key(key!(ctrl-p)),
// the char keys for mode_input are handled differently as they're not
@@ -221,7 +262,14 @@ pub fn builtin_verbs() -> Vec<Verb> {
internal(sort_by_date).with_shortcut("sd"),
internal(sort_by_size).with_shortcut("ss"),
internal(sort_by_type).with_shortcut("st"),
+ #[cfg(unix)]
external("rm", "rm -rf {file}", StayInBroot),
+ #[cfg(windows)]
+ external("rm", "cmd /c rmdir /Q /S {file}", StayInBroot)
+ .with_stype(SelectionType::Directory),
+ #[cfg(windows)]
+ external("rm", "cmd /c del /Q /S {file}", StayInBroot)
+ .with_stype(SelectionType::File),
internal(toggle_counts).with_shortcut("counts"),
internal(toggle_dates).with_shortcut("dates"),
internal(toggle_device_id).with_shortcut("dev"),