aboutsummaryrefslogtreecommitdiff
path: root/toys/other/help.c
blob: e16abaab6f226e0b2c3d89fe8bc429e4c095738f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* help.c - Show help for toybox commands
 *
 * Copyright 2007 Rob Landley <rob@landley.net>
 *
 * Often a shell builtin.

USE_HELP(NEWTOY(help, "<1", TOYFLAG_BIN))

config HELP
  bool "help"
  default y
  depends on TOYBOX_HELP
  help
    usage: help [command]

    Show usage information for toybox commands.
    Run "toybox" with no arguments for a list of available commands.
*/


#include "toys.h"

void help_main(void)
{
  struct toy_list *t = toy_find(*toys.optargs);

  if (!t) error_exit("Unknown command '%s'", *toys.optargs);
  toys.which = t;
  show_help();
}