NeoMutt  2020-09-25
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 */
void commands_register(const struct Command *cmdv, const size_t cmds)
Add commands to Commands array.
struct Command * mutt_command_get(const char *s)
Get a Command by its name.
intptr_t data
Data or flags to pass to the command.
Definition: mutt_commands.h:59
CommandResult
Error codes for command_t parse functions.
Definition: mutt_commands.h:34
Error: Can&#39;t help the user.
Definition: mutt_commands.h:36
String manipulation buffer.
Definition: buffer.h:33
void mutt_commands_init(void)
A user-callable command.
Definition: mutt_commands.h:45
const char * name
Name of the command.
Definition: mutt_commands.h:47
MuttSetCommand
Flags for parse_set()
Definition: mutt_commands.h:65
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
default is to reset all vars to default
Definition: mutt_commands.h:70
void mutt_commands_free(void)
Free Commands array.
default is to unset all vars
Definition: mutt_commands.h:69
size_t mutt_commands_array(struct Command **first)
Get Commands array.
void mutt_commands_apply(void *data, void(*application)(void *, const struct Command *))
Run a callback function on every Command.
Success: Command worked.
Definition: mutt_commands.h:38
Warning: Help given to the user.
Definition: mutt_commands.h:37
Finish: Stop processing this file.
Definition: mutt_commands.h:39
default is to set all vars
Definition: mutt_commands.h:67
default is to invert all vars
Definition: mutt_commands.h:68