@@ -1741,13 +1741,30 @@ fn insert_output(
1741
1741
Ok ( ( ) )
1742
1742
}
1743
1743
1744
+ fn pipe_to (
1745
+ cx : & mut compositor:: Context ,
1746
+ args : & [ Cow < str > ] ,
1747
+ event : PromptEvent ,
1748
+ ) -> anyhow:: Result < ( ) > {
1749
+ pipe_impl ( cx, args, event, & ShellBehavior :: Ignore )
1750
+ }
1751
+
1744
1752
fn pipe ( cx : & mut compositor:: Context , args : & [ Cow < str > ] , event : PromptEvent ) -> anyhow:: Result < ( ) > {
1753
+ pipe_impl ( cx, args, event, & ShellBehavior :: Replace )
1754
+ }
1755
+
1756
+ fn pipe_impl (
1757
+ cx : & mut compositor:: Context ,
1758
+ args : & [ Cow < str > ] ,
1759
+ event : PromptEvent ,
1760
+ behavior : & ShellBehavior ,
1761
+ ) -> anyhow:: Result < ( ) > {
1745
1762
if event != PromptEvent :: Validate {
1746
1763
return Ok ( ( ) ) ;
1747
1764
}
1748
1765
1749
1766
ensure ! ( !args. is_empty( ) , "Shell command required" ) ;
1750
- shell ( cx, & args. join ( " " ) , & ShellBehavior :: Replace ) ;
1767
+ shell ( cx, & args. join ( " " ) , behavior ) ;
1751
1768
Ok ( ( ) )
1752
1769
}
1753
1770
@@ -2292,6 +2309,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
2292
2309
fun : pipe,
2293
2310
completer : None ,
2294
2311
} ,
2312
+ TypableCommand {
2313
+ name : "pipe-to" ,
2314
+ aliases : & [ ] ,
2315
+ doc : "Pipe each selection to the shell command, ignoring output." ,
2316
+ fun : pipe_to,
2317
+ completer : None ,
2318
+ } ,
2295
2319
TypableCommand {
2296
2320
name : "run-shell-command" ,
2297
2321
aliases : & [ "sh" ] ,
0 commit comments