1
1
use crate :: { application:: * , utils:: get_path_timestamp} ;
2
2
pub use async_trait:: async_trait;
3
+ use clap:: Parser ;
3
4
use futures_lite:: stream:: StreamExt ;
4
5
use lapin:: {
5
6
options:: { BasicAckOptions , BasicConsumeOptions , BasicQosOptions } ,
@@ -12,7 +13,6 @@ use std::{
12
13
sync:: { Arc , Mutex } ,
13
14
thread,
14
15
} ;
15
- use structopt:: StructOpt ;
16
16
use tracing:: { debug, error} ;
17
17
18
18
type Error = Box < dyn std:: error:: Error + Send + Sync + ' static > ;
@@ -98,7 +98,7 @@ impl CoLinkProtocol {
98
98
} ;
99
99
self . cl . unlock ( lock) . await ?;
100
100
101
- let ( mq_addr, _ , _ ) = self . cl . request_info ( ) . await ?;
101
+ let mq_addr = self . cl . request_info ( ) . await ?. mq_uri ;
102
102
let mq = Connection :: connect ( & mq_addr, ConnectionProperties :: default ( ) ) . await ?;
103
103
let channel = mq. create_channel ( ) . await ?;
104
104
channel. basic_qos ( 1 , BasicQosOptions :: default ( ) ) . await ?;
@@ -241,27 +241,27 @@ pub fn _protocol_start(
241
241
Ok ( ( ) )
242
242
}
243
243
244
- #[ derive( Debug , StructOpt ) ]
245
- #[ structopt ( name = "CoLink-SDK" , about = "CoLink-SDK" ) ]
244
+ #[ derive( Debug , Parser ) ]
245
+ #[ command ( name = "CoLink-SDK" , about = "CoLink-SDK" ) ]
246
246
pub struct CommandLineArgs {
247
247
/// Address of CoLink server
248
- #[ structopt ( short, long, env = "COLINK_CORE_ADDR" ) ]
248
+ #[ arg ( short, long, env = "COLINK_CORE_ADDR" ) ]
249
249
pub addr : String ,
250
250
251
251
/// User JWT
252
- #[ structopt ( short, long, env = "COLINK_JWT" ) ]
252
+ #[ arg ( short, long, env = "COLINK_JWT" ) ]
253
253
pub jwt : String ,
254
254
255
255
/// Path to CA certificate.
256
- #[ structopt ( long, env = "COLINK_CA_CERT" ) ]
256
+ #[ arg ( long, env = "COLINK_CA_CERT" ) ]
257
257
pub ca : Option < String > ,
258
258
259
259
/// Path to client certificate.
260
- #[ structopt ( long, env = "COLINK_CLIENT_CERT" ) ]
260
+ #[ arg ( long, env = "COLINK_CLIENT_CERT" ) ]
261
261
pub cert : Option < String > ,
262
262
263
263
/// Path to private key.
264
- #[ structopt ( long, env = "COLINK_CLIENT_KEY" ) ]
264
+ #[ arg ( long, env = "COLINK_CLIENT_KEY" ) ]
265
265
pub key : Option < String > ,
266
266
}
267
267
@@ -273,7 +273,7 @@ pub fn _colink_parse_args() -> CoLink {
273
273
ca,
274
274
cert,
275
275
key,
276
- } = CommandLineArgs :: from_args ( ) ;
276
+ } = CommandLineArgs :: parse ( ) ;
277
277
let mut cl = CoLink :: new ( & addr, & jwt) ;
278
278
if let Some ( ca) = ca {
279
279
cl = cl. ca_certificate ( & ca) ;
0 commit comments