mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Clippy
This commit is contained in:
@@ -16,10 +16,11 @@
|
|||||||
|
|
||||||
## 0.4.0
|
## 0.4.0
|
||||||
|
|
||||||
Released on FIXME: date
|
Released on 27/03/2021
|
||||||
|
|
||||||
- **New explorer features**:
|
- **New explorer features**:
|
||||||
- **Execute** a command pressing `X`. This feature is supported on both local and remote hosts (only SFTP/SCP protocols support this feature).
|
- **Execute** a command pressing `X`. This feature is supported on both local and remote hosts (only SFTP/SCP protocols support this feature).
|
||||||
|
- **Find**: search for files pressing `F` using wild matches.
|
||||||
- Enhancements:
|
- Enhancements:
|
||||||
- Input fields will now support **"input keys"** (such as moving cursor, DEL, END, HOME, ...)
|
- Input fields will now support **"input keys"** (such as moving cursor, DEL, END, HOME, ...)
|
||||||
- Improved performance regarding configuration I/O (config client is now shared in the activity context)
|
- Improved performance regarding configuration I/O (config client is now shared in the activity context)
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
~ Basically, WinSCP on a terminal ~
|
~ Basically, WinSCP on a terminal ~
|
||||||
Developed by Christian Visintin
|
Developed by Christian Visintin
|
||||||
Current version: 0.4.0 FIXME: (28/02/2021)
|
Current version: 0.4.0 (27/03/2021)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -351,6 +351,7 @@ If left empty, the default formatter syntax will be used: `{NAME:24} {PEX} {USER
|
|||||||
| `<C>` | Copy file/directory | Copy |
|
| `<C>` | Copy file/directory | Copy |
|
||||||
| `<D>` | Make directory | Directory |
|
| `<D>` | Make directory | Directory |
|
||||||
| `<E>` | Delete file (Same as `DEL`) | Erase |
|
| `<E>` | Delete file (Same as `DEL`) | Erase |
|
||||||
|
| `<F>` | Search for files (wild match is supported) | Find |
|
||||||
| `<G>` | Go to supplied path | Go to |
|
| `<G>` | Go to supplied path | Go to |
|
||||||
| `<H>` | Show help | Help |
|
| `<H>` | Show help | Help |
|
||||||
| `<I>` | Show info about selected file or directory | Info |
|
| `<I>` | Show info about selected file or directory | Info |
|
||||||
@@ -380,7 +381,16 @@ The developer documentation can be found on Rust Docs at <https://docs.rs/termsc
|
|||||||
|
|
||||||
## Upcoming Features 🧪
|
## Upcoming Features 🧪
|
||||||
|
|
||||||
FIXME: add new
|
- **Themes provider**: I'm still thinking about how I will implement this, but basically the idea is to have a configuration file where it will be possible
|
||||||
|
to define the color schema for the entire application. I haven't planned this release yet
|
||||||
|
|
||||||
|
No other new feature is planned at the moment. I actually think that termscp is getting mature and now I should focus upcoming updates more on bug fixing and
|
||||||
|
code/performance improvements than on new features.
|
||||||
|
Anyway there are some ideas which I'd like to implement. If you want to start working on them, feel free to open a PR:
|
||||||
|
|
||||||
|
- Amazon S3 support
|
||||||
|
- Samba support
|
||||||
|
- Themes provider
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -83,11 +83,8 @@ impl AuthActivity {
|
|||||||
.view
|
.view
|
||||||
.get_value(super::COMPONENT_RADIO_BOOKMARK_SAVE_PWD)
|
.get_value(super::COMPONENT_RADIO_BOOKMARK_SAVE_PWD)
|
||||||
{
|
{
|
||||||
Some(Payload::Unsigned(choice)) => match choice {
|
Some(Payload::Unsigned(0)) => Some(password), // Yes
|
||||||
0 => Some(password), // Yes
|
_ => None, // No such component / No
|
||||||
_ => None, // No
|
|
||||||
},
|
|
||||||
_ => None, // No such component
|
|
||||||
},
|
},
|
||||||
false => None,
|
false => None,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -274,14 +274,10 @@ impl AuthActivity {
|
|||||||
Some(Payload::Text(s)) => s,
|
Some(Payload::Text(s)) => s,
|
||||||
_ => String::new(),
|
_ => String::new(),
|
||||||
};
|
};
|
||||||
let save_pwd: bool =
|
let save_pwd: bool = matches!(
|
||||||
match self.view.get_value(COMPONENT_RADIO_BOOKMARK_SAVE_PWD) {
|
self.view.get_value(COMPONENT_RADIO_BOOKMARK_SAVE_PWD),
|
||||||
Some(Payload::Unsigned(idx)) => match idx {
|
Some(Payload::Unsigned(0))
|
||||||
0 => true,
|
);
|
||||||
_ => false,
|
|
||||||
},
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
// Save bookmark
|
// Save bookmark
|
||||||
self.save_bookmark(bookmark_name, save_pwd);
|
self.save_bookmark(bookmark_name, save_pwd);
|
||||||
// Umount popup
|
// Umount popup
|
||||||
|
|||||||
@@ -732,16 +732,13 @@ impl FileTransferActivity {
|
|||||||
{
|
{
|
||||||
Some(props) => {
|
Some(props) => {
|
||||||
// Get width
|
// Get width
|
||||||
let width: usize = match self
|
let width: usize = self
|
||||||
.context
|
.context
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.store
|
.store
|
||||||
.get_unsigned(super::STORAGE_EXPLORER_WIDTH)
|
.get_unsigned(super::STORAGE_EXPLORER_WIDTH)
|
||||||
{
|
.unwrap_or(256);
|
||||||
Some(val) => val,
|
|
||||||
None => 256, // Default
|
|
||||||
};
|
|
||||||
let hostname: String = match hostname::get() {
|
let hostname: String = match hostname::get() {
|
||||||
Ok(h) => {
|
Ok(h) => {
|
||||||
let hostname: String = h.as_os_str().to_string_lossy().to_string();
|
let hostname: String = h.as_os_str().to_string_lossy().to_string();
|
||||||
@@ -787,16 +784,13 @@ impl FileTransferActivity {
|
|||||||
{
|
{
|
||||||
Some(props) => {
|
Some(props) => {
|
||||||
// Get width
|
// Get width
|
||||||
let width: usize = match self
|
let width: usize = self
|
||||||
.context
|
.context
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.store
|
.store
|
||||||
.get_unsigned(super::STORAGE_EXPLORER_WIDTH)
|
.get_unsigned(super::STORAGE_EXPLORER_WIDTH)
|
||||||
{
|
.unwrap_or(256);
|
||||||
Some(val) => val,
|
|
||||||
None => 256, // Default
|
|
||||||
};
|
|
||||||
let params = self.context.as_ref().unwrap().ft_params.as_ref().unwrap();
|
let params = self.context.as_ref().unwrap().ft_params.as_ref().unwrap();
|
||||||
let hostname: String = format!(
|
let hostname: String = format!(
|
||||||
"{}:{} ",
|
"{}:{} ",
|
||||||
@@ -830,16 +824,13 @@ impl FileTransferActivity {
|
|||||||
match self.view.get_props(super::COMPONENT_LOG_BOX).as_mut() {
|
match self.view.get_props(super::COMPONENT_LOG_BOX).as_mut() {
|
||||||
Some(props) => {
|
Some(props) => {
|
||||||
// Get width
|
// Get width
|
||||||
let width: usize = match self
|
let width: usize = self
|
||||||
.context
|
.context
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.store
|
.store
|
||||||
.get_unsigned(super::STORAGE_LOGBOX_WIDTH)
|
.get_unsigned(super::STORAGE_LOGBOX_WIDTH)
|
||||||
{
|
.unwrap_or(256);
|
||||||
Some(val) => val,
|
|
||||||
None => 256, // Default
|
|
||||||
};
|
|
||||||
// Make log entries
|
// Make log entries
|
||||||
let mut table: TableBuilder = TableBuilder::default();
|
let mut table: TableBuilder = TableBuilder::default();
|
||||||
for (idx, record) in self.log_records.iter().enumerate() {
|
for (idx, record) in self.log_records.iter().enumerate() {
|
||||||
@@ -952,8 +943,8 @@ impl FileTransferActivity {
|
|||||||
None => None,
|
None => None,
|
||||||
Some(props) => {
|
Some(props) => {
|
||||||
let props = props.build();
|
let props = props.build();
|
||||||
let title: String = props.texts.title.clone().unwrap_or(String::new());
|
let title: String = props.texts.title.clone().unwrap_or_default();
|
||||||
let mut props = PropsBuilder::from(props.clone());
|
let mut props = PropsBuilder::from(props);
|
||||||
// Prepare files
|
// Prepare files
|
||||||
let file_texts: Vec<TextSpan> = self
|
let file_texts: Vec<TextSpan> = self
|
||||||
.found
|
.found
|
||||||
|
|||||||
@@ -703,7 +703,7 @@ impl SetupActivity {
|
|||||||
.get_props(super::COMPONENT_INPUT_FILE_FMT)
|
.get_props(super::COMPONENT_INPUT_FILE_FMT)
|
||||||
.as_mut()
|
.as_mut()
|
||||||
{
|
{
|
||||||
let file_fmt: String = cli.get_file_fmt().unwrap_or(String::new());
|
let file_fmt: String = cli.get_file_fmt().unwrap_or_default();
|
||||||
let props = props.with_value(PropValue::Str(file_fmt)).build();
|
let props = props.with_value(PropValue::Str(file_fmt)).build();
|
||||||
let _ = self.view.update(super::COMPONENT_INPUT_FILE_FMT, props);
|
let _ = self.view.update(super::COMPONENT_INPUT_FILE_FMT, props);
|
||||||
}
|
}
|
||||||
@@ -734,19 +734,13 @@ impl SetupActivity {
|
|||||||
if let Some(Payload::Unsigned(opt)) =
|
if let Some(Payload::Unsigned(opt)) =
|
||||||
self.view.get_value(super::COMPONENT_RADIO_HIDDEN_FILES)
|
self.view.get_value(super::COMPONENT_RADIO_HIDDEN_FILES)
|
||||||
{
|
{
|
||||||
let show: bool = match opt {
|
let show: bool = matches!(opt, 0);
|
||||||
0 => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
cli.set_show_hidden_files(show);
|
cli.set_show_hidden_files(show);
|
||||||
}
|
}
|
||||||
if let Some(Payload::Unsigned(opt)) =
|
if let Some(Payload::Unsigned(opt)) =
|
||||||
self.view.get_value(super::COMPONENT_RADIO_UPDATES)
|
self.view.get_value(super::COMPONENT_RADIO_UPDATES)
|
||||||
{
|
{
|
||||||
let check: bool = match opt {
|
let check: bool = matches!(opt, 0);
|
||||||
0 => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
cli.set_check_for_updates(check);
|
cli.set_check_for_updates(check);
|
||||||
}
|
}
|
||||||
if let Some(Payload::Text(fmt)) = self.view.get_value(super::COMPONENT_INPUT_FILE_FMT) {
|
if let Some(Payload::Text(fmt)) = self.view.get_value(super::COMPONENT_INPUT_FILE_FMT) {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ impl OwnStates {
|
|||||||
///
|
///
|
||||||
/// Delete element at cursor -1; then decrement cursor by 1
|
/// Delete element at cursor -1; then decrement cursor by 1
|
||||||
pub fn backspace(&mut self) {
|
pub fn backspace(&mut self) {
|
||||||
if self.cursor > 0 && self.input.len() > 0 {
|
if self.cursor > 0 && !self.input.is_empty() {
|
||||||
self.input.remove(self.cursor - 1);
|
self.input.remove(self.cursor - 1);
|
||||||
// Decrement cursor
|
// Decrement cursor
|
||||||
self.cursor -= 1;
|
self.cursor -= 1;
|
||||||
@@ -106,7 +106,7 @@ impl OwnStates {
|
|||||||
///
|
///
|
||||||
/// Increment cursor value by one if possible
|
/// Increment cursor value by one if possible
|
||||||
pub fn incr_cursor(&mut self) {
|
pub fn incr_cursor(&mut self) {
|
||||||
if self.cursor + 1 <= self.input.len() {
|
if self.cursor < self.input.len() {
|
||||||
self.cursor += 1;
|
self.cursor += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ impl OwnStates {
|
|||||||
/// ### make_choices
|
/// ### make_choices
|
||||||
///
|
///
|
||||||
/// Set OwnStates choices from a vector of text spans
|
/// Set OwnStates choices from a vector of text spans
|
||||||
pub fn make_choices(&mut self, spans: &Vec<TextSpan>) {
|
pub fn make_choices(&mut self, spans: &[TextSpan]) {
|
||||||
self.choices = spans.iter().map(|x| x.content.clone()).collect();
|
self.choices = spans.iter().map(|x| x.content.clone()).collect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user