@@ -79,7 +79,10 @@ mod tabs;
7979mod ui;
8080mod watcher;
8181
82- use crate :: { app:: App , args:: process_cmdline} ;
82+ use crate :: {
83+ app:: App ,
84+ args:: { process_cmdline, CliArgs } ,
85+ } ;
8386use anyhow:: { anyhow, bail, Result } ;
8487use app:: QuitState ;
8588use asyncgit:: {
@@ -102,10 +105,9 @@ use scopeguard::defer;
102105use scopetime:: scope_time;
103106use spinner:: Spinner ;
104107use std:: {
105- cell:: RefCell ,
106108 io:: { self , Stdout } ,
107109 panic,
108- path:: { Path , PathBuf } ,
110+ path:: Path ,
109111 time:: { Duration , Instant } ,
110112} ;
111113use ui:: style:: Theme ;
@@ -163,7 +165,7 @@ macro_rules! log_eprintln {
163165fn main ( ) -> Result < ( ) > {
164166 let app_start = Instant :: now ( ) ;
165167
166- let cliargs = process_cmdline ( ) ?;
168+ let mut cliargs = process_cmdline ( ) ?;
167169
168170 asyncgit:: register_tracing_logging ( ) ;
169171 ensure_valid_path ( & cliargs. repo_path ) ?;
@@ -180,9 +182,8 @@ fn main() -> Result<()> {
180182
181183 set_panic_handler ( ) ?;
182184
183- let mut repo_path = cliargs. repo_path ;
184- let mut select_file = cliargs. select_file ;
185- let mut terminal = start_terminal ( io:: stdout ( ) , & repo_path) ?;
185+ let mut terminal =
186+ start_terminal ( io:: stdout ( ) , & cliargs. repo_path ) ?;
186187 let input = Input :: new ( ) ;
187188
188189 let updater = if cliargs. notify_watcher {
@@ -194,9 +195,8 @@ fn main() -> Result<()> {
194195 loop {
195196 let quit_state = run_app (
196197 app_start,
197- repo_path . clone ( ) ,
198+ cliargs . clone ( ) ,
198199 theme. clone ( ) ,
199- select_file. clone ( ) ,
200200 key_config. clone ( ) ,
201201 & input,
202202 updater,
@@ -205,8 +205,12 @@ fn main() -> Result<()> {
205205
206206 match quit_state {
207207 QuitState :: OpenSubmodule ( p) => {
208- repo_path = p;
209- select_file = None ;
208+ cliargs = CliArgs {
209+ repo_path : p,
210+ select_file : None ,
211+ theme : cliargs. theme ,
212+ notify_watcher : cliargs. notify_watcher ,
213+ }
210214 }
211215 _ => break ,
212216 }
@@ -218,9 +222,8 @@ fn main() -> Result<()> {
218222#[ allow( clippy:: too_many_arguments) ]
219223fn run_app (
220224 app_start : Instant ,
221- repo : RepoPath ,
225+ cliargs : CliArgs ,
222226 theme : Theme ,
223- select_file : Option < PathBuf > ,
224227 key_config : KeyConfig ,
225228 input : & Input ,
226229 updater : Updater ,
@@ -233,8 +236,9 @@ fn run_app(
233236
234237 let ( rx_ticker, rx_watcher) = match updater {
235238 Updater :: NotifyWatcher => {
236- let repo_watcher =
237- RepoWatcher :: new ( repo_work_dir ( & repo) ?. as_str ( ) ) ;
239+ let repo_watcher = RepoWatcher :: new (
240+ repo_work_dir ( & cliargs. repo_path ) ?. as_str ( ) ,
241+ ) ;
238242
239243 ( never ( ) , repo_watcher. receiver ( ) )
240244 }
@@ -244,12 +248,11 @@ fn run_app(
244248 let spinner_ticker = tick ( SPINNER_INTERVAL ) ;
245249
246250 let mut app = App :: new (
247- RefCell :: new ( repo ) ,
251+ cliargs ,
248252 tx_git,
249253 tx_app,
250254 input. clone ( ) ,
251255 theme,
252- select_file,
253256 key_config,
254257 ) ?;
255258
0 commit comments