Bläddra i källkod

Support specifying target path for xpst()

Alois Mahdal 1 månad sedan
förälder
incheckning
b39737a0a9
1 ändrade filer med 6 tillägg och 1 borttagningar
  1. 6
    1
      dotfiles/config/bashum/main.bashrc

+ 6
- 1
dotfiles/config/bashum/main.bashrc Visa fil

@@ -645,6 +645,11 @@ xpst() {
645 645
     #
646 646
     # Paste paths from clipboard
647 647
     #
648
+    local target_path="${1:-.}"
649
+    test -d "$target_path" || {
650
+        echo >&2 "no such directory: $target_path"
651
+        return 2
652
+    }
648 653
     { xop o; echo; } \
649 654
       | while read -r path; do
650 655
             echo "path='$path'" >&2
@@ -652,7 +657,7 @@ xpst() {
652 657
                 echo "does not exist: $path"
653 658
                 continue
654 659
             }
655
-            cp -ar "$path" .
660
+            cp -ar "$path" "$target_path"
656 661
         done
657 662
 }
658 663