aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2017-04-15 00:14:25 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2017-04-15 00:54:38 +0530
commitccb320d6274d73017d2cab070732788a23fda66c (patch)
tree9c0bd2f92cfeca19a3a078f589bc39c87f196ad4
parentcd212b23b97a1072c54f2238958bc583035536c6 (diff)
downloadnnn-ccb320d6274d73017d2cab070732788a23fda66c.tar.gz
Add program help
-rw-r--r--README.md35
-rw-r--r--nnn.112
-rw-r--r--nnn.c21
3 files changed, 48 insertions, 20 deletions
diff --git a/README.md b/README.md
index b62af90..f73e0ff 100644
--- a/README.md
+++ b/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 `?`.
diff --git a/nnn.1 b/nnn.1
index 23352db..7fa55bc 100644
--- a/nnn.1
+++ b/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
diff --git a/nnn.c b/nnn.c
index b8474bd..e792591 100644
--- a/nnn.c
+++ b/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();
}