fix: start activity
Some checks failed
Linux / build (push) Has been cancelled
MacOS / build (push) Has been cancelled
Windows / build (push) Has been cancelled

This commit is contained in:
veeso
2024-10-07 10:17:02 +02:00
parent 4d4c71106d
commit fa089c23c9
3 changed files with 15 additions and 2 deletions

View File

@@ -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 {

View File

@@ -87,11 +87,17 @@ fn parse_args(args: Args) -> Result<RunOpts, String> {
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) {

View File

@@ -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);
}