Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Display commands provided by plugins when showing usage() information
Marin Atanasov Nikolov committed 13 years ago
commit dbb8aad161dcd7fc01c5c6cd2db61b075301b035
parent 3c7a9d7
1 file changed +15 -0
modified pkg/main.c
@@ -94,6 +94,9 @@ const unsigned int cmd_len = (sizeof(cmd)/sizeof(cmd[0]));
static void
usage(void)
{
+
	struct pkg_plugins *p = NULL;
+
	bool plugins_enabled = false;
+
	
	fprintf(stderr, "usage: pkg [-v] [-d] [-j <jail name or id>|-c <chroot path>] <command> [<args>]\n\n");
	fprintf(stderr, "Global options supported:\n");
	fprintf(stderr, "\t%-15s%s\n", "-d", "Increment debug level");
@@ -105,6 +108,18 @@ usage(void)
	for (unsigned int i = 0; i < cmd_len; i++)
		fprintf(stderr, "\t%-15s%s\n", cmd[i].name, cmd[i].desc);

+
	pkg_config_bool(PKG_CONFIG_ENABLE_PLUGINS, &plugins_enabled);
+

+
	if (plugins_enabled) {
+
		printf("\nCommands provided by plugins:\n");
+
		
+
		while (pkg_plugins_list(&p) != EPKG_END)
+
			if (pkg_plugins_provides_cmd(p))
+
				printf("\t%-15s%s\n",
+
				       pkg_plugins_get(p, PKG_PLUGINS_NAME),
+
				       pkg_plugins_get(p, PKG_PLUGINS_DESC));
+
	}
+
	
	fprintf(stderr, "\nFor more information on the different commands"
			" see 'pkg help <command>'.\n");