Commit Diff


commit - 590d39afbf57d0c3864824c294eea8dd90dd5b41
commit + ff684771e19905219e6c04ce95677c0eb992b82e
blob - 185a4024883adfc4968a7db15dd616bc7c2cefd0
blob + 07fcaee7a9c63d334f443fb8eb6b160d1a1d644f
--- config.h
+++ config.h
@@ -1,7 +1,9 @@
+#define RV_VERSION      "0.0.0"
+
 /* CTRL+X: "^X"
- * ALT+X: "M-X"
- */
+   ALT+X: "M-X" */
 #define RVK_QUIT        "q"
+#define RVK_HELP        "?"
 #define RVK_DOWN        "j"
 #define RVK_UP          "k"
 #define RVK_JUMP_DOWN   "J"
blob - 1b748ccf1a9cac990b0380ff0b14cb0630583106
blob + ae0e144fe3b160db19e8ec65593d8230b948c487
--- rover.c
+++ rover.c
@@ -665,6 +665,24 @@ main(int argc, char *argv[])
     char *program, *key;
     DIR *d;
 
+    if (argc == 2) {
+        if (!strcmp(argv[1], "-v") || !strcmp(argv[1], "--version")) {
+            printf("rover %s\n", RV_VERSION);
+            return 0;
+        } else if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
+            printf(
+                "Usage: rover [DIRECTORY [DIRECTORY [DIRECTORY [...]]]]\n"
+                "  or:  rover [OPTION]\n"
+                "Browse current working directory or the ones specified.\n\n"
+                "Options:\n"
+                "  -h, --help       print this help message and exit\n"
+                "  -v, --version    print program version and exit\n\n"
+                "See rover(1) for more information.\n\n"
+                "Rover homepage: <https://github.com/lecram/rover>.\n"
+            );
+            return 0;
+        }
+    }
     init_term();
     rover.nfiles = 0;
     for (i = 0; i < 10; i++) {
@@ -697,6 +715,11 @@ main(int argc, char *argv[])
         else if (ch >= '0' && ch <= '9') {
             rover.tab = ch - '0';
             cd(0);
+        } else if (!strcmp(key, RVK_HELP)) {
+            ARGS[0] = "man";
+            ARGS[1] = "rover";
+            ARGS[2] = NULL;
+            spawn();
         } else if (!strcmp(key, RVK_DOWN)) {
             if (!rover.nfiles) continue;
             ESEL = (ESEL + 1) % rover.nfiles;
blob - /dev/null
blob + 1df20b10190062add88729498257a074a2d7988a (mode 644)
--- /dev/null
+++ rover.1
@@ -0,0 +1,112 @@
+.TH ROVER 1 rover\-0.0.0
+.SH NAME
+rover \- file browser for the terminal
+.SH SYNOPSIS
+.B rover
+[\fI\,DIRECTORY \/\fR[\fI\,DIRECTORY \/\fR[\fI\,DIRECTORY \/\fR[...]]]]
+.br
+.B rover
+[\fI\,OPTION\/\fR]
+.SH DESCRIPTION
+Browse current working directory or the ones specified.
+.SH OPTIONS
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+print help message and exit
+.TP
+\fB\-v\fR, \fB\-\-version\fR
+print program version and exit
+.SH ENVIRONMENT VARIABLES
+.TP
+.B HOME
+Full path of the home directory.
+.TP
+.B PATH
+Colon\-separated path list for program directories.
+.TP
+.B SHELL
+Name of shell program (e.g. \fI\,/bin/sh\/\fP).
+.TP
+.B PAGER
+Name of pager program (e.g. \fI\,less\/\fP).
+.TP
+.B EDITOR
+Name of editor program (e.g. \fI\,vim\/\fP or \fI\,emacs\/\fP).
+.SH EXAMPLES
+.TP
+Open current working directory on all tabs:
+rover
+.TP
+Open a tab for directory \fI\,foo\/\fP and another for \fI\,bar\/\fP:
+rover foo bar
+.TP
+Open one tab for each directory inside \fI\,/usr/\/\fP:
+rover /usr/*/
+.SH COMMANDS
+.TP
+.B q
+Quit rover.
+.TP
+.B j/k
+Move cursor down/up.
+.TP
+.B J/K
+Move cursor down/up 10 lines.
+.TP
+.B l
+Enter selected directory.
+.TP
+.B h
+Go to parent directory.
+.TP
+.B H
+Go to \fB$HOME\fR directory.
+.TP
+.B <RETURN>
+Open \fB$SHELL\fR on the current directory.
+.TP
+.B <SPACE>
+Open \fB$PAGER\fR with the selected file.
+.TP
+.B e
+Open \fB$EDITOR\fR with the selected file.
+.TP
+.B /
+Start incremental search (\fB<RETURN>\fR to finish).
+.TP
+.B f/d/s
+Toggle file/directory/hidden listing.
+.TP
+.B n/N
+Create new file/directory.
+.TP
+.B r
+Rename selected file or directory.
+.TP
+.B m
+Toggle mark on the selected entry.
+.TP
+.B M
+Toggle mark on all visible entries.
+.TP
+.B a
+Mark all visible entries.
+.TP
+.B X/C/V
+Delete/copy/move all marked entries.
+.TP
+.B 0-9
+Change tab.
+.SH NOTES
+.PP
+\fBImportant\fR: Currently, Rover never asks for confirmation before overwriting
+existing files while copying/moving marked entries. Please be careful to not
+accidentally lose your data.
+.PP
+There are always exactly 10 tabs open, numbered from 0 to 9. The tab number 0
+always start at $HOME. If more than nine directories are specified, only the
+first nine are used for tabs 1\-9 and the rest is ignored. Tabs for which an
+invalid path were assigned will also start at $HOME. Remaining tabs not
+specified on the command line start at the current working directory.
+.PP
+Rover homepage: <https://github.com/lecram/rover>.