From fa089c23c98cf1a77059ee60755388648724464b Mon Sep 17 00:00:00 2001 From: veeso Date: Mon, 7 Oct 2024 10:17:02 +0200 Subject: [PATCH] fix: start activity --- src/cli/remote.rs | 6 ++++++ src/main.rs | 10 ++++++++-- src/ui/activities/auth/update.rs | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/cli/remote.rs b/src/cli/remote.rs index c6dccfc..4ba6b38 100644 --- a/src/cli/remote.rs +++ b/src/cli/remote.rs @@ -104,6 +104,12 @@ pub enum Remote { None, } +impl Remote { + pub fn is_none(&self) -> bool { + matches!(self, Self::None) + } +} + /// Bookmark parameters #[derive(Debug)] pub struct BookmarkParams { diff --git a/src/main.rs b/src/main.rs index 631cafd..2b24b71 100644 --- a/src/main.rs +++ b/src/main.rs @@ -87,11 +87,17 @@ fn parse_args(args: Args) -> Result { Ok(remote) => { // Set params run_opts.remote = remote; - // In this case the first activity will be FileTransfer - run_opts.task = Task::Activity(NextActivity::FileTransfer); } } + // set activity based on remote state + run_opts.task = + if run_opts.remote.remote.is_none() || run_opts.remote.host_bridge.is_none() { + Task::Activity(NextActivity::Authentication) + } else { + Task::Activity(NextActivity::FileTransfer) + }; + // Local directory if let Some(localdir) = run_opts.remote.local_dir.as_deref() { if let Err(err) = env::set_current_dir(localdir) { diff --git a/src/ui/activities/auth/update.rs b/src/ui/activities/auth/update.rs index f6f00cf..e00b5bf 100644 --- a/src/ui/activities/auth/update.rs +++ b/src/ui/activities/auth/update.rs @@ -30,6 +30,7 @@ impl AuthActivity { self.save_recent(); // Set file transfer params to context self.context_mut().set_remote_params(params); + // TODO: set host bridge params // Set exit reason self.exit_reason = Some(super::ExitReason::Connect); }