xkbcli: Promote compose to xkbcli-compile-compose
Previously this tool was only used for internal testing and thus not installed. But it is useful for debugging, much like xkbcli-compile-keymap.master
parent
79502700a6
commit
bc330c00e6
12
meson.build
12
meson.build
|
@ -460,6 +460,7 @@ if build_tools
|
|||
install: true,
|
||||
install_dir: dir_libexec)
|
||||
install_man('tools/xkbcli-compile-keymap.1')
|
||||
configh_data.set10('HAVE_XKBCLI_COMPILE_KEYMAP', true)
|
||||
# The same tool again, but with access to some private APIs.
|
||||
executable('compile-keymap',
|
||||
'tools/compile-keymap.c',
|
||||
|
@ -470,12 +471,13 @@ if build_tools
|
|||
install: false)
|
||||
|
||||
# Tool: compose
|
||||
executable('compose',
|
||||
'tools/compose.c',
|
||||
executable('xkbcli-compile-compose',
|
||||
'tools/compile-compose.c',
|
||||
dependencies: tools_dep,
|
||||
include_directories: [include_directories('src', 'include')],
|
||||
install: false)
|
||||
configh_data.set10('HAVE_XKBCLI_COMPILE_KEYMAP', true)
|
||||
install: true,
|
||||
install_dir: dir_libexec)
|
||||
install_man('tools/xkbcli-compile-compose.1')
|
||||
configh_data.set10('HAVE_XKBCLI_COMPILE_COMPOSE', true)
|
||||
|
||||
# Tool: how-to-type
|
||||
executable('xkbcli-how-to-type',
|
||||
|
|
|
@ -152,6 +152,7 @@ class TestXkbcli(unittest.TestCase):
|
|||
)
|
||||
cls.xkbcli_how_to_type = XkbcliTool("how-to-type")
|
||||
cls.xkbcli_compile_keymap = XkbcliTool("compile-keymap")
|
||||
cls.xkbcli_compile_compose = XkbcliTool("compile-compose")
|
||||
cls.xkbcli_interactive_evdev = XkbcliTool(
|
||||
"interactive-evdev",
|
||||
skipIf=(
|
||||
|
@ -197,6 +198,7 @@ class TestXkbcli(unittest.TestCase):
|
|||
cls.xkbcli_list,
|
||||
cls.xkbcli_how_to_type,
|
||||
cls.xkbcli_compile_keymap,
|
||||
cls.xkbcli_compile_compose,
|
||||
cls.xkbcli_interactive_evdev,
|
||||
cls.xkbcli_interactive_x11,
|
||||
cls.xkbcli_interactive_wayland,
|
||||
|
|
|
@ -36,13 +36,23 @@ static void
|
|||
usage(FILE *fp, char *progname)
|
||||
{
|
||||
fprintf(fp,
|
||||
"Usage: %s [--file FILE] [--locale LOCALE | --locale-from-env | --locale-from-setlocale]\n",
|
||||
"Usage: %s [--help] [--file FILE] [--locale LOCALE | --locale-from-env | --locale-from-setlocale]\n",
|
||||
progname);
|
||||
fprintf(fp,
|
||||
" --file - specify a file to load\n"
|
||||
" --locale - specify the locale directly\n"
|
||||
" --locale-from-env - get the locale from the LC_ALL/LC_CTYPE/LANG environment variables (falling back to C)\n"
|
||||
" --locale-from-setlocale - get the locale using setlocale(3)\n"
|
||||
"\n"
|
||||
"Compile a Compose file and print it\n"
|
||||
"\n"
|
||||
"Options:\n"
|
||||
" --help\n"
|
||||
" Print this help and exit\n"
|
||||
" --file FILE\n"
|
||||
" Specify a Compose file to load\n"
|
||||
" --locale LOCALE\n"
|
||||
" Specify the locale directly\n"
|
||||
" --locale-from-env\n"
|
||||
" Get the locale from the LC_ALL/LC_CTYPE/LANG environment variables (falling back to C)\n"
|
||||
" --locale-from-setlocale\n"
|
||||
" Get the locale using setlocale(3)\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -88,6 +98,7 @@ main(int argc, char *argv[])
|
|||
OPT_LOCALE_FROM_SETLOCALE,
|
||||
};
|
||||
static struct option opts[] = {
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"file", required_argument, 0, OPT_FILE},
|
||||
{"locale", required_argument, 0, OPT_LOCALE},
|
||||
{"locale-from-env", no_argument, 0, OPT_LOCALE_FROM_ENV},
|
||||
|
@ -162,7 +173,8 @@ main(int argc, char *argv[])
|
|||
xkb_compose_table_new_from_locale(ctx, locale,
|
||||
XKB_COMPOSE_COMPILE_NO_FLAGS);
|
||||
if (!compose_table) {
|
||||
fprintf(stderr, "Couldn't create compose from locale\n");
|
||||
fprintf(stderr,
|
||||
"Couldn't create compose from locale \"%s\"\n", locale);
|
||||
goto out;
|
||||
}
|
||||
}
|
|
@ -73,6 +73,13 @@ ___xkbcli_subcommand()
|
|||
return;;
|
||||
esac
|
||||
;;
|
||||
compile-compose)
|
||||
case ${COMP_WORDS[COMP_CWORD-1]} in
|
||||
--file)
|
||||
_filedir
|
||||
return;;
|
||||
esac
|
||||
;;
|
||||
list)
|
||||
if [[ ${COMP_WORDS[COMP_CWORD]} != -* ]]; then
|
||||
_filedir
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
.Dd November 7, 2023
|
||||
.Dt XKBCLI\-COMPILE\-COMPOSE 1
|
||||
.Os
|
||||
.
|
||||
.Sh NAME
|
||||
.Nm "xkbcli compile-compose"
|
||||
.Nd compile a Compose file
|
||||
.
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Ar options
|
||||
.
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
compile and print a Compose file based on the given options
|
||||
.
|
||||
.Bl -tag -width Ds
|
||||
.It Fl \-help
|
||||
Print help and exit
|
||||
.
|
||||
.It Fl \-file Ar FILE
|
||||
Specify a Compose file to load
|
||||
.
|
||||
.It Fl \-locale Ar LOCALE
|
||||
Specify a locale
|
||||
.
|
||||
.It Fl \-locale-from-env
|
||||
Get the locale from the LC_ALL/LC_CTYPE/LANG environment variables
|
||||
(falling back to C)
|
||||
.
|
||||
.It Fl \-locale\-from\-setlocale
|
||||
Get the locale using
|
||||
.Xr setlocale 3
|
||||
.El
|
||||
.
|
||||
.Sh SEE ALSO
|
||||
.Xr xkbcli 1 ,
|
||||
.Xr Compose 5 ,
|
||||
.Lk https://xkbcommon.org "The libxkbcommon online documentation"
|
|
@ -30,7 +30,11 @@ Print the version and exit
|
|||
.It Ic compile\-keymap
|
||||
Compile an XKB keymap, see
|
||||
.Xr xkbcli\-compile\-keymap 1
|
||||
|
||||
.
|
||||
.It Ic compile\-compose
|
||||
Compile a compose file, see
|
||||
.Xr xkbcli\-compile\-compose 1
|
||||
.
|
||||
.It Ic how\-to\-type
|
||||
Show how to type a given Unicode codepoint, see
|
||||
.Xr xkbcli\-how\-to\-type 1
|
||||
|
|
|
@ -66,6 +66,11 @@ usage(void)
|
|||
" Compile an XKB keymap\n"
|
||||
"\n"
|
||||
#endif
|
||||
#if HAVE_XKBCLI_COMPILE_COMPOSE
|
||||
" compile-compose\n"
|
||||
" Compile a Compose file\n"
|
||||
"\n"
|
||||
#endif
|
||||
#if HAVE_XKBCLI_HOW_TO_TYPE
|
||||
" how-to-type\n"
|
||||
" Print key sequences to type a Unicode codepoint\n"
|
||||
|
|
Loading…
Reference in New Issue