revert the previous commit -- forget about -? as a synonym for --help
An ambiguous option like --back or --word would cause nano to spew the entire help text. It should do the latter only when the user explicitly requests it.
This commit is contained in:
parent
e65b0ba654
commit
75b312ded1
@ -250,7 +250,7 @@ Make the cursor visible in the file browser (putting it on the
|
|||||||
highlighted item) and in the help viewer. Useful for braille users
|
highlighted item) and in the help viewer. Useful for braille users
|
||||||
and people with poor vision.
|
and people with poor vision.
|
||||||
.TP
|
.TP
|
||||||
.BR \-h ", " \-? ", " \-\-help
|
.BR \-h ", " \-\-help
|
||||||
Show a summary of the available command-line options and exit.
|
Show a summary of the available command-line options and exit.
|
||||||
.TP
|
.TP
|
||||||
.BR \-i ", " \-\-autoindent
|
.BR \-i ", " \-\-autoindent
|
||||||
|
|||||||
@ -574,7 +574,6 @@ highlighted item) and in the help viewer. Useful for braille users
|
|||||||
and people with poor vision.
|
and people with poor vision.
|
||||||
|
|
||||||
@item -h
|
@item -h
|
||||||
@itemx -?
|
|
||||||
@itemx --help
|
@itemx --help
|
||||||
Show a summary of command-line options and exit.
|
Show a summary of command-line options and exit.
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@ not allow appending or prepending to any file.
|
|||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
.BR \-h ", " \-? ", " \-\-help
|
.BR \-h ", " \-\-help
|
||||||
Show the available command-line options and exit.
|
Show the available command-line options and exit.
|
||||||
.P
|
.P
|
||||||
For all existing options, see the \fBnano\fR(1) man page.
|
For all existing options, see the \fBnano\fR(1) man page.
|
||||||
|
|||||||
15
src/nano.c
15
src/nano.c
@ -607,7 +607,7 @@ void usage(void)
|
|||||||
#if defined(ENABLE_BROWSER) || defined(ENABLE_HELP)
|
#if defined(ENABLE_BROWSER) || defined(ENABLE_HELP)
|
||||||
print_opt("-g", "--showcursor", N_("Show cursor in file browser & help text"));
|
print_opt("-g", "--showcursor", N_("Show cursor in file browser & help text"));
|
||||||
#endif
|
#endif
|
||||||
print_opt("-h, -?", "--help", N_("Show this help text and exit"));
|
print_opt("-h", "--help", N_("Show this help text and exit"));
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
print_opt("-i", "--autoindent", N_("Automatically indent new lines"));
|
print_opt("-i", "--autoindent", N_("Automatically indent new lines"));
|
||||||
print_opt("-j", "--jumpyscrolling", N_("Scroll per half-screen, not per line"));
|
print_opt("-j", "--jumpyscrolling", N_("Scroll per half-screen, not per line"));
|
||||||
@ -1849,7 +1849,7 @@ int main(int argc, char **argv)
|
|||||||
SET(RESTRICTED);
|
SET(RESTRICTED);
|
||||||
|
|
||||||
while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNOPQ:RS$T:UVWX:Y:Z"
|
while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNOPQ:RS$T:UVWX:Y:Z"
|
||||||
"abcdef:gh?ijklmno:pqr:s:tuvwxy!%_0", long_options, NULL)) != -1) {
|
"abcdef:ghijklmno:pqr:s:tuvwxy!%_0", long_options, NULL)) != -1) {
|
||||||
switch (optchr) {
|
switch (optchr) {
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
case 'A':
|
case 'A':
|
||||||
@ -1999,6 +1999,9 @@ int main(int argc, char **argv)
|
|||||||
SET(SHOW_CURSOR);
|
SET(SHOW_CURSOR);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case 'h':
|
||||||
|
usage();
|
||||||
|
exit(0);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
case 'i':
|
case 'i':
|
||||||
SET(AUTOINDENT);
|
SET(AUTOINDENT);
|
||||||
@ -2095,13 +2098,7 @@ int main(int argc, char **argv)
|
|||||||
SET(ZERO);
|
SET(ZERO);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'h':
|
default:
|
||||||
case '?':
|
|
||||||
/* If the option is valid, print the help text and exit. */
|
|
||||||
if (!optopt) {
|
|
||||||
usage();
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
printf(_("Type '%s -h' for a list of available options.\n"), argv[0]);
|
printf(_("Type '%s -h' for a list of available options.\n"), argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user