Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tool/src/main.rs: Allow non utf8 arguments within fan subcmd #65

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ repos:
args: ["--severity=warning"]

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v18.1.6' # Use the sha / tag you want to point at
rev: 'v19.1.0' # Use the sha / tag you want to point at
hooks:
- id: clang-format

Expand Down
4 changes: 2 additions & 2 deletions tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ fn main() {
.subcommand(SubCommand::with_name("console"))
.subcommand(SubCommand::with_name("fan")
.arg(Arg::with_name("index")
.value_parser(clap::value_parser!(u8))
.allow_invalid_utf8(true)
.required(true)
)
.arg(Arg::with_name("duty")
Expand Down Expand Up @@ -456,7 +456,7 @@ fn main() {
},
},
Some(("fan", sub_m)) => {
let index = sub_m.value_of("index").unwrap().parse::<u8>().unwrap();
let index = sub_m.value_of_os("index").unwrap().to_string_lossy().parse::<u8>().unwrap();
let duty_opt = sub_m.value_of("duty").map(|x| x.parse::<u8>().unwrap());
match duty_opt {
Some(duty) => match unsafe { fan_set(&mut ec, index, duty) } {
Expand Down