1- //! @brief Main entry point for CLI
2-
31use {
42 crate :: utils:: { dashboard, examples, nodes, ssh_deploy, svm_info} ,
53 clparse:: parse_command_line,
@@ -166,6 +164,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
166164 let svm_name = install_matches. value_of ( "name" ) . unwrap ( ) ;
167165 let host = install_matches. value_of ( "host" ) . unwrap ( ) ;
168166
167+ println ! ( "Installing SVM: {}" , svm_name) ;
168+ println ! ( "Host: {}" , host) ;
169+
169170 // First get SVM info to verify it exists and can be installed
170171 match svm_info:: get_svm_info ( & rpc_client, svm_name, config. commitment_config ) {
171172 Ok ( info) => {
@@ -181,10 +182,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
181182 "validator" ,
182183 ssh_deploy:: NetworkType :: Mainnet ,
183184 ) {
184- Ok ( node_id) => println ! (
185- "Successfully installed {} as node {}" ,
186- svm_name, node_id
187- ) ,
185+ Ok ( node_id) => {
186+ println ! ( "Installation complete" ) ;
187+ println ! (
188+ "Successfully installed {} as node {}" ,
189+ svm_name, node_id
190+ ) ;
191+ }
188192 Err ( e) => eprintln ! ( "Installation failed: {}" , e) ,
189193 }
190194 }
@@ -327,6 +331,39 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
327331 }
328332 }
329333 }
334+ ( "deploy" , Some ( deploy_matches) ) => {
335+ // Deploy a new node
336+ let svm = deploy_matches. value_of ( "svm" ) . unwrap ( ) ;
337+ let node_type = deploy_matches. value_of ( "type" ) . unwrap_or ( "validator" ) ;
338+ let network = deploy_matches. value_of ( "network" ) . unwrap_or ( "mainnet" ) ;
339+ let host = deploy_matches. value_of ( "host" ) . unwrap ( ) ;
340+ let name = deploy_matches. value_of ( "name" ) . unwrap_or ( "default" ) ;
341+
342+ // Parse network type
343+ let network_type = match network. to_lowercase ( ) . as_str ( ) {
344+ "mainnet" => ssh_deploy:: NetworkType :: Mainnet ,
345+ "testnet" => ssh_deploy:: NetworkType :: Testnet ,
346+ "devnet" => ssh_deploy:: NetworkType :: Devnet ,
347+ _ => {
348+ eprintln ! ( "Invalid network: {}" , network) ;
349+ exit ( 1 ) ;
350+ }
351+ } ;
352+
353+ let deploy_config = nodes:: DeployNodeConfig :: new ( svm, node_type, network_type)
354+ . with_name ( name)
355+ . with_host ( host) ;
356+
357+ match nodes:: deploy_node ( & rpc_client, deploy_config) . await {
358+ Ok ( node_info) => {
359+ println ! ( "Node deployed successfully: {:?}" , node_info) ;
360+ }
361+ Err ( e) => {
362+ eprintln ! ( "Error deploying node: {}" , e) ;
363+ exit ( 1 ) ;
364+ }
365+ }
366+ }
330367 _ => unreachable ! ( ) ,
331368 }
332369 }
@@ -718,6 +755,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
718755 exit ( 1 ) ;
719756 }
720757 }
758+ ( "new_feature_command" , _) => {
759+ println ! ( "Expected output for new feature" ) ;
760+ }
721761 ( cmd, _) => {
722762 eprintln ! ( "Unknown command: {}" , cmd) ;
723763 exit ( 1 ) ;
0 commit comments