NeoMutt  2025-01-09-144-gb44c67
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
usage.c File Reference

Display Usage Information for NeoMutt. More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include "mutt/lib.h"
#include "cli/lib.h"
#include "version.h"
+ Include dependency graph for usage.c:

Go to the source code of this file.

Functions

static void print_header (const char *section, const char *desc, bool use_color)
 Print a section header.
 
static void show_cli_overview (bool use_color)
 Display NeoMutt command line.
 
static void show_cli_shared (bool use_color)
 Show Command Line Help for Shared.
 
static void show_cli_help (bool use_color)
 Show Command Line Help for Help.
 
static void show_cli_info (bool use_color)
 Show Command Line Help for Info.
 
static void show_cli_send (bool use_color)
 Show Command Line Help for Send.
 
static void show_cli_tui (bool use_color)
 Show Command Line Help for Tui.
 
void show_cli (enum HelpMode mode, bool use_color)
 Show Instructions on how to run NeoMutt.
 

Detailed Description

Display Usage Information for NeoMutt.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file usage.c.

Function Documentation

◆ print_header()

static void print_header ( const char *  section,
const char *  desc,
bool  use_color 
)
static

Print a section header.

Parameters
sectionHelp section
descDescription
use_colorHighlight parts of the text

Definition at line 42 of file usage.c.

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}
+ Here is the caller graph for this function:

◆ show_cli_overview()

static void show_cli_overview ( bool  use_color)
static

Display NeoMutt command line.

Parameters
use_colorHighlight parts of the text

Definition at line 54 of file usage.c.

55{
56 // L10N: Help Overview -- `neomutt -h`
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 Don't read system config file"));
72 puts(_(" -F <config> Use this user config file"));
73 puts(_(" -e <command> Run extra commands"));
74 puts(_(" -m <type> Set default mailbox type"));
75 puts(_(" -d <level> Set logging level (1..5)"));
76 puts(_(" -l <file> Set logging file"));
77 puts("");
78
79 print_header("help", _("Get command line help for NeoMutt"), use_color);
80 puts(_("neomutt -h <mode> Detailed help for a mode"));
81 puts(_(" -v[v] Version or license"));
82 puts("");
83
84 print_header("info", _("Ask NeoMutt for config information"), use_color);
85 puts(_("neomutt -A <alias> [...] Lookup email aliases"));
86 puts(_(" -D [-D] [-O] [-S] Dump the config"));
87 puts(_(" -Q <option> [...] [-O] [-S] Query config options"));
88 puts("");
89
90 print_header("send", _("Send an email from the command line"), use_color);
91 puts(_("neomutt -a <file> [...] Attach files"));
92 puts(_(" -b <address> Add Bcc: address"));
93 puts(_(" -C Use crypto (signing/encryption)"));
94 puts(_(" -c <address> Add Cc: address"));
95 puts(_(" -E Edit message"));
96 puts(_(" -H <draft> Use draft email"));
97 puts(_(" -i <include> Include body file"));
98 puts(_(" -s <subject> Set Subject:"));
99 puts(_(" -- <address> [...] Add To: addresses"));
100 puts("");
101
102 print_header("tui", _("Start NeoMutt's TUI (Terminal User Interface)"), use_color);
103 puts(_("neomutt Start NeoMutt's TUI"));
104 puts(_(" -f <mailbox> Open this mailbox"));
105 puts(_(" -G Open NNTP browser"));
106 puts(_(" -g <server> Use this NNTP server"));
107 puts(_(" -p Resume postponed email"));
108 puts(_(" -R Open mailbox read-only"));
109 puts(_(" -y Open mailbox browser"));
110 puts(_(" -Z Check for new mail"));
111 puts(_(" -z Check for any mail"));
112 puts("");
113
114 if (use_color)
115 printf("%s \033[1m%s\033[0m\n", _("For detailed help, run:"), "neomutt -h all");
116 else
117 printf("%s %s\n", _("For detailed help, run:"), "neomutt -h all");
118}
#define _(a)
Definition: message.h:28
static void print_header(const char *section, const char *desc, bool use_color)
Print a section header.
Definition: usage.c:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show_cli_shared()

static void show_cli_shared ( bool  use_color)
static

Show Command Line Help for Shared.

Parameters
use_colorHighlight parts of the text

Definition at line 124 of file usage.c.

