@@ -405,6 +405,9 @@ enum Commands {
405405 /// Target URI
406406 #[ arg( short, long, default_value = "viking://" ) ]
407407 uri : String ,
408+ /// Excluded URI range. Any entry whose URI falls under this URI prefix is skipped
409+ #[ arg( short = 'x' , long = "exclude-uri" ) ]
410+ exclude_uri : Option < String > ,
408411 /// Search pattern
409412 pattern : String ,
410413 /// Case insensitive
@@ -801,10 +804,11 @@ async fn main() {
801804 } => handle_search ( query, uri, session_id, node_limit, threshold, ctx) . await ,
802805 Commands :: Grep {
803806 uri,
807+ exclude_uri,
804808 pattern,
805809 ignore_case,
806810 node_limit,
807- } => handle_grep ( uri, pattern, ignore_case, node_limit, ctx) . await ,
811+ } => handle_grep ( uri, exclude_uri , pattern, ignore_case, node_limit, ctx) . await ,
808812
809813 Commands :: Glob {
810814 pattern,
@@ -1425,12 +1429,16 @@ async fn handle_stat(uri: String, ctx: CliContext) -> Result<()> {
14251429
14261430async fn handle_grep (
14271431 uri : String ,
1432+ exclude_uri : Option < String > ,
14281433 pattern : String ,
14291434 ignore_case : bool ,
14301435 node_limit : i32 ,
14311436 ctx : CliContext ,
14321437) -> Result < ( ) > {
14331438 let mut params = vec ! [ format!( "--uri={}" , uri) , format!( "-n {}" , node_limit) ] ;
1439+ if let Some ( excluded) = & exclude_uri {
1440+ params. push ( format ! ( "-x {}" , excluded) ) ;
1441+ }
14341442 if ignore_case {
14351443 params. push ( "-i" . to_string ( ) ) ;
14361444 }
@@ -1440,6 +1448,7 @@ async fn handle_grep(
14401448 commands:: search:: grep (
14411449 & client,
14421450 & uri,
1451+ exclude_uri,
14431452 & pattern,
14441453 ignore_case,
14451454 node_limit,
0 commit comments