tools: align `xkbcli how-to-type` output ourselves Can possibly add a machine-parsable format if desired, but for now just have it work nicely. Signed-off-by: Ran Benita <ran@unusedvar.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
diff --git a/tools/how-to-type.c b/tools/how-to-type.c
index 903a3ed..0a6f79e 100644
--- a/tools/how-to-type.c
+++ b/tools/how-to-type.c
@@ -38,7 +38,6 @@ usage(const char *argv0, FILE *fp)
fprintf(fp, "Usage: %s [--rules <rules>] [--model <model>] "
"[--layout <layout>] [--variant <variant>] [--options <options>]"
" <unicode codepoint>\n", argv0);
- fprintf(fp, "Pipe into `column -ts $'\\t'` for nicely aligned output.\n");
}
int
@@ -155,7 +154,8 @@ main(int argc, char *argv[])
}
printf("keysym: %s (%#x)\n", name, keysym);
- printf("KEYCODE\tKEY NAME\tLAYOUT#\tLAYOUT NAME\tLEVEL#\tMODIFIERS\n");
+ printf("%-8s %-9s %-8s %-20s %-7s %-s\n",
+ "KEYCODE", "KEY NAME", "LAYOUT", "LAYOUT NAME", "LEVEL#", "MODIFIERS");
min_keycode = xkb_keymap_min_keycode(keymap);
max_keycode = xkb_keymap_max_keycode(keymap);
@@ -202,7 +202,7 @@ main(int argc, char *argv[])
for (size_t i = 0; i < num_masks; i++) {
xkb_mod_mask_t mask = masks[i];
- printf("%u\t%s\t%u\t%s\t%u\t[ ",
+ printf("%-8u %-9s %-8u %-20s %-7u [ ",
keycode, key_name, layout + 1, layout_name, level + 1);
for (xkb_mod_index_t mod = 0; mod < num_mods; mod++) {
if ((mask & (1 << mod)) == 0) {
diff --git a/tools/xkbcli-how-to-type.1 b/tools/xkbcli-how-to-type.1
index a697e20..5211d0f 100644
--- a/tools/xkbcli-how-to-type.1
+++ b/tools/xkbcli-how-to-type.1
@@ -13,11 +13,8 @@
.
.Sh DESCRIPTION
.Nm
-prints key sequences to type the given Unicode codepoint.
-.Pp
-Pipe into
-.Dq "column \-ts $\'\e\et\'"
-for nicely aligned output.
+prints the key combinations (keycode + modifiers) in the keymap's layouts which
+would produce the given Unicode codepoint.
.
.Bl -tag -width Ds
.It Fl \-rules Ar rules