mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
fix: start activity
This commit is contained in:
@@ -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 {
|
||||
|
||||
10
src/main.rs
10
src/main.rs
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user