From 002c36c3d05bd848ae461a0e16f37abc95061d61 Mon Sep 17 00:00:00 2001 From: MedzikUser Date: Sun, 22 May 2022 15:46:54 +0200 Subject: [PATCH] chore: update --- .gitignore | 4 ++++ Cargo.lock | 22 ---------------------- Cargo.toml | 8 ++------ README.md | 18 +++++++++--------- src/{cli/parse.rs => cli.rs} | 0 src/cli/mod.rs | 3 --- src/main.rs | 14 ++++---------- 7 files changed, 19 insertions(+), 50 deletions(-) rename src/{cli/parse.rs => cli.rs} (100%) delete mode 100644 src/cli/mod.rs diff --git a/.gitignore b/.gitignore index f675e85..087c22e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ # Cargo /target + +# IDEs +.vscode +.idea diff --git a/Cargo.lock b/Cargo.lock index cef66ec..faea323 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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" diff --git a/Cargo.toml b/Cargo.toml index 780c7e0..64b00f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] diff --git a/README.md b/README.md index dda3c35..d7e14b4 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/src/cli/parse.rs b/src/cli.rs similarity index 100% rename from src/cli/parse.rs rename to src/cli.rs diff --git a/src/cli/mod.rs b/src/cli/mod.rs deleted file mode 100644 index d630d11..0000000 --- a/src/cli/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod parse; - -pub use parse::Cli; diff --git a/src/main.rs b/src/main.rs index f67fb33..640ea5a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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)); } }