Skip to content

Commit c92cea8

Browse files
author
Patrick Carroll
committed
Document IR and key mappings
1 parent e136715 commit c92cea8

12 files changed

Lines changed: 1009 additions & 473 deletions

File tree

src/bin/qmk2zmk.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,29 +58,31 @@ fn run() -> Result<(), Error> {
5858

5959
let input = cli.input.expect("required_unless_present = list_keyboards");
6060

61-
let format = cli.format.unwrap_or_else(|| {
62-
match input.extension().and_then(|e| e.to_str()) {
63-
Some("c") => InputFormat::C,
61+
let format = cli
62+
.format
63+
.unwrap_or_else(|| match input.extension().and_then(|e| e.to_str()) {
64+
Some("c") => InputFormat::C,
6465
Some("json") => InputFormat::Json,
6566
_ => {
6667
eprintln!("warning: cannot detect format from extension, assuming C");
6768
InputFormat::C
6869
}
69-
}
70-
});
70+
});
7171

7272
let source = io::read_input(&input)?;
7373

7474
let keymap = match format {
75-
InputFormat::C => qmk::parse_c::parse(&source).map_err(Error::ParseC)?,
75+
InputFormat::C => qmk::parse_c::parse(&source).map_err(Error::ParseC)?,
7676
InputFormat::Json => qmk::parse_json::parse(&source).map_err(Error::ParseJson)?,
7777
};
7878

7979
if !cli.no_warn {
8080
qmk2zmk::warn_unknowns(&keymap);
8181
}
8282

83-
let cols = cli.cols.or_else(|| cli.keyboard.as_deref().and_then(codes::keyboard_cols));
83+
let cols = cli
84+
.cols
85+
.or_else(|| cli.keyboard.as_deref().and_then(codes::keyboard_cols));
8486
let output = zmk::render(&keymap, cols);
8587
io::write_output(&output, cli.output.as_deref())
8688
}

src/bin/zmk2qmk.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,12 @@ fn run() -> Result<(), Error> {
7373
qmk2zmk::warn_unknowns(&keymap);
7474
}
7575

76-
let cols = cli.cols.or_else(|| cli.keyboard.as_deref().and_then(codes::keyboard_cols));
76+
let cols = cli
77+
.cols
78+
.or_else(|| cli.keyboard.as_deref().and_then(codes::keyboard_cols));
7779
let output = match cli.format {
7880
OutputFormat::Json => qmk::render_json(&keymap),
79-
OutputFormat::C => qmk::render_c(&keymap, cols),
81+
OutputFormat::C => qmk::render_c(&keymap, cols),
8082
};
8183

8284
io::write_output(&output, cli.output.as_deref())

0 commit comments

Comments
 (0)