File tree Expand file tree Collapse file tree 6 files changed +47
-4
lines changed
Expand file tree Collapse file tree 6 files changed +47
-4
lines changed Original file line number Diff line number Diff line change 2121 path : artifacts
2222
2323 - name : Upload to release
24- uses : softprops/action-gh-release@v1
24+ uses : softprops/action-gh-release@v2
2525 with :
2626 files : artifacts/**/*
2727
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ mod config;
1010mod list;
1111mod preset;
1212mod profile;
13+ mod remove;
1314mod switch;
1415
1516#[ derive( Parser ) ]
@@ -35,6 +36,8 @@ pub enum Commands {
3536 List ( list:: ListCommand ) ,
3637 /// Add a new userchrome
3738 Add ( add:: AddCommand ) ,
39+ /// Remove a userchrome
40+ Remove ( remove:: RemoveCommand ) ,
3841 /// Switch to a userchrome
3942 Switch ( switch:: SwitchCommand ) ,
4043 /// 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};
22use std:: path:: { Path , PathBuf } ;
33use tokio:: fs;
44
5- use owo_colors:: OwoColorize ;
5+ use owo_colors:: OwoColorize as _ ;
66use serde:: { Deserialize , Serialize } ;
77
88#[ derive( Deserialize , Serialize , Debug ) ]
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use std::{
88use tokio:: { fs, process:: Command } ;
99
1010use nanoid:: nanoid;
11- use owo_colors:: OwoColorize ;
11+ use owo_colors:: OwoColorize as _ ;
1212use regex:: Regex ;
1313
1414use crate :: {
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use tokio::fs;
99
1010use color_eyre:: eyre:: { eyre, Result } ;
1111use nanoid:: nanoid;
12- use owo_colors:: OwoColorize ;
12+ use owo_colors:: OwoColorize as _ ;
1313use sysinfo:: { ProcessRefreshKind , RefreshKind , System } ;
1414use zip:: ZipArchive ;
1515
You can’t perform that action at this time.
0 commit comments