File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -431,7 +431,7 @@ impl Tile {
431431 let mut exact: Vec < App > = filter_vec
432432 . par_iter ( )
433433 . filter ( |x| match & x. open_command {
434- Function :: RunShellCommand => x
434+ Function :: RunShellCommand ( _ , _ ) => x
435435 . name_lc
436436 . starts_with ( query. split_once ( " " ) . unwrap_or ( ( & query, "" ) ) . 0 ) ,
437437 _ => x. name_lc == query,
@@ -442,7 +442,7 @@ impl Tile {
442442 let mut prefix: Vec < App > = filter_vec
443443 . par_iter ( )
444444 . filter ( |x| match x. open_command {
445- Function :: RunShellCommand => false ,
445+ Function :: RunShellCommand ( _ , _ ) => false ,
446446 _ => x. name_lc != query && x. name_lc . starts_with ( & query) ,
447447 } )
448448 . cloned ( )
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use crate::config::Config;
99#[ derive( Debug , Clone ) ]
1010pub enum Function {
1111 OpenApp ( String ) ,
12- RunShellCommand ,
12+ RunShellCommand ( String , String ) ,
1313 RandomVar ( i32 ) ,
1414 GoogleSearch ( String ) ,
1515 OpenPrefPane ,
@@ -27,8 +27,15 @@ impl Function {
2727 ) ) ;
2828 } ) ;
2929 }
30- Function :: RunShellCommand => {
31- Command :: new ( "sh" ) . arg ( "-c" ) . arg ( query) . status ( ) . ok ( ) ;
30+ Function :: RunShellCommand ( command, alias) => {
31+ let query = query. to_string ( ) ;
32+ let final_command =
33+ format ! ( r#"{} {}"# , command, query. strip_prefix( alias) . unwrap_or( "" ) ) ;
34+ Command :: new ( "sh" )
35+ . arg ( "-c" )
36+ . arg ( final_command. trim ( ) )
37+ . spawn ( )
38+ . ok ( ) ;
3239 }
3340 Function :: RandomVar ( var) => {
3441 Clipboard :: new ( )
Original file line number Diff line number Diff line change @@ -140,7 +140,10 @@ impl Shelly {
140140 }
141141 } ) ;
142142 App {
143- open_command : Function :: RunShellCommand ,
143+ open_command : Function :: RunShellCommand (
144+ self_clone. command ,
145+ self_clone. alias_lc . clone ( ) ,
146+ ) ,
144147 icons : icon,
145148 name : self_clone. alias ,
146149 name_lc : self_clone. alias_lc ,
You can’t perform that action at this time.
0 commit comments