% limb manual
% getcommandordie(3)
% limb 0.1.0
% 2023-07-24
# NAME
getcommandordie - parse command's name and return the corresponding *struct
command*
# SYNOPSIS
#include <limb/command.h>
```pre hl
struct command *getcommandordie(int <em>exit</em>, const char *<em>usage</em>, const char *<em>arg</em>)
```
# DESCRIPTION
The `getcommandordie`() function will read the string `arg` to find the matching
command, using the `commands` array as described in [command.h](0). It needs not
to be an exact match, partial match are valid so long as they are unique.
For more, refer to [byte_get_match](3).
If no command matched the given `arg`, or more than one did, a warning is
emitted (through the [warn](3) family of functions) and [dieusage](3) is called
with the given `exit` and `usage` arguments to terminate process execution.
If a command matched, its corresponding structure (from the `commands` array) is
returned.
# RETURN VALUE
The `getcommandordie`() returns a pointer to the matching *struct command* for
the name in `arg` is there is only one.
Otherwise it does /not/ return but terminates process execution through
[dieusage](3).