From 513b3c09a54af31ffd1b0eb9b3c47849816483be Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Mon, 20 Dec 2021 10:00:02 +0000 Subject: main: add support for CLI extensions via external binaries This adds some logic to detect and dispatch unknown subcommands to extensions available in `$PATH`. Additional commands can be implemented by adding relevant `ostree-$verb` binaries to the system. As an example, if a `/usr/bin/ostree-extcommand` extension is provided, the execution of `ostree extcommand --help` will be dispatched to that as `ostree-extcommand extcommand --help`. --- src/ostree/ot-main.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/ostree/ot-main.h') diff --git a/src/ostree/ot-main.h b/src/ostree/ot-main.h index ed06e621..b369deb8 100644 --- a/src/ostree/ot-main.h +++ b/src/ostree/ot-main.h @@ -58,10 +58,16 @@ struct OstreeCommandInvocation { OstreeCommand *command; }; +int ostree_main (int argc, char **argv, OstreeCommand *commands); + int ostree_run (int argc, char **argv, OstreeCommand *commands, GError **error); int ostree_usage (OstreeCommand *commands, gboolean is_error); +char* ostree_command_lookup_external (int argc, char **argv, OstreeCommand *commands); + +int ostree_command_exec_external (char **argv); + gboolean ostree_parse_sysroot_or_repo_option (GOptionContext *context, const char *sysroot_path, const char *repo_path, -- cgit v1.2.1