File tree 6 files changed +47
-4
lines changed
6 files changed +47
-4
lines changed Original file line number Diff line number Diff line change 21
21
path : artifacts
22
22
23
23
- name : Upload to release
24
- uses : softprops/action-gh-release@v1
24
+ uses : softprops/action-gh-release@v2
25
25
with :
26
26
files : artifacts/**/*
27
27
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ mod config;
10
10
mod list;
11
11
mod preset;
12
12
mod profile;
13
+ mod remove;
13
14
mod switch;
14
15
15
16
#[ derive( Parser ) ]
@@ -35,6 +36,8 @@ pub enum Commands {
35
36
List ( list:: ListCommand ) ,
36
37
/// Add a new userchrome
37
38
Add ( add:: AddCommand ) ,
39
+ /// Remove a userchrome
40
+ Remove ( remove:: RemoveCommand ) ,
38
41
/// Switch to a userchrome
39
42
Switch ( switch:: SwitchCommand ) ,
40
43
/// Import a preset as a userchrome or list presets
Original file line number Diff line number Diff line change
1
+ use clap:: Parser ;
2
+ use color_eyre:: {
3
+ eyre:: { eyre, Result } ,
4
+ owo_colors:: OwoColorize as _,
5
+ } ;
6
+
7
+ use crate :: config;
8
+
9
+ #[ derive( Parser ) ]
10
+ pub struct RemoveCommand {
11
+ /// Name of the userchrome
12
+ name : String ,
13
+ }
14
+
15
+ impl super :: Command for RemoveCommand {
16
+ async fn action ( & self , global_options : & super :: Cli ) -> Result < ( ) > {
17
+ let mut config = config:: get_config ( & global_options. config ) . await ?;
18
+
19
+ let res = config
20
+ . userchromes
21
+ . iter ( )
22
+ . enumerate ( )
23
+ . find ( |( _, uchrome) | uchrome. name . eq ( & self . name ) ) ;
24
+
25
+ match res {
26
+ Some ( ( i, uchrome) ) => {
27
+ println ! ( "Removing {}!" , uchrome. name. cyan( ) ) ;
28
+ config:: print_userchrome ( uchrome, true ) ;
29
+
30
+ config. userchromes . remove ( i) ;
31
+ config:: set_config ( & global_options. config , & config) . await ?;
32
+ Ok ( ( ) )
33
+ }
34
+ None => Err ( eyre ! (
35
+ "no userchrome with name {} found to remove!" ,
36
+ self . name
37
+ ) ) ,
38
+ }
39
+ }
40
+ }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use color_eyre::eyre::{eyre, Result};
2
2
use std:: path:: { Path , PathBuf } ;
3
3
use tokio:: fs;
4
4
5
- use owo_colors:: OwoColorize ;
5
+ use owo_colors:: OwoColorize as _ ;
6
6
use serde:: { Deserialize , Serialize } ;
7
7
8
8
#[ derive( Deserialize , Serialize , Debug ) ]
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use std::{
8
8
use tokio:: { fs, process:: Command } ;
9
9
10
10
use nanoid:: nanoid;
11
- use owo_colors:: OwoColorize ;
11
+ use owo_colors:: OwoColorize as _ ;
12
12
use regex:: Regex ;
13
13
14
14
use crate :: {
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use tokio::fs;
9
9
10
10
use color_eyre:: eyre:: { eyre, Result } ;
11
11
use nanoid:: nanoid;
12
- use owo_colors:: OwoColorize ;
12
+ use owo_colors:: OwoColorize as _ ;
13
13
use sysinfo:: { ProcessRefreshKind , RefreshKind , System } ;
14
14
use zip:: ZipArchive ;
15
15
You can’t perform that action at this time.
0 commit comments