NeoMutt
2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Toggle main menu visibility
Loading...
Searching...
No Matches
usage.c
Go to the documentation of this file.
1
22
28
29
#include "config.h"
30
#include <stdbool.h>
31
#include <stdio.h>
32
#include "
mutt/lib.h
"
33
#include "
cli/lib.h
"
34
#include "
version.h
"
35
42
static
void
print_header
(
const
char
*section,
const
char
*desc,
bool
use_color)
43
{
44
if
(use_color)
45
printf(
"\033[1;4m%s\033[0m: %s\n"
, section, desc);
46
else
47
printf(
"%s: %s\n"
, section, desc);
48
}
49
54
static
void
show_cli_overview
(
bool
use_color)
55
{
56
// L10N: Help Overview -- `neomutt --help`
57
// The modes are: help, info, send, tui
58
// Plus two helper modes: shared, all
59
// These should not be translated.
60
printf(
"%s "
,
_
(
"NeoMutt has four modes of operation:"
));
61
if
(use_color)
62
puts(
"\033[1;4mhelp\033[0m, \033[1;4minfo\033[0m, \033[1;4msend\033[0m, \033[1;4mtui\033[0m"
);
63
else
64
puts(
"help, info, send, tui"
);
65
66
puts(
_
(
"The default mode, if no command line arguments are specified, is tui."
));
67
puts(
""
);
68
69
// L10N: Parameters in <>s may be translated
70
print_header
(
"shared"
,
_
(
"Options that apply to all modes"
), use_color);
71
puts(
_
(
"neomutt -n, --no-system-config Don't read system config file"
));
72
puts(
_
(
" -F, --config <file> Use this user config file"
));
73
puts(
_
(
" -e, --command <command> Run extra commands"
));
74
puts(
_
(
" -m, --mbox-type <type> Set default mailbox type"
));
75
puts(
_
(
" -d, --debug-level <level> Set logging level (0..5)"
));
76
puts(
_
(
" -l, --debug-file <file> Set logging file"
));
77
puts(
""
);
78
79
print_header
(
"help"
,
_
(
"Get command line help for NeoMutt"
), use_color);
80
puts(
_
(
"neomutt -h, --help <mode> Detailed help for a mode"
));
81
puts(
_
(
" -v, --version Version"
));
82
puts(
_
(
" -vv, --license License"
));
83
puts(
""
);
84
85
print_header
(
"info"
,
_
(
"Ask NeoMutt for config information"
), use_color);
86
puts(
_
(
"neomutt -A, --alias <alias> [...] Lookup email aliases"
));
87
puts(
_
(
" -D, --dump-config [-O] [-S] Dump the config"
));
88
puts(
_
(
" -DD, --dump-changed-config [-O] [-S] Dump the changed config options"
));
89
puts(
_
(
" -Q, --query <option> [...] [-O] [-S] Query config options"
));
90
puts(
_
(
" -O, --with-docs Add one-liner documentation"
));
91
puts(
_
(
" -S, --hide-sensitive Hide sensitive option values"
));
92
puts(
""
);
93
94
print_header
(
"send"
,
_
(
"Send an email from the command line"
), use_color);
95
puts(
_
(
"neomutt -a, --attach <file> [...] Attach files"
));
96
puts(
_
(
" -b, --bcc <address> Add Bcc: address"
));
97
puts(
_
(
" -C, --crypto Use crypto (signing/encryption)"
));
98
puts(
_
(
" -c, --cc <address> Add Cc: address"
));
99
puts(
_
(
" -E, --edit-message Edit message (draft/include)"
));
100
puts(
_
(
" -H, --draft <file> Use draft email file"
));
101
puts(
_
(
" -i, --include <file> Include body file"
));
102
puts(
_
(
" -s, --subject <subject> Set Subject:"
));
103
puts(
_
(
" -- <address> [...] Add To: addresses"
));
104
puts(
""
);
105
106
print_header
(
"tui"
,
_
(
"Start NeoMutt's TUI (Terminal User Interface)"
), use_color);
107
puts(
_
(
"neomutt Start NeoMutt's TUI"
));
108
puts(
_
(
" -f, --folder <mailbox> Open this mailbox"
));
109
puts(
_
(
" -G, --nntp-browser Open NNTP browser"
));
110
puts(
_
(
" -g, --nntp-server <server> Use this NNTP server"
));
111
puts(
_
(
" -p, --postponed Resume postponed email"
));
112
puts(
_
(
" -R, --read-only Open mailbox read-only"
));
113
puts(
_
(
" -y, --browser Open mailbox browser"
));
114
puts(
_
(
" -Z, --check-new-mail Check for new mail"
));
115
puts(
_
(
" -z, --check-any-mail Check for any mail"
));
116
puts(
""
);
117
118
if
(use_color)
119
printf(
"%s \033[1m%s\033[0m\n"
,
_
(
"For detailed help, run:"
),
"neomutt --help all"
);
120
else
121
printf(
"%s %s\n"
,
_
(
"For detailed help, run:"
),
"neomutt --help all"
);
122
}
123
128
static
void
show_cli_shared
(
bool
use_color)
129
{
130
// L10N: Shared Help -- `neomutt --help shared`
131
print_header
(
"shared"
,
_
(
"Options that apply to all modes"
), use_color);
132
puts(
""
);
133
134
puts(
_
(
"By default NeoMutt loads one system and one user config file,"
));
135
puts(
_
(
"e.g. /etc/neomuttrc and ~/.neomuttrc"
));
136
137
// L10N: Parameters in <>s may be translated
138
puts(
_
(
" -n, --no-system-config Don't read system config file"
));
139
puts(
_
(
" -F, --config <file> Use this user config file"
));
140
puts(
_
(
" May be used multiple times"
));
141
puts(
""
);
142
143
puts(
_
(
"These options override the config:"
));
144
puts(
_
(
" -m, --mbox-type <type> Set default mailbox type"
));
145
puts(
_
(
" May be: maildir, mbox, mh, mmdf"
));
146
puts(
_
(
" -e, --command <command> Run extra commands"
));
147
puts(
_
(
" May be used multiple times"
));
148
puts(
""
);
149
150
puts(
_
(
"These logging options override the config:"
));
151
puts(
_
(
" -d, --debug-level <level> Set logging level"
));
152
puts(
_
(
" 0 (off), 1 (low) .. 5 (high)"
));
153
puts(
_
(
" -l, --debug-file <file> Set logging file"
));
154
puts(
_
(
" Default file '~/.neomuttdebug0'"
));
155
puts(
""
);
156
157
if
(use_color)
158
printf(
"\033[1m%s\033[0m\n"
,
_
(
"Examples:"
));
159
else
160
printf(
"%s\n"
,
_
(
"Examples:"
));
161
162
// L10N: Examples: Filenames may be translated
163
puts(
_
(
" neomutt --no-system-config"
));
164
puts(
_
(
" neomutt --config work.rc"
));
165
puts(
_
(
" neomutt --config work.rc --config colours.rc"
));
166
puts(
""
);
167
168
puts(
_
(
" neomutt --mbox-type maildir"
));
169
puts(
_
(
" neomutt --command 'set ask_cc = yes'"
));
170
puts(
""
);
171
172
puts(
_
(
" neomutt --debug-level 2"
));
173
puts(
_
(
" neomutt --debug-level 5 --debug-file neolog"
));
174
puts(
""
);
175
176
puts(
_
(
"See also:"
));
177
puts(
_
(
"- Config files: https://neomutt.org/guide/configuration"
));
178
}
179
184
static
void
show_cli_help
(
bool
use_color)
185
{
186
// L10N: Help Help -- `neomutt --help help`
187
print_header
(
"help"
,
_
(
"Get command line help for NeoMutt"
), use_color);
188
puts(
""
);
189
190
// L10N: Parameters in <>s may be translated
191
puts(
_
(
" -h, --help Overview of command line options"
));
192
puts(
_
(
" -h, --help <mode> Detailed help for: shared, help, info, send, tui, all"
));
193
puts(
_
(
" -v, --version NeoMutt version and build parameters"
));
194
puts(
_
(
" -vv, --license NeoMutt Copyright and license"
));
195
puts(
""
);
196
197
if
(use_color)
198
printf(
"\033[1m%s\033[0m\n"
,
_
(
"Examples:"
));
199
else
200
printf(
"%s\n"
,
_
(
"Examples:"
));
201
202
// L10N: Examples
203
puts(
_
(
" neomutt --help info"
));
204
puts(
_
(
" neomutt --license"
));
205
}
206
211
static
void
show_cli_info
(
bool
use_color)
212
{
213
// L10N: Info Help -- `neomutt --help info`
214
print_header
(
"info"
,
_
(
"Ask NeoMutt for config information"
), use_color);
215
puts(
""
);
216
217
// L10N: Parameters in <>s may be translated
218
puts(
_
(
" -A, --alias <alias> [...] Lookup email aliases"
));
219
puts(
_
(
" Multiple aliases can be looked up (space-separated)"
));
220
puts(
""
);
221
222
puts(
_
(
" -D, --dump-config Dump all the config options"
));
223
puts(
_
(
" -DD, --dump-changed-config Dump the changed config options"
));
224
puts(
""
);
225
226
puts(
_
(
" -Q, --query <option> [...] Query config options"
));
227
puts(
_
(
" Multiple options can be looked up (space-separated)"
));
228
229
puts(
_
(
"Modify the -D and -Q options:"
));
230
puts(
_
(
" -O, --with-docs Add one-liner documentation"
));
231
puts(
_
(
" -S, --hide-sensitive Hide the value of sensitive options"
));
232
puts(
""
);
233
234
if
(use_color)
235
printf(
"\033[1m%s\033[0m\n"
,
_
(
"Examples:"
));
236
else
237
printf(
"%s\n"
,
_
(
"Examples:"
));
238
239
// L10N: Examples
240
puts(
_
(
" neomutt --alias flatcap gahr"
));
241
puts(
_
(
" neomutt --dump-config --with-docs"
));
242
puts(
_
(
" neomutt --dump-changed-config --hide-sensitive"
));
243
puts(
_
(
" neomutt --with-docs --query alias_format index_format"
));
244
}
245
250
static
void
show_cli_send
(
bool
use_color)
251
{
252
// L10N: Sending Help -- `neomutt --help send`
253
print_header
(
"send"
,
_
(
"Send an email from the command line"
), use_color);
254
puts(
""
);
255
256
puts(
_
(
"These options can supply everything NeoMutt needs to send an email."
));
257
puts(
_
(
"If any parts are missing, NeoMutt will start the TUI to ask for them."
));
258
puts(
_
(
"Addresses may be used before the options, or after a -- marker."
));
259
puts(
_
(
"Aliases may be used in place of addresses."
));
260
puts(
""
);
261
262
// L10N: Parameters in <>s may be translated
263
puts(
_
(
" -a, --attach <file> [...] Attach files"
));
264
puts(
_
(
" Terminated by -- or another option"
));
265
puts(
_
(
" -b, --bcc <address> Add Bcc: address"
));
266
puts(
_
(
" -C, --crypto Use crypto (signing/encryption)"
));
267
puts(
_
(
" Must be set up in the config file"
));
268
puts(
_
(
" -c, --cc <address> Add Cc: address"
));
269
puts(
_
(
" -E, --edit-message Edit message (draft/include)"
));
270
puts(
_
(
" (supplied by -H or -i)"
));
271
puts(
_
(
" -H, --draft <file> Use draft email file"
));
272
puts(
_
(
" Full email with headers and body"
));
273
puts(
_
(
" -i, --include <file> Include body file"
));
274
puts(
_
(
" -s, --subject <subject> Set Subject:"
));
275
puts(
_
(
" -- <address> [...] Add To: addresses"
));
276
puts(
""
);
277
278
if
(use_color)
279
printf(
"\033[1m%s\033[0m\n"
,
_
(
"Examples:"
));
280
else
281
printf(
"%s\n"
,
_
(
"Examples:"
));
282
283
// L10N: Examples: Filenames and email subjects may be translated
284
puts(
_
(
" neomutt flatcap --subject 'Meeting' < meeting.txt"
));
285
puts(
_
(
" neomutt jim@example.com --cc bob@example.com --subject 'Party' --include party.txt"
));
286
puts(
_
(
" neomutt --subject 'Receipts' --attach receipt1.pdf receipt2.pdf -- rocco"
));
287
puts(
_
(
" cat secret.txt | neomutt gahr --subject 'Secret' --crypto"
));
288
}
289
294
static
void
show_cli_tui
(
bool
use_color)
295
{
296
// L10N: TUI Help -- `neomutt --help tui`
297
print_header
(
"tui"
,
_
(
"Start NeoMutt's TUI (Terminal User Interface)"
), use_color);
298
puts(
""
);
299
300
puts(
_
(
"Running NeoMutt with no options will read the config and start the TUI."
));
301
puts(
_
(
"By default, it will open the Index Dialog with the $spool_file Mailbox."
));
302
puts(
""
);
303
304
puts(
_
(
"These options cause NeoMutt to check a mailbox for mail."
));
305
puts(
_
(
"If the condition isn't matched, NeoMutt exits."
));
306
puts(
_
(
" -p, --postponed Resume postponed email"
));
307
puts(
_
(
" -Z, --check-new-mail Check for new mail"
));
308
puts(
_
(
" -z, --check-any-mail Check for any mail"
));
309
puts(
""
);
310
311
// L10N: Parameters in <>s may be translated
312
puts(
_
(
"These options change the starting behavior:"
));
313
puts(
_
(
" -f, --folder <mailbox> Open this mailbox"
));
314
puts(
_
(
" -G, --nntp-browser Open NNTP browser"
));
315
puts(
_
(
" -g, --nntp-server <server> Use this NNTP server"
));
316
puts(
_
(
" -R, --read-only Open mailbox read-only"
));
317
puts(
_
(
" -y, --browser Open mailbox browser"
));
318
puts(
""
);
319
320
if
(use_color)
321
printf(
"\033[1m%s\033[0m\n"
,
_
(
"Examples:"
));
322
else
323
printf(
"%s\n"
,
_
(
"Examples:"
));
324
325
// L10N: Examples: Path may be translated
326
puts(
_
(
" neomutt --folder ~/mail --check-new-mail"
));
327
puts(
_
(
" neomutt --postponed"
));
328
puts(
_
(
" neomutt --browser"
));
329
}
330
336
void
show_cli
(
enum
HelpMode
mode,
bool
use_color)
337
{
338
if
(use_color)
339
printf(
"\033[38;5;255mNeoMutt %s\033[0m\n\n"
,
mutt_make_version
());
340
else
341
printf(
"NeoMutt %s\n\n"
,
mutt_make_version
());
342
343
switch
(mode)
344
{
345
case
HM_NONE
:
346
{
347
show_cli_overview
(use_color);
348
break
;
349
}
350
case
HM_SHARED
:
351
{
352
show_cli_shared
(use_color);
353
break
;
354
}
355
case
HM_HELP
:
356
{
357
show_cli_help
(use_color);
358
break
;
359
}
360
case
HM_INFO
:
361
{
362
show_cli_info
(use_color);
363
break
;
364
}
365
case
HM_SEND
:
366
{
367
show_cli_send
(use_color);
368
break
;
369
}
370
case
HM_TUI
:
371
{
372
show_cli_tui
(use_color);
373
break
;
374
}
375
case
HM_ALL
:
376
{
377
printf(
"------------------------------------------------------------\n"
);
378
show_cli_shared
(use_color);
379
printf(
"\n------------------------------------------------------------\n"
);
380
show_cli_help
(use_color);
381
printf(
"\n------------------------------------------------------------\n"
);
382
show_cli_info
(use_color);
383
printf(
"\n------------------------------------------------------------\n"
);
384
show_cli_send
(use_color);
385
printf(
"\n------------------------------------------------------------\n"
);
386
show_cli_tui
(use_color);
387
printf(
"\n------------------------------------------------------------\n"
);
388
break
;
389
}
390
}
391
}
lib.h
Parse the Command Line.
lib.h
Convenience wrapper for the library headers.
_
#define _(a)
Definition
message.h:28
HelpMode
HelpMode
Show detailed help.
Definition
objects.h:33
HM_SEND
@ HM_SEND
Help about sending email options.
Definition
objects.h:38
HM_ALL
@ HM_ALL
Help about all options.
Definition
objects.h:40
HM_HELP
@ HM_HELP
Help about help.
Definition
objects.h:36
HM_INFO
@ HM_INFO
Help about info options.
Definition
objects.h:37
HM_TUI
@ HM_TUI
Help about starting the tui options.
Definition
objects.h:39
HM_NONE
@ HM_NONE
No extra help.
Definition
objects.h:34
HM_SHARED
@ HM_SHARED
Help about shared config options.
Definition
objects.h:35
show_cli_tui
static void show_cli_tui(bool use_color)
Show Command Line Help for Tui.
Definition
usage.c:294
show_cli_shared
static void show_cli_shared(bool use_color)
Show Command Line Help for Shared.
Definition
usage.c:128
show_cli_info
static void show_cli_info(bool use_color)
Show Command Line Help for Info.
Definition
usage.c:211
show_cli_overview
static void show_cli_overview(bool use_color)
Display NeoMutt command line.
Definition
usage.c:54
print_header
static void print_header(const char *section, const char *desc, bool use_color)
Print a section header.
Definition
usage.c:42
show_cli
void show_cli(enum HelpMode mode, bool use_color)
Show Instructions on how to run NeoMutt.
Definition
usage.c:336
show_cli_help
static void show_cli_help(bool use_color)
Show Command Line Help for Help.
Definition
usage.c:184
show_cli_send
static void show_cli_send(bool use_color)
Show Command Line Help for Send.
Definition
usage.c:250
mutt_make_version
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition
version.c:293
version.h
Display version and copyright about NeoMutt.