NeoMutt  2021-02-05-666-ge300cd
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 "config.h"
27 #include <stddef.h>
28 #include <stdint.h>
29 #include "mutt/lib.h"
30 
35 {
40 };
41 
47 struct Command
48 {
49  const char *name;
50 
62  enum CommandResult (*parse)(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err);
63 
64  intptr_t data;
65 };
66 
71 {
76 };
77 
78 /* parameter to parse_mailboxes */
79 #define MUTT_NAMED (1 << 0)
80 
81 /* command registry functions */
82 #define COMMANDS_REGISTER(cmds) commands_register(cmds, mutt_array_size(cmds))
83 
84 void mutt_commands_init (void);
85 void commands_register (const struct Command *cmdv, const size_t cmds);
86 void mutt_commands_free (void);
87 size_t mutt_commands_array (struct Command **first);
88 struct Command *mutt_command_get (const char *s);
89 #ifdef USE_LUA
90 void mutt_commands_apply (void *data, void (*application)(void *, const struct Command *));
91 #endif
92 
93 #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:64
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)
const char * name
Name of the command.
Definition: mutt_commands.h:49
MuttSetCommand
Flags for parse_set()
Definition: mutt_commands.h:70
enum CommandResult(* parse)(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Definition: mutt_commands.h:62
default is to reset all vars to default
Definition: mutt_commands.h:75
void mutt_commands_free(void)
Free Commands array.
default is to unset all vars
Definition: mutt_commands.h:74
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:72
Convenience wrapper for the library headers.
default is to invert all vars
Definition: mutt_commands.h:73