File tree Expand file tree Collapse file tree 2 files changed +6
-18
lines changed
Expand file tree Collapse file tree 2 files changed +6
-18
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ pub struct Login {
1414
1515impl Login {
1616 pub fn new ( terminal : Terminal , flags : LoginSubcommand ) -> Result < Self > {
17- let backend = BackendClient :: new ( flags. origin ( ) , None ) ?;
17+ let origin = flags. origin ( ) . as_deref ( ) ;
18+ let backend = BackendClient :: new ( origin, None ) ?;
1819
1920 Ok ( Self {
2021 terminal,
@@ -32,13 +33,15 @@ impl Login {
3233 let email = self
3334 . flags
3435 . email ( )
36+ . as_deref ( )
3537 . map ( ToString :: to_string)
3638 . unwrap_or_else ( || self . terminal . prompt_email ( ) ) ;
3739
3840 // If no password was provided, prompt for their password.
3941 let password = self
4042 . flags
4143 . password ( )
44+ . as_deref ( )
4245 . map ( ToString :: to_string)
4346 . unwrap_or_else ( || self . terminal . prompt_password ( ) ) ;
4447
Original file line number Diff line number Diff line change 11use clap:: Args ;
2+ use derive_getters:: Getters ;
23
3- #[ derive( Args , Clone ) ]
4+ #[ derive( Args , Getters , Clone ) ]
45pub struct LoginSubcommand {
56 /// The email of the account
67 #[ clap( long) ]
@@ -12,19 +13,3 @@ pub struct LoginSubcommand {
1213 #[ arg( long, short = 'o' , default_value = Some ( "http://127.0.0.1:8080" ) ) ]
1314 origin : Option < String > ,
1415}
15-
16- impl LoginSubcommand {
17- /// Return the user's email, if provided via the CLI.
18- pub fn email ( & self ) -> Option < & str > {
19- self . email . as_deref ( )
20- }
21-
22- /// Return the user's password, if provided via the CLI.
23- pub fn password ( & self ) -> Option < & str > {
24- self . password . as_deref ( )
25- }
26-
27- pub fn origin ( & self ) -> Option < & str > {
28- self . password . as_deref ( )
29- }
30- }
You can’t perform that action at this time.
0 commit comments