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.
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]]
name = "atty"
version = "0.2.14"
@ -22,6 +13,12 @@ dependencies = [
"winapi",
]
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bitflags"
version = "1.3.2"
@ -30,17 +27,35 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "clap"
version = "2.33.3"
version = "3.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
checksum = "ab8b79fe3946ceb4a0b1c080b4018992b8d27e9ff363644c1c9b6387c854614d"
dependencies = [
"ansi_term",
"atty",
"bitflags",
"clap_lex",
"indexmap",
"strsim",
"termcolor",
"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]]
@ -49,6 +64,12 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de853764b47027c2e862a995c34978ffa63c1501f2e15f987ba11bd4f9bba193"
[[package]]
name = "hashbrown"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "607c8a29735385251a339424dd462993c0fed8fa09d378f259377df08c126022"
[[package]]
name = "hermit-abi"
version = "0.1.19"
@ -58,46 +79,57 @@ dependencies = [
"libc",
]
[[package]]
name = "indexmap"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]]
name = "lamp"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"clap",
"clap_complete",
"exitcode",
]
[[package]]
name = "libc"
version = "0.2.105"
version = "0.2.126"
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]]
name = "strsim"
version = "0.8.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "textwrap"
version = "0.11.0"
name = "termcolor"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"unicode-width",
"winapi-util",
]
[[package]]
name = "unicode-width"
version = "0.1.9"
name = "textwrap"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
[[package]]
name = "winapi"
@ -115,6 +147,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
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]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"

View file

@ -1,6 +1,6 @@
[package]
name = "lamp"
version = "0.2.0"
version = "0.2.1"
authors = ["crapStone <crapstone01@gmail.com>"]
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
[build-dependencies]
clap = "2.33.3"
clap = "3.2.12"
clap_complete = "3.2.3"
[dependencies]
clap = "2.33.3"
clap = "3.2.12"
exitcode = "1.1.2"
[profile.release]
lto = true
panic = "abort"
strip = true
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");
fn main() {
let outdir = "completions"; // match env::var_os("OUT_DIR") {
// None => return,
// Some(outdir) => outdir,
// };
let mut app = build_cli();
app.gen_completions("lamp", Shell::Fish, outdir);
// app.gen_completions("lamp", Shell::Zsh, outdir); // TODO search for bug
app.gen_completions("lamp", Shell::Bash, outdir);
fn main() -> Result<(), Error> {
let outdir = "completions";
let mut cmd = build_cli();
let path = generate_completions(shells::Bash, &mut cmd, outdir)?;
println!("cargo:debug=completion file is generated: {:?}", path);
let path = generate_completions(shells::Zsh, &mut cmd, outdir)?;
println!("cargo:debug=completion file is generated: {:?}", path);
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};
pub fn build_cli() -> App<'static, 'static> {
pub fn build_cli() -> App<'static> {
App::new("lamp")
.version(env!("CARGO_PKG_VERSION"))
.author("crapStone <crapstone01@gmail.com>")
@ -8,7 +8,7 @@ pub fn build_cli() -> App<'static, 'static> {
.global_setting(clap::AppSettings::ArgRequiredElseHelp)
.arg(
Arg::with_name("set")
.short("s")
.short('s')
.long("set")
.value_name("VALUE")
.help("Sets brightness to given value")
@ -16,7 +16,7 @@ pub fn build_cli() -> App<'static, 'static> {
)
.arg(
Arg::with_name("inc")
.short("i")
.short('i')
.long("increase")
.value_name("PERCENT")
.help("Increases brightness")
@ -24,7 +24,7 @@ pub fn build_cli() -> App<'static, 'static> {
)
.arg(
Arg::with_name("dec")
.short("d")
.short('d')
.long("decrease")
.value_name("PERCENT")
.help("Decreases brightness")
@ -32,19 +32,19 @@ pub fn build_cli() -> App<'static, 'static> {
)
.arg(
Arg::with_name("get")
.short("g")
.short('g')
.long("get")
.help("Prints current brightness value"),
)
.arg(
Arg::with_name("zer")
.short("z")
.short('z')
.long("zero")
.help("Sets brightness to lowest value"),
)
.arg(
Arg::with_name("ful")
.short("f")
.short('f')
.long("full")
.help("Sets brightness to highest value"),
)
@ -54,14 +54,14 @@ pub fn build_cli() -> App<'static, 'static> {
)
.arg(
Arg::with_name("list")
.short("l")
.short('l')
.long("list")
.help("Lists all available brightness and led controllers")
.conflicts_with_all(&["brightness_control"]),
)
.arg(
Arg::with_name("ctrl_type")
.short("t")
.short('t')
.long("type")
.value_name("controller_type")
.takes_value(true)