From e304039dd4100d53b3642e175984fddc16cdd332 Mon Sep 17 00:00:00 2001 From: "graham.gower" Date: Mon, 23 Nov 2009 05:39:23 +0000 Subject: [PATCH] Clean up the help output. - Don't print long options with a single dash. - Don't print commands with an underscore, ensure that it works with a dash. e.g. list-installed. - No wrapping on an 80 char wide terminal. - Incrementing the verbositiy was broken, so remove it. NOTE: Old commands/options still all work and some commands/options remain undocumented. git-svn-id: http://opkg.googlecode.com/svn/trunk@349 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- libopkg/args.c | 117 ++++++++++++++++++++------------------------- libopkg/libopkg.c | 1 + libopkg/opkg_cmd.c | 3 ++ 3 files changed, 57 insertions(+), 64 deletions(-) diff --git a/libopkg/args.c b/libopkg/args.c index 263078a..d5e379c 100644 --- a/libopkg/args.c +++ b/libopkg/args.c @@ -42,7 +42,6 @@ enum long_args_opt ARGS_OPT_FORCE_SPACE, ARGS_OPT_NOACTION, ARGS_OPT_NODEPS, - ARGS_OPT_VERBOSITY, ARGS_OPT_MULTIPLE_PROVIDERS, ARGS_OPT_AUTOREMOVE, ARGS_OPT_CACHE, @@ -166,9 +165,6 @@ int args_parse(args_t *args, int argc, char *argv[]) case 'p': args->offline_root_path = xstrdup(optarg); break; - case 'n': - args->noaction = 1; - break; case 't': args->tmp_dir = xstrdup(optarg); break; @@ -176,11 +172,7 @@ int args_parse(args_t *args, int argc, char *argv[]) print_version(); exit(0); case 'V': - case ARGS_OPT_VERBOSITY: - if (optarg) - args->verbosity = atoi(optarg); - else - args->verbosity += 1; + args->verbosity = atoi(optarg); break; case ARGS_OPT_AUTOREMOVE: args->autoremove = 1; @@ -253,77 +245,74 @@ void args_usage(char *complaint) printf("where sub-command is one of:\n"); printf("\nPackage Manipulation:\n"); - printf("\tupdate Update list of available packages\n"); - printf("\tupgrade Upgrade all installed packages to latest version\n"); - printf("\tinstall Download and install (and dependencies)\n"); - printf("\tinstall Install package \n"); - printf("\tconfigure [] Configure unpacked packages\n"); - printf("\tremove Remove package \n"); - printf("\tflag ... Flag package(s) \n"); - printf("\t =hold|noprune|user|ok|installed|unpacked (one per invocation) \n"); + printf("\tupdate Update list of available packages\n"); + printf("\tupgrade Upgrade installed packages\n"); + printf("\tinstall Install package(s)\n"); + printf("\tconfigure Configure unpacked package(s)\n"); + printf("\tremove Remove package(s)\n"); + printf("\tflag Flag package(s)\n"); + printf("\t =hold|noprune|user|ok|installed|unpacked (one per invocation)\n"); printf("\nInformational Commands:\n"); - printf("\tlist List available packages and descriptions\n"); - printf("\tlist_installed List all and only the installed packages and description \n"); - printf("\tlist_upgradable List all the installed and upgradable packages\n"); - printf("\tfiles List all files belonging to \n"); - printf("\tsearch Search for a package providing \n"); - printf("\tinfo [pkg|regexp] Display all info for \n"); - printf("\tstatus [pkg|regexp] Display all status for \n"); - printf("\tdownload Download to current directory.\n"); - printf("\tcompare_versions \n"); - printf("\t compare versions using <= < > >= = << >>\n"); - printf("\tprint_architecture prints the architecture.\n"); - printf("\tprint_installation_architecture\n"); + printf("\tlist List available packages\n"); + printf("\tlist-installed List installed packages\n"); + printf("\tlist-upgradable List installed and upgradable packages\n"); + printf("\tfiles List files belonging to \n"); + printf("\tsearch List package providing \n"); + printf("\tinfo [pkg|regexp] Display all info for \n"); + printf("\tstatus [pkg|regexp] Display all status for \n"); + printf("\tdownload Download to current directory\n"); + printf("\tcompare-versions \n"); + printf("\t compare versions using <= < > >= = << >>\n"); + printf("\tprint-architecture List installable package architectures\n"); printf("\twhatdepends [-A] [pkgname|pat]+\n"); printf("\twhatdependsrec [-A] [pkgname|pat]+\n"); printf("\twhatprovides [-A] [pkgname|pat]+\n"); printf("\twhatconflicts [-A] [pkgname|pat]+\n"); printf("\twhatreplaces [-A] [pkgname|pat]+\n"); - printf("\t prints the installation architecture.\n"); + printf("\nOptions:\n"); - printf("\t-A Query all packages with whatdepends, whatprovides, whatreplaces, whatconflicts\n"); - printf("\t-V Set verbosity level to . If no value is\n"); - printf("\t--verbosity provided increase verbosity by one. Verbosity levels:\n"); - printf("\t 0 errors only\n"); - printf("\t 1 normal messages (default)\n"); - printf("\t 2 informative messages\n"); - printf("\t 3 debug output\n"); + printf("\t-A Query all packages not just those installed\n"); + printf("\t-V Set verbosity level to .\n"); + printf("\t--verbosity Verbosity levels:\n"); + printf("\t 0 errors only\n"); + printf("\t 1 normal messages (default)\n"); + printf("\t 2 informative messages\n"); + printf("\t 3 debug\n"); + printf("\t 4 debug level 2\n"); printf("\t-f Use as the opkg configuration file\n"); - printf("\t--cache Use a package cache\n"); - printf("\t-conf Default configuration file location\n"); + printf("\t--conf Default configuration file location\n"); printf(" is %s/%s\n", ARGS_DEFAULT_CONF_FILE_DIR, ARGS_DEFAULT_CONF_FILE_NAME); + printf("\t--cache Use a package cache\n"); printf("\t-d Use as the the root directory for\n"); - printf("\t-dest package installation, removal, upgrading.\n"); + printf("\t--dest package installation, removal, upgrading.\n"); printf(" should be a defined dest name from\n"); printf(" the configuration file, (but can also be a\n"); printf(" directory name in a pinch).\n"); - printf("\t-o Use as the root directory for\n"); - printf("\t-offline offline installation of packages.\n"); - printf("\t-p Path to utilities for runing postinst\n"); - printf("\t-offline-path script in offline mode.\n"); + printf("\t-o Use as the root directory for\n"); + printf("\t--offline-root offline installation of packages.\n"); + printf("\t--offline-path $PATH for postinsts scripts in offline mode\n"); + + printf("\nForce Options:\n"); + printf("\t--force-depends Install/remove despite failed dependences\n"); + printf("\t--force-defaults Use default options for questions asked by opkg\n"); + printf("\t--force-reinstall Reinstall package(s)\n"); + printf("\t--force-overwrite Overwrite files from other package(s)\n"); + printf("\t--force-downgrade Allow opkg to downgrade packages\n"); + printf("\t--force-space Disable free space checks\n"); + printf("\t--noaction No action -- test only\n"); + printf("\t--nodeps Do not follow dependences\n"); + printf("\t--force-removal-of-dependent-packages\n"); + printf("\t Remove package and all dependencies\n"); + printf("\t--autoremove Remove packages that were installed\n"); + printf("\t automatically to satisfy dependencies\n"); + printf("\t-t Specify tmp-dir.\n"); + printf("\t--tmp-dir Specify tmp-dir.\n"); - printf("\nForce Options (use when opkg is too smart for its own good):\n"); - printf("\t-force-depends Make dependency checks warnings instead of errors\n"); - printf("\t Install/remove package in spite of failed dependences\n"); - printf("\t-force-defaults Use default options for questions asked by opkg.\n"); - printf(" (no prompts). Note that this will not prevent\n"); - printf(" package installation scripts from prompting.\n"); - printf("\t-force-reinstall Allow opkg to reinstall a package.\n"); - printf("\t-force-overwrite Allow opkg to overwrite files from another package during an install.\n"); - printf("\t-force-downgrade Allow opkg to downgrade packages.\n"); - printf("\t-force_space Install even if there does not seem to be enough space.\n"); - printf("\t-noaction No action -- test only\n"); - printf("\t-nodeps Do not follow dependences\n"); - printf("\t-force-removal-of-dependent-packages\n"); - printf("\t-recursive Allow opkg to remove package and all that depend on it.\n"); - printf("\t-autoremove Allow opkg to remove packages that where installed automatically to satisfy dependencies.\n"); - printf("\t-test No action -- test only\n"); - printf("\t-t Specify tmp-dir.\n"); - printf("\t--tmp-dir Specify tmp-dir.\n"); printf("\n"); - printf("\tregexp could be something like 'pkgname*' '*file*' or similar\n"); - printf("\teg: opkg info 'libstd*' or opkg search '*libop*' or opkg remove 'libncur*'\n"); + + printf(" regexp could be something like 'pkgname*' '*file*' or similar\n"); + printf(" e.g. opkg info 'libstd*' or opkg search '*libop*' or opkg remove 'libncur*'\n"); /* -force-removal-of-essential-packages Let opkg remove essential packages. Using this option is almost guaranteed to break your system, hence this option is not even advertised in the usage statement. */ diff --git a/libopkg/libopkg.c b/libopkg/libopkg.c index 37770eb..c91b703 100644 --- a/libopkg/libopkg.c +++ b/libopkg/libopkg.c @@ -65,6 +65,7 @@ opkg_op (int argc, char *argv[]) !strcmp(cmd_name,"compare_versions") || !strcmp(cmd_name,"compare-versions") || !strcmp(cmd_name,"list_installed") || + !strcmp(cmd_name,"list-installed") || !strcmp(cmd_name,"status") ) args.noreadfeedsfile = 1; diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c index 42bfd16..a90c6a9 100644 --- a/libopkg/opkg_cmd.c +++ b/libopkg/opkg_cmd.c @@ -78,11 +78,14 @@ static opkg_cmd_t cmds[] = { {"upgrade", 0, (opkg_cmd_fun_t)opkg_upgrade_cmd}, {"list", 0, (opkg_cmd_fun_t)opkg_list_cmd}, {"list_installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd}, + {"list-installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd}, {"list_upgradable", 0, (opkg_cmd_fun_t)opkg_list_upgradable_cmd}, + {"list-upgradable", 0, (opkg_cmd_fun_t)opkg_list_upgradable_cmd}, {"info", 0, (opkg_cmd_fun_t)opkg_info_cmd}, {"flag", 1, (opkg_cmd_fun_t)opkg_flag_cmd}, {"status", 0, (opkg_cmd_fun_t)opkg_status_cmd}, {"install_pending", 0, (opkg_cmd_fun_t)opkg_install_pending_cmd}, + {"install-pending", 0, (opkg_cmd_fun_t)opkg_install_pending_cmd}, {"install", 1, (opkg_cmd_fun_t)opkg_install_cmd}, {"remove", 1, (opkg_cmd_fun_t)opkg_remove_cmd}, {"purge", 1, (opkg_cmd_fun_t)opkg_purge_cmd}, -- 2.25.1