NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
mutt_commands.h
Go to the documentation of this file.
1 
23 #ifndef MUTT_MUTT_COMMANDS_H
24 #define MUTT_MUTT_COMMANDS_H
25 
26 #include <stddef.h>
27 #include <stdint.h>
28 
29 struct Buffer;
30 
35 {
40 };
41 
45 struct Command
46 {
47  const char *name;
48 
57  enum CommandResult (*parse)(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
58 
59  intptr_t data;
60 };
61 
66 {
71 };
72 
73 /* parameter to parse_mailboxes */
74 #define MUTT_NAMED (1 << 0)
75 
76 /* command registry functions */
77 #define COMMANDS_REGISTER(cmds) commands_register(cmds, mutt_array_size(cmds))
78 
79 void mutt_commands_init (void);
80 void commands_register (const struct Command *cmdv, const size_t cmds);
81 void mutt_commands_free (void);
82 size_t mutt_commands_array (struct Command **first);
83 struct Command *mutt_command_get (const char *s);
84 #ifdef USE_LUA
85 void mutt_commands_apply (void *data, void (*application)(void *, const struct Command *));
86 #endif
87 
88 #endif /* MUTT_MUTT_COMMANDS_H */
MUTT_SET_UNSET
@ MUTT_SET_UNSET
default is to unset all vars
Definition: mutt_commands.h:69
Buffer
String manipulation buffer.
Definition: buffer.h:33
mutt_command_get
struct Command * mutt_command_get(const char *s)
Get a Command by its name.
Definition: mutt_commands.c:197
mutt_commands_apply
void mutt_commands_apply(void *data, void(*application)(void *, const struct Command *))
Run a callback function on every Command.
Definition: mutt_commands.c:216
MUTT_SET_RESET
@ MUTT_SET_RESET
default is to reset all vars to default
Definition: mutt_commands.h:70
mutt_commands_free
void mutt_commands_free(void)
Free Commands array.
Definition: mutt_commands.c:175
commands_register
void commands_register(const struct Command *cmdv, const size_t cmds)
Add commands to Commands array.
Definition: mutt_commands.c:163
Command
A user-callable command.
Definition: mutt_commands.h:45
MUTT_CMD_FINISH
@ MUTT_CMD_FINISH
Finish: Stop processing this file.
Definition: mutt_commands.h:39
mutt_commands_array
size_t mutt_commands_array(struct Command **first)
Get Commands array.
Definition: mutt_commands.c:185
MUTT_SET_SET
@ MUTT_SET_SET
default is to set all vars
Definition: mutt_commands.h:67
MuttSetCommand
MuttSetCommand
Flags for parse_set()
Definition: mutt_commands.h:65
MUTT_SET_INV
@ MUTT_SET_INV
default is to invert all vars
Definition: mutt_commands.h:68
MUTT_CMD_SUCCESS
@ MUTT_CMD_SUCCESS
Success: Command worked.
Definition: mutt_commands.h:38
MUTT_CMD_ERROR
@ MUTT_CMD_ERROR
Error: Can't help the user.
Definition: mutt_commands.h:36
Command::data
intptr_t data
Data or flags to pass to the command.
Definition: mutt_commands.h:59
CommandResult
CommandResult
Error codes for command_t parse functions.
Definition: mutt_commands.h:34
mutt_commands_init
void mutt_commands_init(void)
MUTT_CMD_WARNING
@ MUTT_CMD_WARNING
Warning: Help given to the user.
Definition: mutt_commands.h:37
Command::name
const char * name
Name of the command.
Definition: mutt_commands.h:47
Command::parse
enum CommandResult(* parse)(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Function to parse a command.
Definition: mutt_commands.h:57