NeoMutt  2025-12-11-58-g09398d
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
command.h
Go to the documentation of this file.
1
22
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
41
45typedef uint8_t CommandFlags;
46#define CF_NO_FLAGS 0
47#define CF_SYNONYM (1 << 0)
48#define CF_DEPRECATED (1 << 1)
49
57struct Command
58{
59 const char *name;
60
75 enum CommandResult (*parse)(const struct Command *cmd, struct Buffer *line, struct Buffer *err);
76
77 intptr_t data;
78
79 const char *help;
80 const char *proto;
81 const char *path;
82
84};
85ARRAY_HEAD(CommandArray, const struct Command *);
86
87const struct Command *commands_get (struct CommandArray *ca, const char *name);
88void commands_clear (struct CommandArray *ca);
89bool commands_init (void);
90bool commands_register(struct CommandArray *ca, const struct Command *cmds);
91
92#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:2170
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
uint8_t CommandFlags
Special characters that end a text string.
Definition command.h:45
Convenience wrapper for the library headers.
String manipulation buffer.
Definition buffer.h:36
enum CommandResult(* parse)(const struct Command *cmd, struct Buffer *line, struct Buffer *err)
Definition command.h:75
CommandFlags flags
Command flags, e.g. CF_SYNONYM.
Definition command.h:83
const char * proto
Command prototype.
Definition command.h:80
const char * help
One-line description of the Command.
Definition command.h:79
const char * path
Help path, relative to the NeoMutt Docs.
Definition command.h:81
intptr_t data
Data or flags to pass to the command.
Definition command.h:77
const char * name
Name of the command.
Definition command.h:59