Small cleanup
This commit is contained in:
parent
90d85df482
commit
9271bce02a
14
README.md
14
README.md
|
@ -1,4 +1,10 @@
|
||||||
# ShareXtended
|
<h1 align="center">ShareXtended</h1>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://github.com/IndyV/sharextended/actions/workflows/build.yml">
|
||||||
|
<img src="https://github.com/IndyV/sharextended/actions/workflows/build.yml/badge.svg" alt="Build status">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
A Rusty program that provides ShareX utility commands.
|
A Rusty program that provides ShareX utility commands.
|
||||||
|
|
||||||
|
@ -15,8 +21,8 @@ Options:
|
||||||
-h, --help Print help information
|
-h, --help Print help information
|
||||||
-V, --version Print version information
|
-V, --version Print version information
|
||||||
```
|
```
|
||||||
> If `[COMMAND]` is not specified the program will run in interactive mode.
|
|
||||||
|
|
||||||
|
> If `[COMMAND]` is not specified the program will run in interactive mode.
|
||||||
|
|
||||||
## Motivation
|
## Motivation
|
||||||
|
|
||||||
|
@ -28,6 +34,7 @@ Recently I just wanted to try out [the most loved language](https://survey.stack
|
||||||
So I decided to try Rust, and it worked like a charm.
|
So I decided to try Rust, and it worked like a charm.
|
||||||
|
|
||||||
Yes, I know this project could have also been done in many other (easier) ways, like:
|
Yes, I know this project could have also been done in many other (easier) ways, like:
|
||||||
|
|
||||||
- C#, powerful and also matching the language of the ShareX project.
|
- C#, powerful and also matching the language of the ShareX project.
|
||||||
- Or even simpler as a Powershell or Python script probably
|
- Or even simpler as a Powershell or Python script probably
|
||||||
|
|
||||||
|
@ -36,8 +43,8 @@ But this project wasn't for any business related task and I wanted to try out Ru
|
||||||
It's a bit hard to get started with due to these new concepts, like ownership, borrowing, and lifetimes, but I really like it.
|
It's a bit hard to get started with due to these new concepts, like ownership, borrowing, and lifetimes, but I really like it.
|
||||||
It's a very powerful language with great error messages and many useful crates. I'm looking forward to learn more about it.
|
It's a very powerful language with great error messages and many useful crates. I'm looking forward to learn more about it.
|
||||||
|
|
||||||
|
|
||||||
### Code
|
### Code
|
||||||
|
|
||||||
Watching video's from [No Boilerplate](https://www.youtube.com/c/NoBoilerplate) motivated me to try out Rust. On advise about your Rust toolkit, he suggested the following Clippy lints:
|
Watching video's from [No Boilerplate](https://www.youtube.com/c/NoBoilerplate) motivated me to try out Rust. On advise about your Rust toolkit, he suggested the following Clippy lints:
|
||||||
|
|
||||||
```ps1
|
```ps1
|
||||||
|
@ -51,6 +58,7 @@ I tried to store the static strings in the `Cargo.toml`, but I figured it's not
|
||||||
I used https://transform.tools/json-to-rust-serde as a reference for the JSON structure.
|
I used https://transform.tools/json-to-rust-serde as a reference for the JSON structure.
|
||||||
|
|
||||||
#### Crates used
|
#### Crates used
|
||||||
|
|
||||||
- `eyre`: For simple error reporting
|
- `eyre`: For simple error reporting
|
||||||
- `tokyo` & `futures`: For writing async Rust
|
- `tokyo` & `futures`: For writing async Rust
|
||||||
- `serde` & `serde_json`: For (JSON) Serialization/Deserialization
|
- `serde` & `serde_json`: For (JSON) Serialization/Deserialization
|
||||||
|
|
|
@ -10,19 +10,14 @@ use serde::{Deserialize, Serialize};
|
||||||
use std::{io::Read, path::PathBuf};
|
use std::{io::Read, path::PathBuf};
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "PascalCase")]
|
||||||
struct HistoryItem {
|
struct HistoryItem {
|
||||||
#[serde(rename = "FileName")]
|
|
||||||
pub file_name: String,
|
pub file_name: String,
|
||||||
#[serde(rename = "FilePath")]
|
|
||||||
pub file_path: Option<String>,
|
pub file_path: Option<String>,
|
||||||
#[serde(rename = "DateTime")]
|
|
||||||
pub date_time: DateTime<Local>,
|
pub date_time: DateTime<Local>,
|
||||||
#[serde(rename = "Type")]
|
#[serde(rename = "Type")]
|
||||||
pub type_field: String,
|
pub type_field: String,
|
||||||
#[serde(rename = "Host")]
|
|
||||||
pub host: String,
|
pub host: String,
|
||||||
#[serde(rename = "Tags")]
|
|
||||||
pub tags: Option<Tags>,
|
pub tags: Option<Tags>,
|
||||||
#[serde(rename = "URL")]
|
#[serde(rename = "URL")]
|
||||||
pub url: Option<String>,
|
pub url: Option<String>,
|
||||||
|
@ -33,11 +28,9 @@ struct HistoryItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "PascalCase")]
|
||||||
struct Tags {
|
struct Tags {
|
||||||
#[serde(rename = "WindowTitle")]
|
|
||||||
pub window_title: Option<String>,
|
pub window_title: Option<String>,
|
||||||
#[serde(rename = "ProcessName")]
|
|
||||||
pub process_name: String,
|
pub process_name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue