update dependencies

This commit is contained in:
crapStone 2022-07-15 23:34:09 +02:00
parent dbccffc135
commit 7d57c0a8a8
No known key found for this signature in database
GPG key ID: 4CAA9E39EEDEB1F0
4 changed files with 106 additions and 55 deletions

105
Cargo.lock generated
View file

@ -2,15 +2,6 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "ansi_term"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "atty" name = "atty"
version = "0.2.14" version = "0.2.14"
@ -22,6 +13,12 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.3.2" version = "1.3.2"
@ -30,17 +27,35 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "clap" name = "clap"
version = "2.33.3" version = "3.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" checksum = "ab8b79fe3946ceb4a0b1c080b4018992b8d27e9ff363644c1c9b6387c854614d"
dependencies = [ dependencies = [
"ansi_term",
"atty", "atty",
"bitflags", "bitflags",
"clap_lex",
"indexmap",
"strsim", "strsim",
"termcolor",
"textwrap", "textwrap",
"unicode-width", ]
"vec_map",
[[package]]
name = "clap_complete"
version = "3.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ead064480dfc4880a10764488415a97fdd36a4cf1bb022d372f02e8faf8386e1"
dependencies = [
"clap",
]
[[package]]
name = "clap_lex"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
dependencies = [
"os_str_bytes",
] ]
[[package]] [[package]]
@ -49,6 +64,12 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de853764b47027c2e862a995c34978ffa63c1501f2e15f987ba11bd4f9bba193" checksum = "de853764b47027c2e862a995c34978ffa63c1501f2e15f987ba11bd4f9bba193"
[[package]]
name = "hashbrown"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "607c8a29735385251a339424dd462993c0fed8fa09d378f259377df08c126022"
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.19" version = "0.1.19"
@ -58,46 +79,57 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "indexmap"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]] [[package]]
name = "lamp" name = "lamp"
version = "0.2.0" version = "0.2.1"
dependencies = [ dependencies = [
"clap", "clap",
"clap_complete",
"exitcode", "exitcode",
] ]
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.105" version = "0.2.126"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "869d572136620d55835903746bcb5cdc54cb2851fd0aeec53220b4bb65ef3013" checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
[[package]]
name = "os_str_bytes"
version = "6.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.8.0" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "textwrap" name = "termcolor"
version = "0.11.0" version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [ dependencies = [
"unicode-width", "winapi-util",
] ]
[[package]] [[package]]
name = "unicode-width" name = "textwrap"
version = "0.1.9" version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]] [[package]]
name = "winapi" name = "winapi"
@ -115,6 +147,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "winapi-x86_64-pc-windows-gnu" name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"

View file

@ -1,6 +1,6 @@
[package] [package]
name = "lamp" name = "lamp"
version = "0.2.0" version = "0.2.1"
authors = ["crapStone <crapstone01@gmail.com>"] authors = ["crapStone <crapstone01@gmail.com>"]
edition = "2021" edition = "2021"
@ -9,14 +9,15 @@ build = "build.rs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies] [build-dependencies]
clap = "2.33.3" clap = "3.2.12"
clap_complete = "3.2.3"
[dependencies] [dependencies]
clap = "2.33.3" clap = "3.2.12"
exitcode = "1.1.2" exitcode = "1.1.2"
[profile.release] [profile.release]
lto = true lto = true
panic = "abort" panic = "abort"
strip = true
codegen-units = 1 codegen-units = 1

View file

@ -1,14 +1,23 @@
use clap::Shell; use std::{path::PathBuf, io::Error};
use clap_complete::{generate_to, shells, Generator};
include!("src/cli.rs"); include!("src/cli.rs");
fn main() { fn main() -> Result<(), Error> {
let outdir = "completions"; // match env::var_os("OUT_DIR") { let outdir = "completions";
// None => return, let mut cmd = build_cli();
// Some(outdir) => outdir,
// }; let path = generate_completions(shells::Bash, &mut cmd, outdir)?;
let mut app = build_cli(); println!("cargo:debug=completion file is generated: {:?}", path);
app.gen_completions("lamp", Shell::Fish, outdir); let path = generate_completions(shells::Zsh, &mut cmd, outdir)?;
// app.gen_completions("lamp", Shell::Zsh, outdir); // TODO search for bug println!("cargo:debug=completion file is generated: {:?}", path);
app.gen_completions("lamp", Shell::Bash, outdir); let path = generate_completions(shells::Fish, &mut cmd, outdir)?;
println!("cargo:debug=completion file is generated: {:?}", path);
Ok(())
}
fn generate_completions<G: Generator>(shell: G, cmd: &mut clap::Command, outdir: &str) -> Result<PathBuf, Error> {
generate_to(shell, cmd, "lamp", outdir)
} }

View file

@ -1,6 +1,6 @@
use clap::{App, Arg, ArgGroup}; use clap::{App, Arg, ArgGroup};
pub fn build_cli() -> App<'static, 'static> { pub fn build_cli() -> App<'static> {
App::new("lamp") App::new("lamp")
.version(env!("CARGO_PKG_VERSION")) .version(env!("CARGO_PKG_VERSION"))
.author("crapStone <crapstone01@gmail.com>") .author("crapStone <crapstone01@gmail.com>")
@ -8,7 +8,7 @@ pub fn build_cli() -> App<'static, 'static> {
.global_setting(clap::AppSettings::ArgRequiredElseHelp) .global_setting(clap::AppSettings::ArgRequiredElseHelp)
.arg( .arg(
Arg::with_name("set") Arg::with_name("set")
.short("s") .short('s')
.long("set") .long("set")
.value_name("VALUE") .value_name("VALUE")
.help("Sets brightness to given value") .help("Sets brightness to given value")
@ -16,7 +16,7 @@ pub fn build_cli() -> App<'static, 'static> {
) )
.arg( .arg(
Arg::with_name("inc") Arg::with_name("inc")
.short("i") .short('i')
.long("increase") .long("increase")
.value_name("PERCENT") .value_name("PERCENT")
.help("Increases brightness") .help("Increases brightness")
@ -24,7 +24,7 @@ pub fn build_cli() -> App<'static, 'static> {
) )
.arg( .arg(
Arg::with_name("dec") Arg::with_name("dec")
.short("d") .short('d')
.long("decrease") .long("decrease")
.value_name("PERCENT") .value_name("PERCENT")
.help("Decreases brightness") .help("Decreases brightness")
@ -32,19 +32,19 @@ pub fn build_cli() -> App<'static, 'static> {
) )
.arg( .arg(
Arg::with_name("get") Arg::with_name("get")
.short("g") .short('g')
.long("get") .long("get")
.help("Prints current brightness value"), .help("Prints current brightness value"),
) )
.arg( .arg(
Arg::with_name("zer") Arg::with_name("zer")
.short("z") .short('z')
.long("zero") .long("zero")
.help("Sets brightness to lowest value"), .help("Sets brightness to lowest value"),
) )
.arg( .arg(
Arg::with_name("ful") Arg::with_name("ful")
.short("f") .short('f')
.long("full") .long("full")
.help("Sets brightness to highest value"), .help("Sets brightness to highest value"),
) )
@ -54,14 +54,14 @@ pub fn build_cli() -> App<'static, 'static> {
) )
.arg( .arg(
Arg::with_name("list") Arg::with_name("list")
.short("l") .short('l')
.long("list") .long("list")
.help("Lists all available brightness and led controllers") .help("Lists all available brightness and led controllers")
.conflicts_with_all(&["brightness_control"]), .conflicts_with_all(&["brightness_control"]),
) )
.arg( .arg(
Arg::with_name("ctrl_type") Arg::with_name("ctrl_type")
.short("t") .short('t')
.long("type") .long("type")
.value_name("controller_type") .value_name("controller_type")
.takes_value(true) .takes_value(true)