chore: update

This commit is contained in:
MedzikUser 2022-05-22 15:46:54 +02:00
parent 51111180d9
commit 002c36c3d0
No known key found for this signature in database
GPG Key ID: A5FAC1E185C112DB
7 changed files with 19 additions and 50 deletions

4
.gitignore vendored
View File

@ -1,2 +1,6 @@
# Cargo
/target
# IDEs
.vscode
.idea

22
Cargo.lock generated
View File

@ -159,16 +159,6 @@ dependencies = [
"winapi 0.3.9",
]
[[package]]
name = "ctrlc"
version = "3.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b37feaa84e6861e00a1f5e5aa8da3ee56d605c9992d33e082786754828e20865"
dependencies = [
"nix",
"winapi 0.3.9",
]
[[package]]
name = "discord-rich-presence"
version = "0.2.0"
@ -191,7 +181,6 @@ dependencies = [
"clap_complete",
"clap_mangen",
"colored",
"ctrlc",
"discord-rich-presence",
]
@ -293,17 +282,6 @@ dependencies = [
"autocfg",
]
[[package]]
name = "nix"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9"
dependencies = [
"bitflags",
"cfg-if",
"libc",
]
[[package]]
name = "object"
version = "0.27.1"

View File

@ -18,12 +18,8 @@ codegen-units = 1
[dependencies]
better-panic = "0.3.0"
clap = { version = "3.1.18", features = ["derive"] }
clap_complete = "3.1.4"
clap_mangen = "0.1.6"
colored = "2.0.0"
discord-rich-presence = "0.2.0"
ctrlc = "3.2.2"
clap_mangen = "0.1.6"
[dependencies.clap]
version = "3.1.18"
features = ["derive", "cargo", "std"]

View File

@ -4,18 +4,18 @@
### Big image, small image, details and one button
![discord rpc 1](https://cdn.magicuser.cf/6MmBURG.png)
![](https://i.imgur.com/6MmBURG.png)
```bash
discordrpc -c 942151169185316874 -d 'untypeable nickname' --button-1-text 'Discord RPC written in Rust' --button-1-url 'https://github.com/MedzikUser/discord-rpc' -N medzik -I medzik -n archlinux -i archlinux`
discordrpc --client-id 942151169185316874 --details 'untypeable nickname' --button-1-text 'Discord RPC written in Rust' --button-1-url 'https://github.com/MedzikUser/discord-rpc' --large-image medzik --large-image-text medzik --small-image archlinux --small-image-text archlinux
```
### Big image, details, state and two buttons
![discord rpc 2](https://cdn.magicuser.cf/tRbcy40.png)
![](https://i.imgur.com/tRbcy40.png)
```bash
discordrpc -c 942151169185316874 -d 'untypeable nickname' -s 'MedzikUser' --button-1-text 'Discord RPC written in Rust' --button-1-url 'https://github.com/MedzikUser/discord-rpc' --button-2-text 'GitHub' --button-2-url 'https://github.com/MedzikUser' -N medzik -I medzik
discordrpc --client-id 942151169185316874 --details 'untypeable nickname' --state 'MedzikUser' --button-1-text 'Discord RPC written in Rust' --button-1-url 'https://github.com/MedzikUser/discord-rpc' --button-2-text 'GitHub' --button-2-url 'https://github.com/MedzikUser' --large-image medzik --large-image-text medzik
```
## How to install?
@ -56,20 +56,20 @@ Make sure you have the latest version of Rust. Then you can run
1. Go to [Discord Developer Portal](https://discord.com/developers/applications)
2. Make New Application, name them freely (the name will be displayed in RPC)
![new app](https://cdn.magicuser.cf/RMUjPep.png)
![new app](https://i.imgur.com/RMUjPep.png)
3. Go to General Information
![general](https://cdn.magicuser.cf/yuQufwT.png)
![general](https://i.imgur.com/yuQufwT.png)
3. Copy ID
![copy id](https://cdn.magicuser.cf/JDHZ6jy.png)
![copy id](https://i.imgur.com/JDHZ6jy.png)
5. Then go to the Rich Presence tab (optional)
![rich presence](https://cdn.magicuser.cf/hIB5VEW.png)
![rich presence](https://i.imgur.com/hIB5VEW.png)
6. Add images to be able to display them in RPC (optional)
![add image](https://cdn.magicuser.cf/vtEs7v6.png)
![add image](https://i.imgur.com/vtEs7v6.png)

View File

@ -1,3 +0,0 @@
pub mod parse;
pub use parse::Cli;

View File

@ -11,15 +11,9 @@ use crate::cli::Cli;
fn main() {
better_panic::install();
ctrlc::set_handler(move || {
println!("{}", "Bye!".red());
exit(0)
})
.expect("Error setting Ctrl-C handler");
let args = Cli::parse();
// * print completions
// print completions
if let Some(shell) = args.print_completions {
let mut clap_app = Cli::command();
let app_name = clap_app.get_name().to_string();
@ -28,7 +22,7 @@ fn main() {
exit(0)
}
// * print manpage
// print manpage
if args.manpage {
let clap_app = Cli::command();
let man = clap_mangen::Man::new(clap_app);
@ -37,7 +31,7 @@ fn main() {
exit(0)
}
// * start discord rpc
// start discord rpc
execute::run(args.clone());
println!(
@ -54,7 +48,7 @@ fn main() {
exit(0)
} else {
loop {
// * empty `loop {}` wastes CPU cycles
// empty `loop {}` wastes CPU cycles
sleep(Duration::from_secs(9999999));
}
}