mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Ask password before cleaning screen
This commit is contained in:
@@ -1,10 +1,17 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
- [Changelog](#changelog)
|
- [Changelog](#changelog)
|
||||||
|
- [0.1.1](#011)
|
||||||
- [0.1.0](#010)
|
- [0.1.0](#010)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 0.1.1
|
||||||
|
|
||||||
|
Work in progress
|
||||||
|
|
||||||
|
- password prompt: ask before performing terminal clear
|
||||||
|
|
||||||
## 0.1.0
|
## 0.1.0
|
||||||
|
|
||||||
Released on 06/12/2020
|
Released on 06/12/2020
|
||||||
|
|||||||
21
src/main.rs
21
src/main.rs
@@ -134,17 +134,9 @@ fn main() {
|
|||||||
Ok(dir) => dir,
|
Ok(dir) => dir,
|
||||||
Err(_) => PathBuf::from("/"),
|
Err(_) => PathBuf::from("/"),
|
||||||
};
|
};
|
||||||
// Create activity manager
|
|
||||||
let mut manager: ActivityManager = match ActivityManager::new(&wrkdir, ticks) {
|
|
||||||
Ok(m) => m,
|
|
||||||
Err(_) => {
|
|
||||||
eprintln!("Invalid directory '{}'", wrkdir.display());
|
|
||||||
std::process::exit(255);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// Initialize client if necessary
|
// Initialize client if necessary
|
||||||
let mut start_activity: NextActivity = NextActivity::Authentication;
|
let mut start_activity: NextActivity = NextActivity::Authentication;
|
||||||
if let Some(address) = address {
|
if address.is_some() {
|
||||||
if password.is_none() {
|
if password.is_none() {
|
||||||
// Ask password if unspecified
|
// Ask password if unspecified
|
||||||
password = match rpassword::read_password_from_tty(Some("Password: ")) {
|
password = match rpassword::read_password_from_tty(Some("Password: ")) {
|
||||||
@@ -163,6 +155,17 @@ fn main() {
|
|||||||
}
|
}
|
||||||
// In this case the first activity will be FileTransfer
|
// In this case the first activity will be FileTransfer
|
||||||
start_activity = NextActivity::FileTransfer;
|
start_activity = NextActivity::FileTransfer;
|
||||||
|
}
|
||||||
|
// Create activity manager (and context too)
|
||||||
|
let mut manager: ActivityManager = match ActivityManager::new(&wrkdir, ticks) {
|
||||||
|
Ok(m) => m,
|
||||||
|
Err(_) => {
|
||||||
|
eprintln!("Invalid directory '{}'", wrkdir.display());
|
||||||
|
std::process::exit(255);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// Set file transfer params if set
|
||||||
|
if let Some(address) = address {
|
||||||
manager.set_filetransfer_params(address, port, protocol, username, password);
|
manager.set_filetransfer_params(address, port, protocol, username, password);
|
||||||
}
|
}
|
||||||
// Run
|
// Run
|
||||||
|
|||||||
Reference in New Issue
Block a user