File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
use super :: * ;
2
+ use crate :: utils:: choice:: Choice ;
2
3
use crate :: utils:: prompt:: prompt_text;
3
4
use crate :: { sdk:: SDK , utils:: config:: Config } ;
4
5
5
6
/// Rename a project
6
7
#[ derive( Parser ) ]
7
8
pub struct Args {
8
- /// Project name
9
+ /// New name for the project
9
10
#[ clap( short, long) ]
10
11
name : Option < String > ,
12
+
13
+ /// Project ID
14
+ #[ clap( short, long) ]
15
+ project_id : Option < String > ,
11
16
}
12
17
13
18
pub async fn command ( args : Args ) -> Result < ( ) > {
14
19
let config = Config :: get ( ) ?;
15
20
let key = config. primary_key ( ) ?;
21
+ let key = key. unlock ( & config. primary_key_password ( ) ?) ;
22
+
23
+ let project_id = Choice :: try_project ( args. project_id , & key) . await ?;
24
+ let new_name = args. name . unwrap_or_else ( || {
25
+ prompt_text ( "New name for project" ) . expect ( "Failed to prompt" )
26
+ } ) ;
16
27
17
- Ok ( ( ) )
28
+ SDK :: rename_project ( & project_id , & new_name , & key ) . await
18
29
}
You can’t perform that action at this time.
0 commit comments