@@ -10,21 +10,21 @@ use crossterm::{execute, terminal::SetTitle};
1010use derive_config:: { ConfigError , DeriveTomlConfig } ;
1111use notify:: PollWatcher ;
1212use terminal_link:: Link ;
13- use time:: { macros:: format_description, UtcOffset } ;
13+ use time:: { UtcOffset , macros:: format_description} ;
1414use tokio:: signal;
1515use tracing:: level_filters:: LevelFilter ;
16- use tracing_subscriber:: { fmt:: time:: OffsetTime , EnvFilter } ;
16+ use tracing_subscriber:: { EnvFilter , fmt:: time:: OffsetTime } ;
1717use vrc_log:: {
18- provider,
19- provider:: { avtrdb:: AvtrDBActor , prelude:: * , ProviderKind } ,
18+ CARGO_PKG_HOMEPAGE , provider,
19+ provider:: { ProviderKind , avtrdb:: AvtrDBActor , prelude:: * } ,
2020 settings:: Settings ,
2121 vrchat:: { VRCHAT_AMP_PATH , VRCHAT_LOW_PATH } ,
22- CARGO_PKG_HOMEPAGE ,
2322} ;
2423
2524/* Watchers will stop working if they get dropped. */
2625static WATCHERS : OnceLock < Vec < PollWatcher > > = OnceLock :: new ( ) ;
2726
27+ #[ allow( clippy:: too_many_lines) ]
2828#[ tokio:: main]
2929async fn main ( ) -> Result < ( ) > {
3030 #[ cfg( feature = "title" ) ]
@@ -50,18 +50,28 @@ async fn main() -> Result<()> {
5050 info ! ( "{link}" ) ;
5151 }
5252
53- let args = std:: env:: args ( ) ;
54- let settings = Settings :: load ( ) . unwrap_or_else ( |error| match error {
55- ConfigError :: Io ( error) if error. kind ( ) == ErrorKind :: NotFound => {
56- info ! ( "Welcome to VRC-LOG! Please follow the setup wizard" ) ;
57- Settings :: try_wizard ( ) . expect ( "Failed to setup wizard" )
58- }
59- error => {
60- error ! ( "There was an error loading the settings: {error}" ) ;
61- error ! ( "Most likely an update. Please follow the setup wizard" ) ;
62- Settings :: try_wizard ( ) . expect ( "Failed to setup wizard" )
63- }
64- } ) ;
53+ let mut args = std:: env:: args ( ) . collect :: < Vec < _ > > ( ) ;
54+ let force_wizard = args. iter ( ) . any ( |arg| arg == "--wizard" || arg == "-w" ) ;
55+ if force_wizard {
56+ args. retain ( |arg| arg != "--wizard" && arg != "-w" ) ;
57+ }
58+
59+ let settings = if force_wizard {
60+ info ! ( "Setup wizard requested via flag" ) ;
61+ Settings :: try_wizard ( ) . expect ( "Failed to setup wizard" )
62+ } else {
63+ Settings :: load ( ) . unwrap_or_else ( |error| match error {
64+ ConfigError :: Io ( error) if error. kind ( ) == ErrorKind :: NotFound => {
65+ info ! ( "Welcome to VRC-LOG! Please follow the setup wizard" ) ;
66+ Settings :: try_wizard ( ) . expect ( "Failed to setup wizard" )
67+ }
68+ error => {
69+ error ! ( "There was an error loading the settings: {error}" ) ;
70+ error ! ( "Most likely an update. Please follow the setup wizard" ) ;
71+ Settings :: try_wizard ( ) . expect ( "Failed to setup wizard" )
72+ }
73+ } )
74+ } ;
6575
6676 let ( tx, rx) = flume:: unbounded ( ) ;
6777 let _ = WATCHERS . set ( vec ! [
@@ -78,7 +88,7 @@ async fn main() -> Result<()> {
7888 }
7989
8090 settings. save ( ) ?;
81- vrc_log:: launch_game ( args) ?;
91+ vrc_log:: launch_game ( & args) ?;
8292
8393 // This is a little wonky, but effecively we are creating a controlled memory leak
8494 // which will be static for the rest of the programms runtime
0 commit comments