pkgman: fix for syntax (help)

The tool "pkgman" was not showing it's help text
and this seems to be somehow related to the
initialization of constants such as
"kCommandCategoryPackages"; these values seems to
be coming through as empty-string for some reason.
I am changing those to be "#define" of regular
C-Strings and this seems to resolve the problem.
These values only seem to be used to group the
possible commands for production of the syntax or
help text - there do not seem to be any deeper
impacts beyond that functionality.

Change-Id: If9cd61462cd7f1f1b5ab2ece521bb3f00a1ba246
Reviewed-on: https://review.haiku-os.org/c/1139
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Andrew Lindesay
2019-03-03 20:24:54 +00:00
parent 695f50f6cc
commit 52a61976d4
12 changed files with 16 additions and 21 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ static const char* const kLongUsage =
DEFINE_COMMAND(AddRepoCommand, "add-repo", kShortUsage, kLongUsage,
kCommandCategoryRepositories)
COMMAND_CATEGORY_REPOSITORIES)
int
+1 -1
View File
@@ -37,7 +37,7 @@ static const char* const kLongUsage =
DEFINE_COMMAND(DropRepoCommand, "drop-repo", kShortUsage, kLongUsage,
kCommandCategoryRepositories)
COMMAND_CATEGORY_REPOSITORIES)
int
+1 -1
View File
@@ -47,7 +47,7 @@ static const char* const kLongUsage =
DEFINE_COMMAND(FullSyncCommand, "full-sync", kShortUsage, kLongUsage,
kCommandCategoryPackages)
COMMAND_CATEGORY_PACKAGES)
int
+1 -1
View File
@@ -53,7 +53,7 @@ static const char* const kLongUsage =
DEFINE_COMMAND(InstallCommand, "install", kShortUsage, kLongUsage,
kCommandCategoryPackages)
COMMAND_CATEGORY_PACKAGES)
int
+1 -1
View File
@@ -43,7 +43,7 @@ static const char* const kLongUsage =
DEFINE_COMMAND(ListReposCommand, "list-repos", kShortUsage, kLongUsage,
kCommandCategoryRepositories)
COMMAND_CATEGORY_REPOSITORIES)
int
+1 -1
View File
@@ -38,7 +38,7 @@ static const char* const kLongUsage =
DEFINE_COMMAND(RefreshCommand, "refresh", kShortUsage, kLongUsage,
kCommandCategoryRepositories)
COMMAND_CATEGORY_REPOSITORIES)
int
@@ -62,7 +62,7 @@ static const char* const kLongUsage =
DEFINE_COMMAND(ResolveDependenciesCommand, "resolve-dependencies", kShortUsage,
kLongUsage, kCommandCategoryOther)
kLongUsage, COMMAND_CATEGORY_OTHER)
static void
+1 -1
View File
@@ -66,7 +66,7 @@ static const char* const kLongUsage =
DEFINE_COMMAND(SearchCommand, "search", kShortUsage, kLongUsage,
kCommandCategoryPackages)
COMMAND_CATEGORY_PACKAGES)
static int
+1 -1
View File
@@ -45,7 +45,7 @@ static const char* const kLongUsage =
DEFINE_COMMAND(UninstallCommand, "uninstall", kShortUsage, kLongUsage,
kCommandCategoryPackages)
COMMAND_CATEGORY_PACKAGES)
int
+1 -1
View File
@@ -49,7 +49,7 @@ static const char* const kLongUsage =
DEFINE_COMMAND(UpdateCommand, "update", kShortUsage, kLongUsage,
kCommandCategoryPackages)
COMMAND_CATEGORY_PACKAGES)
int
+3 -8
View File
@@ -23,11 +23,6 @@ extern const char* __progname;
const char* kProgramName = __progname;
const BString kCommandCategoryPackages("packages");
const BString kCommandCategoryRepositories("repositories");
const BString kCommandCategoryOther("other");
static const char* const kUsage =
"Usage: %s <command> <command args>\n"
"Manages packages and package repositories.\n"
@@ -59,11 +54,11 @@ void
print_usage_and_exit(bool error)
{
BString packageCommandsUsage
= get_commands_usage_for_category(kCommandCategoryPackages);
= get_commands_usage_for_category(COMMAND_CATEGORY_PACKAGES);
BString repositoryCommandsUsage
= get_commands_usage_for_category(kCommandCategoryRepositories);
= get_commands_usage_for_category(COMMAND_CATEGORY_REPOSITORIES);
BString otherCommandsUsage
= get_commands_usage_for_category(kCommandCategoryOther);
= get_commands_usage_for_category(COMMAND_CATEGORY_OTHER);
fprintf(error ? stderr : stdout, kUsage, kProgramName,
packageCommandsUsage.String(), repositoryCommandsUsage.String(),
+3 -3
View File
@@ -38,9 +38,9 @@ do { \
void print_usage_and_exit(bool error);
extern const BString kCommandCategoryPackages;
extern const BString kCommandCategoryRepositories;
extern const BString kCommandCategoryOther;
#define COMMAND_CATEGORY_PACKAGES "packages"
#define COMMAND_CATEGORY_REPOSITORIES "repositories"
#define COMMAND_CATEGORY_OTHER "other"
#endif // PKGMAN_H