File tree 2 files changed +11
-7
lines changed
2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,6 @@ pub const YELLOW: &str = "\x1B[32m"; //( bright, medium yellow color)
9
9
pub const YELLOW_BRIGHT : & str = "\x1B [93m" ; //( very bright, light yellow color)
10
10
pub const RESET : & str = "\x1B [0m" ; //( resets the text color to the default)
11
11
12
- // unused colors rn :-
13
- //pub const MAGENTAA: &str = "\x1b[35m"; //( bright, medium pinkish-purple color)
14
- //pub const WHITE: &str = "\x1B[37m"; //( bright, pale gray color)
12
+ // unused colors rn :-
13
+ //pub const MAGENTAA: &str = "\x1b[35m"; //( bright, medium pinkish-purple color)
14
+ //pub const WHITE: &str = "\x1B[37m"; //( bright, pale gray color)
Original file line number Diff line number Diff line change @@ -72,6 +72,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
72
72
73
73
Ok ( ( ) )
74
74
}
75
+
76
+ fn exit_on_error ( ) {
77
+ std:: process:: exit ( 0 ) ;
78
+ }
79
+
75
80
async fn run (
76
81
url : String ,
77
82
outdir : Option < String > ,
@@ -81,12 +86,11 @@ async fn run(
81
86
height : Option < u32 > ,
82
87
silent : bool ,
83
88
) -> Result < ( ) , Box < dyn std:: error:: Error + Send + Sync > > {
84
- // Check if the browser binary path is valid
89
+ // Check if the browser binary path is valid
85
90
if !Path :: new ( & binary_path) . exists ( ) {
86
91
println ! ( "{RED}[  ]Browser binary not found at path {}, You should try manually pasing the binary path !!{RESET}" , binary_path) ;
87
92
println ! ( "{BLUE}[ ﯦ ]{RESET}{CYAN} $ hxn -b $(which brave) <url> or use --help flag" ) ;
88
- std:: process:: exit ( 0 ) ;
89
-
93
+ exit_on_error ( ) ;
90
94
}
91
95
let outdir = match outdir {
92
96
Some ( dir) => dir,
@@ -161,6 +165,7 @@ async fn run(
161
165
handle
162
166
. await ?
163
167
. expect ( "Something went wrong while waiting for taking screenshot and saving to file" ) ;
168
+ exit_on_error ( ) ;
164
169
}
165
170
166
171
println ! ( "{RED}♥ {GREEN} {YELLOW_BRIGHT}Yoo 1337!! Screenshots saved in dir {outdir}{RED} ♥ {GREEN}{RESET} " ) ;
@@ -211,4 +216,3 @@ async fn take_screenshots(
211
216
212
217
Ok ( ( ) )
213
218
}
214
-
You can’t perform that action at this time.
0 commit comments