Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 6d100fd in mainline


Ignore:
Timestamp:
2011-08-11T17:20:49Z (10 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master
Children:
1cc4a09
Parents:
7dfcc50a
Message:

Added help printouts for batch command.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/modules/help/help.c

    r7dfcc50a r6d100fd  
    4343extern const char *progname;
    4444
     45#define HELP_IS_BATCH           3
    4546#define HELP_IS_COMMANDS        2
    4647#define HELP_IS_MODULE          1
     
    5455{
    5556        int rc = HELP_IS_RUBBISH;
     57
     58        if (str_cmp(cmd, "batch") == 0)
     59                return HELP_IS_BATCH;
    5660
    5761        if (str_cmp(cmd, "commands") == 0)
     
    8791                "\n  If no argument is given to %s, a list of commands are shown\n\n",
    8892                cmdname, cmdname, cmdname, cmdname);
     93        }
     94
     95        return;
     96}
     97
     98static void help_batch(unsigned int level)
     99{
     100        if (level == HELP_SHORT) {
     101                printf(
     102                "\n  batch [filename]\n"
     103                "  Issues commands stored in the file.\n"
     104                "  Each command must correspond to the single line in the file.\n\n");
     105        } else {
     106                printf(
     107                "\n  `batch' - issues a batch of commands\n"
     108                "  Issues commands stored in the file. Each command must correspond\n"
     109                "  to the single line in the file. Empty lines can be used to visually\n"
     110                "  separate groups of commands. There is no support for comments,\n"
     111                "  variables, recursion or other programming constructs - the `batch'\n"
     112                "  command is indeed very trivial.\n\n");
    89113        }
    90114
     
    121145        }
    122146
     147        printf("   %-16s\t%s\n", "batch", "Issue batch of commands");
    123148        printf("\n  Try %s %s for more information on how `%s' works.\n\n",
    124149                cmdname, cmdname, cmdname);
     
    182207                        help_commands();
    183208                        return CMD_SUCCESS;
     209                case HELP_IS_BATCH:
     210                        help_batch(level);
     211                        return CMD_SUCCESS;
    184212                case HELP_IS_MODULE:
    185213                        help_module(mod_switch, level);
Note: See TracChangeset for help on using the changeset viewer.