@@ -195,7 +195,7 @@ enum Commands {
195195 #[ arg( short, long) ]
196196 all : bool ,
197197 /// Maximum number of nodes to list
198- #[ arg( long = "node-limit" , short = 'n' , default_value = "1000 " ) ]
198+ #[ arg( long = "node-limit" , short = 'n' , default_value = "256 " ) ]
199199 node_limit : i32 ,
200200 } ,
201201 /// Get directory tree
@@ -209,8 +209,11 @@ enum Commands {
209209 #[ arg( short, long) ]
210210 all : bool ,
211211 /// Maximum number of nodes to list
212- #[ arg( long = "node-limit" , short = 'n' , default_value = "1000 " ) ]
212+ #[ arg( long = "node-limit" , short = 'n' , default_value = "256 " ) ]
213213 node_limit : i32 ,
214+ /// Maximum depth level to traverse (default: 3)
215+ #[ arg( short = 'L' , long = "level-limit" , default_value = "3" ) ]
216+ level_limit : i32 ,
214217 } ,
215218 /// Create directory
216219 Mkdir {
@@ -530,8 +533,8 @@ async fn main() {
530533 Commands :: Ls { uri, simple, recursive, abs_limit, all, node_limit } => {
531534 handle_ls ( uri, simple, recursive, abs_limit, all, node_limit, ctx) . await
532535 }
533- Commands :: Tree { uri, abs_limit, all, node_limit } => {
534- handle_tree ( uri, abs_limit, all, node_limit, ctx) . await
536+ Commands :: Tree { uri, abs_limit, all, node_limit, level_limit } => {
537+ handle_tree ( uri, abs_limit, all, node_limit, level_limit , ctx) . await
535538 }
536539 Commands :: Mkdir { uri } => {
537540 handle_mkdir ( uri, ctx) . await
@@ -877,16 +880,42 @@ async fn handle_search(
877880 commands:: search:: search ( & client, & query, & uri, session_id, limit, threshold, ctx. output_format , ctx. compact ) . await
878881}
879882
883+ /// Print command with specified parameters for debugging
884+ fn print_command_echo ( command : & str , params : & str , echo_enabled : bool ) {
885+ if echo_enabled {
886+ println ! ( "cmd: {} {}" , command, params) ;
887+ }
888+ }
889+
880890async fn handle_ls ( uri : String , simple : bool , recursive : bool , abs_limit : i32 , show_all_hidden : bool , node_limit : i32 , ctx : CliContext ) -> Result < ( ) > {
891+ let mut params = vec ! [
892+ uri. clone( ) ,
893+ format!( "-l {}" , abs_limit) ,
894+ format!( "-n {}" , node_limit) ,
895+ ] ;
896+ if simple { params. push ( "-s" . to_string ( ) ) ; }
897+ if recursive { params. push ( "-r" . to_string ( ) ) ; }
898+ if show_all_hidden { params. push ( "-a" . to_string ( ) ) ; }
899+ print_command_echo ( "ov ls" , & params. join ( " " ) , ctx. config . echo_command ) ;
900+
881901 let client = ctx. get_client ( ) ;
882902 let api_output = if ctx. compact { "agent" } else { "original" } ;
883903 commands:: filesystem:: ls ( & client, & uri, simple, recursive, api_output, abs_limit, show_all_hidden, node_limit, ctx. output_format , ctx. compact ) . await
884904}
885905
886- async fn handle_tree ( uri : String , abs_limit : i32 , show_all_hidden : bool , node_limit : i32 , ctx : CliContext ) -> Result < ( ) > {
906+ async fn handle_tree ( uri : String , abs_limit : i32 , show_all_hidden : bool , node_limit : i32 , level_limit : i32 , ctx : CliContext ) -> Result < ( ) > {
907+ let mut params = vec ! [
908+ uri. clone( ) ,
909+ format!( "-l {}" , abs_limit) ,
910+ format!( "-n {}" , node_limit) ,
911+ format!( "-L {}" , level_limit) ,
912+ ] ;
913+ if show_all_hidden { params. push ( "-a" . to_string ( ) ) ; }
914+ print_command_echo ( "ov tree" , & params. join ( " " ) , ctx. config . echo_command ) ;
915+
887916 let client = ctx. get_client ( ) ;
888917 let api_output = if ctx. compact { "agent" } else { "original" } ;
889- commands:: filesystem:: tree ( & client, & uri, api_output, abs_limit, show_all_hidden, node_limit, ctx. output_format , ctx. compact ) . await
918+ commands:: filesystem:: tree ( & client, & uri, api_output, abs_limit, show_all_hidden, node_limit, level_limit , ctx. output_format , ctx. compact ) . await
890919}
891920
892921async fn handle_mkdir ( uri : String , ctx : CliContext ) -> Result < ( ) > {
0 commit comments