mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Add program help
This commit is contained in:
parent
cd212b23b9
commit
ccb320d627
35
README.md
35
README.md
|
@ -27,10 +27,11 @@ Noice is Not Noice, a noicer fork...
|
|||
- [Installation](#installation)
|
||||
- [Quickstart](#quickstart)
|
||||
- [Usage](#usage)
|
||||
- [Keyboard shortcuts](#keyboard-shortcuts)
|
||||
- [Filters](#filters)
|
||||
- [File type abbreviations](#file-type-abbreviations)
|
||||
- [Help](#help)
|
||||
- [Cmdline options](#cmdline-options)
|
||||
- [Keyboard shortcuts](#keyboard-shortcuts)
|
||||
- [Filters](#filters)
|
||||
- [File type abbreviations](#file-type-abbreviations)
|
||||
- [Help](#help)
|
||||
- [Copy current file path to clipboard](#copy-current-file-path-to-clipboard)
|
||||
- [Change file associations](#change-file-associations)
|
||||
|
||||
|
@ -168,16 +169,24 @@ Add the following to your shell's rc file for the best experience:
|
|||
|
||||
### Usage
|
||||
|
||||
Start nnn (default dir: current directory):
|
||||
#### Cmdline options
|
||||
|
||||
$ nnn [-d] [-S] [-v] [dir]
|
||||
usage: nnn [-d] [-S] [-v] [h] [PATH]
|
||||
|
||||
The missing terminal file browser for X.
|
||||
|
||||
positional arguments:
|
||||
PATH directory to open [default: current dir]
|
||||
|
||||
optional arguments:
|
||||
-d start in detail view mode
|
||||
-S start in disk usage analyzer mode
|
||||
-v show program version and exit
|
||||
-h show this help and exit
|
||||
|
||||
-d: start in detail view mode
|
||||
-S: start in disk usage analyzer mode
|
||||
-v: show version and exit
|
||||
`>` indicates the currently selected entry in nnn.
|
||||
|
||||
### Keyboard shortcuts
|
||||
#### Keyboard shortcuts
|
||||
|
||||
| Key | Function |
|
||||
| --- | --- |
|
||||
|
@ -209,7 +218,7 @@ Start nnn (default dir: current directory):
|
|||
| `?` | Toggle help screen |
|
||||
| `q` | Quit |
|
||||
|
||||
### Filters
|
||||
#### Filters
|
||||
|
||||
Filters support regexes to display only the matched entries in the current directory view. This effectively allows searching through the directory tree for a particular entry.
|
||||
|
||||
|
@ -219,7 +228,7 @@ An empty filter expression resets the filter.
|
|||
|
||||
If nnn is invoked as root the default filter will also match hidden files.
|
||||
|
||||
### File type abbreviations
|
||||
#### File type abbreviations
|
||||
|
||||
The following abbreviations are used in the detail view:
|
||||
|
||||
|
@ -233,7 +242,7 @@ The following abbreviations are used in the detail view:
|
|||
| `b` | Block Device |
|
||||
| `c` | Character Device |
|
||||
|
||||
### Help
|
||||
#### Help
|
||||
|
||||
$ man nnn
|
||||
To lookup keyboard shortcuts at runtime, press `?`.
|
||||
|
|
12
nnn.1
12
nnn.1
|
@ -3,18 +3,21 @@
|
|||
.Os
|
||||
.Sh NAME
|
||||
.Nm nnn
|
||||
.Nd free, fast, friendly file browser
|
||||
.Nd the missing terminal file browser for X
|
||||
.Sh SYNOPSIS
|
||||
.Nm nnn
|
||||
.Op Ar -d
|
||||
.Op Ar dir
|
||||
.Op Ar -S
|
||||
.Op Ar -v
|
||||
.Op Ar -h
|
||||
.Op Ar PATH
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
(Noice is Not Noice) is a fork of the noice terminal file browser with improved desktop integration, navigation, disk usage analyzer mode, comprehensive file details and much more. It remains a simple and efficient file browser that stays out of your way.
|
||||
.Pp
|
||||
.Nm
|
||||
defaults to the current directory if
|
||||
.Ar dir
|
||||
.Ar PATH
|
||||
is not specified.
|
||||
.Pp
|
||||
.Nm
|
||||
|
@ -92,6 +95,9 @@ supports the following options:
|
|||
.Pp
|
||||
.Fl v
|
||||
show version and exit
|
||||
.Pp
|
||||
.Fl h
|
||||
show program help and exit
|
||||
.Sh CONFIGURATION
|
||||
.Nm
|
||||
is configured by modifying
|
||||
|
|
21
nnn.c
21
nnn.c
|
@ -1585,8 +1585,20 @@ nochange:
|
|||
static void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr, "usage: nnn [-d] [-S] [-v] [dir]\n");
|
||||
exit(1);
|
||||
fprintf(stdout, "usage: nnn [-d] [-S] [-v] [h] [PATH]\n\n\
|
||||
The missing terminal file browser for X.\n\n\
|
||||
positional arguments:\n\
|
||||
PATH directory to open [default: current dir]\n\n\
|
||||
optional arguments:\n\
|
||||
-d start in detail view mode\n\
|
||||
-S start in disk usage analyzer mode\n\
|
||||
-v show program version and exit\n\
|
||||
-h show this help and exit\n\n\
|
||||
Version: %s\n\
|
||||
License: BSD 2-Clause\n\
|
||||
Webpage: https://github.com/jarun/nnn\n", VERSION);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1605,7 +1617,7 @@ main(int argc, char *argv[])
|
|||
if (argc > 3)
|
||||
usage();
|
||||
|
||||
while ((opt = getopt(argc, argv, "dSv")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "dSvh")) != -1) {
|
||||
switch (opt) {
|
||||
case 'S':
|
||||
bsizeorder = 1;
|
||||
|
@ -1615,8 +1627,9 @@ main(int argc, char *argv[])
|
|||
printptr = &printent_long;
|
||||
break;
|
||||
case 'v':
|
||||
fprintf(stderr, "%s\n", VERSION);
|
||||
fprintf(stdout, "%s\n", VERSION);
|
||||
return 0;
|
||||
case 'h':
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue