meta: replace bluelib with fx
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
file(GLOB sources *.c *.h)
|
||||
file(GLOB_RECURSE sources *.c *.h)
|
||||
|
||||
add_executable(rovem ${sources})
|
||||
target_link_libraries(rovem Bluelib::Core Bluelib::Object Bluelib::Io Bluelib::Term Bluelib::Cmd)
|
||||
target_link_libraries(rovem
|
||||
libropkg
|
||||
FX::Runtime FX::Io FX::Term FX::Cmdline)
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
#include "../commands.h"
|
||||
|
||||
#include <fx/cmdline/cmd.h>
|
||||
#include <fx/error.h>
|
||||
#include <ropkg/repo-mgmt.h>
|
||||
#include <ropkg/status.h>
|
||||
#include <stdio.h>
|
||||
|
||||
enum {
|
||||
OPT_CHANNEL,
|
||||
OPT_CHANNEL_VALUE,
|
||||
OPT_COMPONENT,
|
||||
OPT_COMPONENT_VALUE,
|
||||
OPT_DESCRIPTION,
|
||||
OPT_DESCRIPTION_VALUE,
|
||||
OPT_REPO,
|
||||
OPT_REPO_PATH,
|
||||
};
|
||||
|
||||
static int channel_add_component(
|
||||
const fx_command *self,
|
||||
const fx_arglist *opt,
|
||||
const fx_array *args)
|
||||
{
|
||||
const char *root_path = NULL;
|
||||
const char *channel_name = NULL;
|
||||
const char *component_name = NULL;
|
||||
|
||||
fx_arglist_get_string(opt, OPT_REPO, OPT_REPO_PATH, 0, &root_path);
|
||||
fx_arglist_get_string(
|
||||
opt,
|
||||
OPT_CHANNEL,
|
||||
OPT_CHANNEL_VALUE,
|
||||
0,
|
||||
&channel_name);
|
||||
fx_arglist_get_string(
|
||||
opt,
|
||||
OPT_COMPONENT,
|
||||
OPT_COMPONENT_VALUE,
|
||||
0,
|
||||
&component_name);
|
||||
|
||||
if (!root_path) {
|
||||
fx_arglist_report_missing_args(opt, OPT_REPO, OPT_REPO_PATH, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!channel_name) {
|
||||
fx_arglist_report_missing_args(
|
||||
opt,
|
||||
OPT_CHANNEL,
|
||||
OPT_CHANNEL_VALUE,
|
||||
0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!component_name) {
|
||||
fx_arglist_report_missing_args(
|
||||
opt,
|
||||
OPT_COMPONENT,
|
||||
OPT_COMPONENT_VALUE,
|
||||
0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct ropkg_repo_mgmt *repo = NULL;
|
||||
fx_result result = ropkg_repo_mgmt_open(root_path, &repo);
|
||||
if (fx_result_is_error(result)) {
|
||||
fx_throw(result);
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct ropkg_repo_mgmt_channel *channel = NULL;
|
||||
result = ropkg_repo_mgmt_open_channel(repo, channel_name, &channel);
|
||||
if (fx_result_is_error(result)) {
|
||||
ropkg_repo_mgmt_close(repo);
|
||||
fx_throw(result);
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct ropkg_repo_mgmt_component *component = NULL;
|
||||
result = ropkg_repo_mgmt_channel_open_component(
|
||||
channel,
|
||||
component_name,
|
||||
&component);
|
||||
if (fx_result_is(result, ROPKG_ERROR_VENDOR, ROPKG_ERR_NO_COMPONENT)) {
|
||||
fx_error_discard(result);
|
||||
} else if (fx_result_is_error(result)) {
|
||||
ropkg_repo_mgmt_channel_close(channel);
|
||||
ropkg_repo_mgmt_close(repo);
|
||||
fx_throw(result);
|
||||
return -1;
|
||||
} else {
|
||||
ropkg_repo_mgmt_component_close(component);
|
||||
ropkg_repo_mgmt_channel_close(channel);
|
||||
ropkg_repo_mgmt_close(repo);
|
||||
fprintf(stderr,
|
||||
"component %s/%s already exists\n",
|
||||
channel_name,
|
||||
component_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
result = ropkg_repo_mgmt_channel_create_component(
|
||||
channel,
|
||||
component_name,
|
||||
&component);
|
||||
if (fx_result_is_error(result)) {
|
||||
ropkg_repo_mgmt_close(repo);
|
||||
fx_throw(result);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ropkg_repo_mgmt_component_close(component);
|
||||
ropkg_repo_mgmt_channel_close(channel);
|
||||
ropkg_repo_mgmt_close(repo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
FX_COMMAND(CMD_CHANNEL_ADD_COMPONENT, CMD_CHANNEL)
|
||||
{
|
||||
FX_COMMAND_NAME("add-component");
|
||||
FX_COMMAND_DESC("add a component to a repository channel.");
|
||||
FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT);
|
||||
FX_COMMAND_FUNCTION(channel_add_component);
|
||||
|
||||
FX_COMMAND_HELP_OPTION();
|
||||
|
||||
FX_COMMAND_OPTION(OPT_REPO)
|
||||
{
|
||||
FX_OPTION_LONG_NAME("repo");
|
||||
FX_OPTION_SHORT_NAME('r');
|
||||
FX_OPTION_DESC(
|
||||
"the path to the root of the repository to add "
|
||||
"the "
|
||||
"package(s) to.");
|
||||
|
||||
FX_OPTION_ARG(OPT_REPO_PATH)
|
||||
{
|
||||
FX_ARG_NAME("path");
|
||||
FX_ARG_DESC("the path to the repository root.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
FX_COMMAND_OPTION(OPT_CHANNEL)
|
||||
{
|
||||
FX_OPTION_LONG_NAME("channel");
|
||||
FX_OPTION_SHORT_NAME('C');
|
||||
FX_OPTION_DESC(
|
||||
"the name of the channel to add the new "
|
||||
"component to.");
|
||||
|
||||
FX_OPTION_ARG(OPT_CHANNEL_VALUE)
|
||||
{
|
||||
FX_ARG_NAME("name");
|
||||
FX_ARG_DESC(
|
||||
"the name of the channel to add the "
|
||||
"new "
|
||||
"component to.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
FX_COMMAND_OPTION(OPT_COMPONENT)
|
||||
{
|
||||
FX_OPTION_LONG_NAME("component");
|
||||
FX_OPTION_SHORT_NAME('c');
|
||||
FX_OPTION_DESC("the name of the new component.");
|
||||
|
||||
FX_OPTION_ARG(OPT_COMPONENT_VALUE)
|
||||
{
|
||||
FX_ARG_NAME("name");
|
||||
FX_ARG_DESC("the name of the new component.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
#include "../commands.h"
|
||||
|
||||
#include <fx/cmdline/cmd.h>
|
||||
#include <fx/error.h>
|
||||
#include <ropkg/repo-mgmt.h>
|
||||
|
||||
enum {
|
||||
OPT_NAME,
|
||||
OPT_NAME_VALUE,
|
||||
OPT_DESCRIPTION,
|
||||
OPT_DESCRIPTION_VALUE,
|
||||
OPT_REPO,
|
||||
OPT_REPO_PATH,
|
||||
};
|
||||
|
||||
static int channel_add(
|
||||
const fx_command *self,
|
||||
const fx_arglist *opt,
|
||||
const fx_array *args)
|
||||
{
|
||||
const char *root_path = NULL;
|
||||
const char *channel_name = NULL;
|
||||
|
||||
fx_arglist_get_string(opt, OPT_REPO, OPT_REPO_PATH, 0, &root_path);
|
||||
fx_arglist_get_string(opt, OPT_NAME, OPT_NAME_VALUE, 0, &channel_name);
|
||||
|
||||
if (!root_path) {
|
||||
fx_arglist_report_missing_args(opt, OPT_REPO, OPT_REPO_PATH, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!channel_name) {
|
||||
fx_arglist_report_missing_args(
|
||||
opt,
|
||||
OPT_NAME,
|
||||
OPT_NAME_VALUE,
|
||||
0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct ropkg_repo_mgmt *repo = NULL;
|
||||
fx_result result = ropkg_repo_mgmt_open(root_path, &repo);
|
||||
if (fx_result_is_error(result)) {
|
||||
fx_throw(result);
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct ropkg_repo_mgmt_channel *channel = NULL;
|
||||
result = ropkg_repo_mgmt_create_channel(repo, channel_name, &channel);
|
||||
if (fx_result_is_error(result)) {
|
||||
ropkg_repo_mgmt_close(repo);
|
||||
fx_throw(result);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ropkg_repo_mgmt_channel_close(channel);
|
||||
ropkg_repo_mgmt_close(repo);
|
||||
return 0;
|
||||
}
|
||||
|
||||
FX_COMMAND(CMD_CHANNEL_ADD, CMD_CHANNEL)
|
||||
{
|
||||
FX_COMMAND_NAME("add");
|
||||
FX_COMMAND_SHORT_NAME('A');
|
||||
FX_COMMAND_DESC("add a channel to a repository.");
|
||||
FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT);
|
||||
FX_COMMAND_FUNCTION(channel_add);
|
||||
|
||||
FX_COMMAND_HELP_OPTION();
|
||||
|
||||
FX_COMMAND_OPTION(OPT_REPO)
|
||||
{
|
||||
FX_OPTION_LONG_NAME("repo");
|
||||
FX_OPTION_SHORT_NAME('r');
|
||||
FX_OPTION_DESC(
|
||||
"the path to the repository to create the channel in.");
|
||||
|
||||
FX_OPTION_ARG(OPT_REPO_PATH)
|
||||
{
|
||||
FX_ARG_NAME("path");
|
||||
FX_ARG_DESC(
|
||||
"the path to the repository to create the "
|
||||
"channel in.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
FX_COMMAND_OPTION(OPT_NAME)
|
||||
{
|
||||
FX_OPTION_LONG_NAME("name");
|
||||
FX_OPTION_SHORT_NAME('n');
|
||||
FX_OPTION_DESC("the name of the channel to create.");
|
||||
|
||||
FX_OPTION_ARG(OPT_NAME_VALUE)
|
||||
{
|
||||
FX_ARG_NAME("name");
|
||||
FX_ARG_DESC("the name of the channel to create.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
FX_COMMAND_OPTION(OPT_DESCRIPTION)
|
||||
{
|
||||
FX_OPTION_LONG_NAME("description");
|
||||
FX_OPTION_SHORT_NAME('d');
|
||||
FX_OPTION_DESC(
|
||||
"a human-readable description of the new channel.");
|
||||
|
||||
FX_OPTION_ARG(OPT_DESCRIPTION_VALUE)
|
||||
{
|
||||
FX_ARG_NAME("description");
|
||||
FX_ARG_DESC(
|
||||
"a human-readable description of the new "
|
||||
"channel.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
#include "../commands.h"
|
||||
|
||||
#include <fx/cmdline/cmd.h>
|
||||
|
||||
enum {
|
||||
OPT_REPO,
|
||||
OPT_REPO_PATH,
|
||||
OPT_LOCATION,
|
||||
OPT_LOCATION_CHANNEL,
|
||||
OPT_LOCATION_COMPONENT,
|
||||
|
||||
ARG_PACKAGE_PATH,
|
||||
};
|
||||
|
||||
static int package_add(
|
||||
const fx_command *self,
|
||||
const fx_arglist *opt,
|
||||
const fx_array *args)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
FX_COMMAND(CMD_PACKAGE_ADD, CMD_PACKAGE)
|
||||
{
|
||||
FX_COMMAND_NAME("add");
|
||||
FX_COMMAND_SHORT_NAME('A');
|
||||
FX_COMMAND_DESC("add a package to a repository.");
|
||||
FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT);
|
||||
FX_COMMAND_FUNCTION(package_add);
|
||||
|
||||
FX_COMMAND_HELP_OPTION();
|
||||
|
||||
FX_COMMAND_OPTION(OPT_LOCATION)
|
||||
{
|
||||
FX_OPTION_LONG_NAME("location");
|
||||
FX_OPTION_SHORT_NAME('L');
|
||||
FX_OPTION_DESC(
|
||||
"the channel and component to add the package to.");
|
||||
|
||||
FX_OPTION_ARG(OPT_LOCATION_CHANNEL)
|
||||
{
|
||||
FX_ARG_NAME("channel");
|
||||
FX_ARG_DESC("the channel to add the package to.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
|
||||
FX_OPTION_ARG(OPT_LOCATION_COMPONENT)
|
||||
{
|
||||
FX_ARG_NAME("component");
|
||||
FX_ARG_DESC(
|
||||
"the channel component to add the package to.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
FX_COMMAND_OPTION(OPT_REPO)
|
||||
{
|
||||
FX_OPTION_LONG_NAME("repo");
|
||||
FX_OPTION_SHORT_NAME('R');
|
||||
FX_OPTION_DESC(
|
||||
"the path to the root of the repository to add the "
|
||||
"package(s) to.");
|
||||
|
||||
FX_OPTION_ARG(OPT_REPO_PATH)
|
||||
{
|
||||
FX_ARG_NAME("path");
|
||||
FX_ARG_DESC("the path to the repository root.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
FX_COMMAND_ARG(ARG_PACKAGE_PATH)
|
||||
{
|
||||
FX_ARG_NAME("package");
|
||||
FX_ARG_DESC("the path to the package(s) to add.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
#include "../commands.h"
|
||||
|
||||
#include <fx/cmdline/cmd.h>
|
||||
|
||||
enum {
|
||||
OPT_REPO,
|
||||
OPT_REPO_PATH,
|
||||
OPT_LOCATION,
|
||||
OPT_LOCATION_CHANNEL,
|
||||
OPT_LOCATION_COMPONENT,
|
||||
|
||||
ARG_PACKAGE_PATH,
|
||||
};
|
||||
|
||||
static int package_add(
|
||||
const fx_command *self,
|
||||
const fx_arglist *opt,
|
||||
const fx_array *args)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
FX_COMMAND(CMD_PACKAGE_ADD, CMD_PACKAGE)
|
||||
{
|
||||
FX_COMMAND_NAME("add");
|
||||
FX_COMMAND_SHORT_NAME('A');
|
||||
FX_COMMAND_DESC("add a package to a repository.");
|
||||
FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT);
|
||||
FX_COMMAND_FUNCTION(package_add);
|
||||
|
||||
FX_COMMAND_HELP_OPTION();
|
||||
|
||||
FX_COMMAND_OPTION(OPT_LOCATION)
|
||||
{
|
||||
FX_OPTION_LONG_NAME("location");
|
||||
FX_OPTION_SHORT_NAME('L');
|
||||
FX_OPTION_DESC(
|
||||
"the channel and component to add the package to.");
|
||||
|
||||
FX_OPTION_ARG(OPT_LOCATION_CHANNEL)
|
||||
{
|
||||
FX_ARG_NAME("channel");
|
||||
FX_ARG_DESC("the channel to add the package to.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
|
||||
FX_OPTION_ARG(OPT_LOCATION_COMPONENT)
|
||||
{
|
||||
FX_ARG_NAME("component");
|
||||
FX_ARG_DESC(
|
||||
"the channel component to add the package to.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
FX_COMMAND_OPTION(OPT_REPO)
|
||||
{
|
||||
FX_OPTION_LONG_NAME("repo");
|
||||
FX_OPTION_SHORT_NAME('R');
|
||||
FX_OPTION_DESC(
|
||||
"the path to the root of the repository to add the "
|
||||
"package(s) to.");
|
||||
|
||||
FX_OPTION_ARG(OPT_REPO_PATH)
|
||||
{
|
||||
FX_ARG_NAME("path");
|
||||
FX_ARG_DESC("the path to the repository root.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
FX_COMMAND_ARG(ARG_PACKAGE_PATH)
|
||||
{
|
||||
FX_ARG_NAME("package");
|
||||
FX_ARG_DESC("the path to the package(s) to add.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "../commands.h"
|
||||
|
||||
#include <fx/cmdline/cmd.h>
|
||||
#include <fx/error.h>
|
||||
#include <fx/term/print.h>
|
||||
|
||||
FX_COMMAND(CMD_CHANNEL, CMD_ROOT)
|
||||
{
|
||||
FX_COMMAND_NAME("channel");
|
||||
FX_COMMAND_SHORT_NAME('C');
|
||||
FX_COMMAND_DESC("Repository channel inspection and manipulation.");
|
||||
FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT);
|
||||
FX_COMMAND_HELP_OPTION();
|
||||
|
||||
FX_COMMAND_USAGE()
|
||||
{
|
||||
FX_COMMAND_USAGE_COMMAND_PLACEHOLDER();
|
||||
}
|
||||
}
|
||||
+10
-2
@@ -5,8 +5,16 @@ enum {
|
||||
CMD_ROOT,
|
||||
CMD_CREATE,
|
||||
CMD_QUERY,
|
||||
CMD_ADD_PACKAGE,
|
||||
CMD_REMOVE_PACKAGE,
|
||||
|
||||
CMD_PACKAGE,
|
||||
CMD_PACKAGE_ADD,
|
||||
CMD_PACKAGE_REMOVE,
|
||||
|
||||
CMD_CHANNEL,
|
||||
CMD_CHANNEL_ADD,
|
||||
CMD_CHANNEL_REMOVE,
|
||||
CMD_CHANNEL_ADD_COMPONENT,
|
||||
CMD_CHANNEL_REMOVE_COMPONENT,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
#include "commands.h"
|
||||
|
||||
#include <fx/cmdline/cmd.h>
|
||||
#include <ropkg/repo-mgmt.h>
|
||||
|
||||
enum {
|
||||
OPT_NAME,
|
||||
OPT_NAME_VALUE,
|
||||
OPT_DESCRIPTION,
|
||||
OPT_DESCRIPTION_VALUE,
|
||||
|
||||
ARG_REPO_PATH,
|
||||
};
|
||||
|
||||
static int create(
|
||||
const fx_command *self,
|
||||
const fx_arglist *opt,
|
||||
const fx_array *args)
|
||||
{
|
||||
const char *root_path = NULL;
|
||||
fx_arglist_get_string(
|
||||
opt,
|
||||
FX_COMMAND_INVALID_ID,
|
||||
ARG_REPO_PATH,
|
||||
0,
|
||||
&root_path);
|
||||
|
||||
if (!root_path) {
|
||||
fx_arglist_report_missing_args(
|
||||
opt,
|
||||
FX_COMMAND_INVALID_ID,
|
||||
ARG_REPO_PATH,
|
||||
0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct ropkg_repo_mgmt *repo = NULL;
|
||||
fx_result result = ropkg_repo_mgmt_create(root_path, &repo);
|
||||
if (fx_result_is_error(result)) {
|
||||
fx_throw(result);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ropkg_repo_mgmt_close(repo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
FX_COMMAND(CMD_CREATE, CMD_ROOT)
|
||||
{
|
||||
FX_COMMAND_NAME("create");
|
||||
FX_COMMAND_SHORT_NAME('N');
|
||||
FX_COMMAND_DESC("create a new repository.");
|
||||
FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT);
|
||||
FX_COMMAND_FUNCTION(create);
|
||||
|
||||
FX_COMMAND_HELP_OPTION();
|
||||
|
||||
FX_COMMAND_OPTION(OPT_NAME)
|
||||
{
|
||||
FX_OPTION_LONG_NAME("name");
|
||||
FX_OPTION_SHORT_NAME('n');
|
||||
FX_OPTION_DESC("the human-readable name of the repository");
|
||||
FX_OPTION_ARG(OPT_NAME_VALUE)
|
||||
{
|
||||
FX_ARG_NAME("name");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
FX_COMMAND_OPTION(OPT_DESCRIPTION)
|
||||
{
|
||||
FX_OPTION_LONG_NAME("description");
|
||||
FX_OPTION_SHORT_NAME('d');
|
||||
FX_OPTION_DESC(
|
||||
"a human-readable description of the repository");
|
||||
FX_OPTION_ARG(OPT_DESCRIPTION_VALUE)
|
||||
{
|
||||
FX_ARG_NAME("description");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
FX_COMMAND_ARG(ARG_REPO_PATH)
|
||||
{
|
||||
FX_ARG_NAME("path");
|
||||
FX_ARG_DESC("the path to create the repository at.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -1,19 +1,19 @@
|
||||
#include "commands.h"
|
||||
|
||||
#include <blue/cmd.h>
|
||||
#include <fx/cmdline/cmd.h>
|
||||
|
||||
B_COMMAND(CMD_ROOT, B_COMMAND_INVALID_ID)
|
||||
FX_COMMAND(CMD_ROOT, FX_COMMAND_INVALID_ID)
|
||||
{
|
||||
B_COMMAND_NAME("rovem");
|
||||
B_COMMAND_DESC(
|
||||
FX_COMMAND_NAME("rovem");
|
||||
FX_COMMAND_DESC(
|
||||
"Rosetta package vendor management tool. This tool is used to "
|
||||
"create and manage a Rosetta package vendor, from which "
|
||||
"packages can be retrieved and installed by clients.");
|
||||
B_COMMAND_FLAGS(B_COMMAND_SHOW_HELP_BY_DEFAULT);
|
||||
B_COMMAND_HELP_OPTION();
|
||||
"create and manage a Rosetta package vendor, from which "
|
||||
"packages can be retrieved and installed by clients.");
|
||||
FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT);
|
||||
FX_COMMAND_HELP_OPTION();
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
return b_command_dispatch(CMD_ROOT, argc, argv);
|
||||
return fx_command_dispatch(CMD_ROOT, argc, argv);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#include "../commands.h"
|
||||
|
||||
#include <fx/cmdline/cmd.h>
|
||||
|
||||
enum {
|
||||
OPT_REPO,
|
||||
OPT_REPO_PATH,
|
||||
OPT_LOCATION,
|
||||
OPT_LOCATION_CHANNEL,
|
||||
OPT_LOCATION_COMPONENT,
|
||||
|
||||
ARG_PACKAGE_PATH,
|
||||
};
|
||||
|
||||
static int package_add(
|
||||
const fx_command *self,
|
||||
const fx_arglist *opt,
|
||||
const fx_array *args)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
FX_COMMAND(CMD_PACKAGE_ADD, CMD_PACKAGE)
|
||||
{
|
||||
FX_COMMAND_NAME("add");
|
||||
FX_COMMAND_SHORT_NAME('A');
|
||||
FX_COMMAND_DESC("add a package to a repository.");
|
||||
FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT);
|
||||
FX_COMMAND_FUNCTION(package_add);
|
||||
|
||||
FX_COMMAND_HELP_OPTION();
|
||||
|
||||
FX_COMMAND_OPTION(OPT_LOCATION)
|
||||
{
|
||||
FX_OPTION_LONG_NAME("location");
|
||||
FX_OPTION_SHORT_NAME('L');
|
||||
FX_OPTION_DESC(
|
||||
"the channel and component to add the package to.");
|
||||
|
||||
FX_OPTION_ARG(OPT_LOCATION_CHANNEL)
|
||||
{
|
||||
FX_ARG_NAME("channel");
|
||||
FX_ARG_DESC("the channel to add the package to.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
|
||||
FX_OPTION_ARG(OPT_LOCATION_COMPONENT)
|
||||
{
|
||||
FX_ARG_NAME("component");
|
||||
FX_ARG_DESC(
|
||||
"the channel component to add the package to.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
FX_COMMAND_OPTION(OPT_REPO)
|
||||
{
|
||||
FX_OPTION_LONG_NAME("repo");
|
||||
FX_OPTION_SHORT_NAME('R');
|
||||
FX_OPTION_DESC(
|
||||
"the path to the root of the repository to add the "
|
||||
"package(s) to.");
|
||||
|
||||
FX_OPTION_ARG(OPT_REPO_PATH)
|
||||
{
|
||||
FX_ARG_NAME("path");
|
||||
FX_ARG_DESC("the path to the repository root.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
|
||||
FX_COMMAND_ARG(ARG_PACKAGE_PATH)
|
||||
{
|
||||
FX_ARG_NAME("package");
|
||||
FX_ARG_DESC("the path to the package(s) to add.");
|
||||
FX_ARG_NR_VALUES(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#include "../commands.h"
|
||||
|
||||
#include <fx/cmdline/cmd.h>
|
||||
#include <fx/error.h>
|
||||
#include <fx/term/print.h>
|
||||
|
||||
FX_COMMAND(CMD_PACKAGE, CMD_ROOT)
|
||||
{
|
||||
FX_COMMAND_NAME("package");
|
||||
FX_COMMAND_SHORT_NAME('P');
|
||||
FX_COMMAND_DESC("Repository package inspection and manipulation.");
|
||||
FX_COMMAND_FLAGS(FX_COMMAND_SHOW_HELP_BY_DEFAULT);
|
||||
FX_COMMAND_HELP_OPTION();
|
||||
|
||||
FX_COMMAND_USAGE()
|
||||
{
|
||||
FX_COMMAND_USAGE_COMMAND_PLACEHOLDER();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user