NeoMutt  2024-04-16-36-g75b6fb
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 <stddef.h>
28#include <stdint.h>
29
30struct Buffer;
31
36{
41};
42
50struct Command
51{
52 const char *name;
53
65 enum CommandResult (*parse)(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
66
67 intptr_t data;
68};
69
70struct Command *command_get (const char *s);
71
72size_t commands_array (struct Command **first);
73void commands_cleanup (void);
74void commands_init (void);
75void commands_register (const struct Command *cmds, const size_t num_cmds);
76
77#endif /* MUTT_CORE_COMMAND_H */
void commands_init(void)
Initialize commands array and register default commands.
Definition: commands.c:1723
void commands_register(const struct Command *cmds, const size_t num_cmds)
Add commands to Commands array.
Definition: command.c:53
size_t commands_array(struct Command **first)
Get Commands array.
Definition: command.c:75
CommandResult
Error codes for command_t parse functions.
Definition: command.h:36
@ MUTT_CMD_SUCCESS
Success: Command worked.
Definition: command.h:39
@ MUTT_CMD_ERROR
Error: Can't help the user.
Definition: command.h:37
@ MUTT_CMD_WARNING
Warning: Help given to the user.
Definition: command.h:38
@ MUTT_CMD_FINISH
Finish: Stop processing this file.
Definition: command.h:40
void commands_cleanup(void)
Free Commands array.
Definition: command.c:65
struct Command * command_get(const char *s)
Get a Command by its name.
Definition: command.c:87
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:65
intptr_t data
Data or flags to pass to the command.
Definition: command.h:67
const char * name
Name of the command.
Definition: command.h:52