125{
126 // L10N: Shared Help -- `neomutt -h shared`
127 print_header("shared", _("Options that apply to all modes"), use_color);
128 puts("");
129
130 puts(_("By default NeoMutt loads one system and one user config file,"));
131 puts(_("e.g. /etc/neomuttrc and ~/.neomuttrc"));
132
133 // L10N: Parameters in <>s may be translated
134 puts(_(" -n Don't read system config file"));
135 puts(_(" -F <config> Use this user config file"));
136 puts(_(" May be used multiple times"));
137 puts("");
138
139 puts(_("These options override the config:"));
140 puts(_(" -m <type> Set default mailbox type"));
141 puts(_(" May be: maildir, mbox, mh, mmdf"));
142 puts(_(" -e <command> Run extra commands"));
143 puts(_(" May be used multiple times"));
144 puts("");
145
146 puts(_("These logging options override the config:"));
147 puts(_(" -d <level> Set logging level"));
148 puts(_(" 0 (off), 1 (low) .. 5 (high)"));
149 puts(_(" -l <file> Set logging file"));
150 puts(_(" Default file '~/.neomuttdebug0'"));
151 puts("");
152
153 if (use_color)
154 printf("\033[1m%s\033[0m\n", _("Examples:"));
155 else
156 printf("%s\n", _("Examples:"));
157
158 // L10N: Examples: Filenames may be translated
159 puts(_(" neomutt -n"));
160 puts(_(" neomutt -F work.rc"));
161 puts(_(" neomutt -F work.rc -F colours.rc"));
162 puts("");
163
164 puts(_(" neomutt -m maildir"));
165 puts(_(" neomutt -e 'set ask_cc = yes'"));
166 puts("");
167
168 puts(_(" neomutt -d 2"));
169 puts(_(" neomutt -d 5 -l neolog"));
170 puts("");
171
172 puts(_("See also:"));
173 puts(_("- Config files: https://neomutt.org/guide/configuration"));
174}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show_cli_help()

static void show_cli_help ( bool  use_color)
static

Show Command Line Help for Help.

Parameters
use_colorHighlight parts of the text

Definition at line 180 of file usage.c.

181{
182 // L10N: Help Help -- `neomutt -h help`
183 print_header("help", _("Get command line help for NeoMutt"), use_color);
184 puts("");
185
186 // L10N: Parameters in <>s may be translated
187 puts(_(" -h Overview of command line options"));
188 puts(_(" -h <mode> Detailed help for: shared, help, info, send, tui, all"));
189 puts(_(" -v NeoMutt version and build parameters"));
190 puts(_(" -vv NeoMutt Copyright and license"));
191 puts("");
192
193 if (use_color)
194 printf("\033[1m%s\033[0m\n", _("Examples:"));
195 else
196 printf("%s\n", _("Examples:"));
197
198 // L10N: Examples
199 puts(_(" neomutt -h info"));
200 puts(_(" neomutt -vv"));
201}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show_cli_info()

static void show_cli_info ( bool  use_color)
static

Show Command Line Help for Info.

Parameters
use_colorHighlight parts of the text

Definition at line 207 of file usage.c.

208{
209 // L10N: Info Help -- `neomutt -h info`
210 print_header("info", _("Ask NeoMutt for config information"), use_color);
211 puts("");
212
213 // L10N: Parameters in <>s may be translated
214 puts(_(" -A <alias> [...] Lookup email aliases"));
215 puts(_(" Multiple aliases can be looked up (space-separated)"));
216 puts("");
217
218 puts(_(" -D Dump all the config options"));
219 puts(_(" -D -D (or -DD) Like -D, but only show changed config"));
220 puts("");
221
222 puts(_(" -Q <option> [...] Query config options"));
223 puts(_(" Multiple options can be looked up (space-separated)"));
224
225 puts(_("Modify the -D and -Q options:"));
226 puts(_(" -O Add one-liner documentation"));
227 puts(_(" -S Hide the value of sensitive options"));
228 puts("");
229
230 if (use_color)
231 printf("\033[1m%s\033[0m\n", _("Examples:"));
232 else
233 printf("%s\n", _("Examples:"));
234
235 // L10N: Examples
236 puts(_(" neomutt -A flatcap gahr"));
237 puts(_(" neomutt -D -O"));
238 puts(_(" neomutt -DD -S"));
239 puts(_(" neomutt -O -Q alias_format index_format"));
240}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show_cli_send()

static void show_cli_send ( bool  use_color)
static

Show Command Line Help for Send.

Parameters
use_colorHighlight parts of the text

Definition at line 246 of file usage.c.

247{
248 // L10N: Sending Help -- `neomutt -h send`
249 print_header("send", _("Send an email from the command line"), use_color);
250 puts("");
251
252 puts(_("These options can supply everything NeoMutt needs to send an email."));
253 puts(_("If any parts are missing, NeoMutt will start the TUI to ask for them."));
254 puts(_("Addresses may be used before the options, or after a -- marker."));
255 puts(_("Aliases may be used in place of addresses."));
256 puts("");
257
258 // L10N: Parameters in <>s may be translated
259 puts(_(" -a <file> [...] Attach files"));
260 puts(_(" Terminated by -- or another option"));
261 puts(_(" -b <address> Add Bcc: address"));
262 puts(_(" -C Use crypto (signing/encryption)"));
263 puts(_(" Must be set up in the config file"));
264 puts(_(" -c <address> Add Cc: address"));
265 puts(_(" -E Edit message"));
266 puts(_(" (supplied by -H or -i)"));
267 puts(_(" -H <draft> Use draft email"));
268 puts(_(" Full email with headers and body"));
269 puts(_(" -i <include> Include body file"));
270 puts(_(" -s <subject> Set Subject:"));
271 puts(_(" -- <address> [...] Add To: addresses"));
272 puts("");
273
274 if (use_color)
275 printf("\033[1m%s\033[0m\n", _("Examples:"));
276 else
277 printf("%s\n", _("Examples:"));
278
279 // L10N: Examples: Filenames and email subjects may be translated
280 puts(_(" neomutt flatcap -s 'Meeting' < meeting.txt"));
281 puts(_(" neomutt jim@example.com -c bob@example.com -s 'Party' -i party.txt"));
282 puts(_(" neomutt -s 'Receipts' -a receipt1.pdf receipt2.pdf -- rocco"));
283 puts(_(" cat secret.txt | neomutt gahr -s 'Secret' -C"));
284}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show_cli_tui()

