NeoMutt  2025-01-09-117-gace867
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
command.h
Go to the documentation of this file.
1
23#ifndef MUTT_CORE_COMMAND_H
24#define MUTT_CORE_COMMAND_H
25
26#include "config.h"
27#include <stdbool.h>
28#include <stdint.h>
29#include "mutt/lib.h"
30
35{
40};
41
49struct Command
50{
51 const char *name;
52
64 enum CommandResult (*parse)(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
65
66 intptr_t data;
67};
68ARRAY_HEAD(CommandArray, const struct Command *);
69
70const struct Command *commands_get (struct CommandArray *ca, const char *name);
71void commands_clear (struct CommandArray *ca);
72bool commands_init (void);
73bool commands_register(struct CommandArray *ca, const struct Command *cmds);
74
75#endif /* MUTT_CORE_COMMAND_H */
#define ARRAY_HEAD(name, type)
Define a named struct for arrays of elements of a certain type.
Definition: array.h:47
bool commands_register(struct CommandArray *ca, const struct Command *cmds)
Add commands to Commands array.
Definition: command.c:51
const struct Command * commands_get(struct CommandArray *ca, const char *name)
Get a Command by its name.
Definition: command.c:82
void commands_clear(struct CommandArray *ca)
Clear an Array of Commands.
Definition: command.c:70
bool commands_init(void)
Initialize commands array and register default commands.
Definition: commands.c:1748
CommandResult
Error codes for command_t parse functions.
Definition: command.h:35
@ MUTT_CMD_SUCCESS
Success: Command worked.
Definition: command.h:38
@ MUTT_CMD_ERROR
Error: Can't help the user.
Definition: command.h:36
@ MUTT_CMD_WARNING
Warning: Help given to the user.
Definition: command.h:37
@ MUTT_CMD_FINISH
Finish: Stop processing this file.
Definition: command.h:39
Convenience wrapper for the library headers.
String manipulation buffer.
Definition: buffer.h:36
enum CommandResult(* parse)(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Definition: command.h:64
intptr_t data
Data or flags to pass to the command.
Definition: command.h:66
const char * name
Name of the command.
Definition: command.h:51