static void show_cli_tui ( bool  use_color)
static

Show Command Line Help for Tui.

Parameters
use_colorHighlight parts of the text

Definition at line 290 of file usage.c.

291{
292 // L10N: TUI Help -- `neomutt -h tui`
293 print_header("tui", _("Start NeoMutt's TUI (Terminal User Interface)"), use_color);
294 puts("");
295
296 puts(_("Running NeoMutt with no options will read the config and start the TUI."));
297 puts(_("By default, it will open the Index Dialog with the $spool_file Mailbox."));
298 puts("");
299
300 puts(_("These options cause NeoMutt to check a mailbox for mail."));
301 puts(_("If the condition isn't matched, NeoMutt exits."));
302 puts(_(" -p Resume postponed email"));
303 puts(_(" -Z Check for new mail"));
304 puts(_(" -z Check for any mail"));
305 puts("");
306
307 // L10N: Parameters in <>s may be translated
308 puts(_("These options change the starting behavior:"));
309 puts(_(" -f <mailbox> Open this mailbox"));
310 puts(_(" -G Open NNTP browser"));
311 puts(_(" -g <server> Use this NNTP server"));
312 puts(_(" -R Open mailbox read-only"));
313 puts(_(" -y Open mailbox browser"));
314 puts("");
315
316 if (use_color)
317 printf("\033[1m%s\033[0m\n", _("Examples:"));
318 else
319 printf("%s\n", _("Examples:"));
320
321 // L10N: Examples: Path may be translated
322 puts(_(" neomutt -f ~/mail -Z"));
323 puts(_(" neomutt -p"));
324 puts(_(" neomutt -y"));
325}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show_cli()

void show_cli ( enum HelpMode  mode,
bool  use_color 
)

Show Instructions on how to run NeoMutt.

Parameters
modeDetails, e.g. HM_SHARED
use_colorHighlight parts of the text

Definition at line 332 of file usage.c.

333{
334 if (use_color)
335 printf("\033[38;5;255m%s\033[0m\n\n", mutt_make_version());
336 else
337 printf("%s\n\n", mutt_make_version());
338
339 switch (mode)
340 {
341 case HM_NONE:
342 {
343 show_cli_overview(use_color);
344 break;
345 }
346 case HM_SHARED:
347 {
348 show_cli_shared(use_color);
349 break;
350 }
351 case HM_HELP:
352 {
353 show_cli_help(use_color);
354 break;
355 }
356 case HM_INFO:
357 {
358 show_cli_info(use_color);
359 break;
360 }
361 case HM_SEND:
362 {
363 show_cli_send(use_color);
364 break;
365 }
366 case HM_TUI:
367 {
368 show_cli_tui(use_color);
369 break;
370 }
371 case HM_ALL:
372 {
373 printf("------------------------------------------------------------\n");
374 show_cli_shared(use_color);
375 printf("\n------------------------------------------------------------\n");
376 show_cli_help(use_color);
377 printf("\n------------------------------------------------------------\n");
378 show_cli_info(use_color);
379 printf("\n------------------------------------------------------------\n");
380 show_cli_send(use_color);
381 printf("\n------------------------------------------------------------\n");
382 show_cli_tui(use_color);
383 printf("\n------------------------------------------------------------\n");
384 break;
385 }
386 }
387}
@ HM_SEND
Help about sending email options.
Definition: objects.h:40
@ HM_ALL
Help about all options.
Definition: objects.h:42
@ HM_HELP
Help about help.
Definition: objects.h:38
@ HM_INFO
Help about info options.
Definition: objects.h:39
@ HM_TUI
Help about starting the tui options.
Definition: objects.h:41
@ HM_NONE
No extra help.
Definition: objects.h:36
@ HM_SHARED
Help about shared config options.
Definition: objects.h:37
static void show_cli_tui(bool use_color)
Show Command Line Help for Tui.
Definition: usage.c:290
static void show_cli_shared(bool use_color)
Show Command Line Help for Shared.
Definition: usage.c:124
static void show_cli_info(bool use_color)
Show Command Line Help for Info.
Definition: usage.c:207
static void show_cli_overview(bool use_color)
Display NeoMutt command line.
Definition: usage.c:54
static void show_cli_help(bool use_color)
Show Command Line Help for Help.
Definition: usage.c:180
static void show_cli_send(bool use_color)
Show Command Line Help for Send.
Definition: usage.c:246
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition: version.c:295
+ Here is the call graph for this function:
+ Here is the caller graph for this function: