Better arg parsing and updated docs
This commit is contained in:
parent
f9eabe730d
commit
3a2438dc08
7
bb.1
7
bb.1
@ -7,6 +7,7 @@ bb \- A bitty browser for command line file management
|
||||
.B bb
|
||||
[\fI-d\fR]
|
||||
[\fI-s\fR]
|
||||
[\fI-0\fR]
|
||||
[\fIdirectory\fR]
|
||||
.SH DESCRIPTION
|
||||
\fBbb\fR is a tiny TUI console application for browsing and managing files.
|
||||
@ -17,6 +18,10 @@ Print the current directory on exit.
|
||||
.B \-s
|
||||
Print the selected files on exit.
|
||||
|
||||
.B \-s
|
||||
If printing the selected files on exit, use NULL-terminated strings instead of
|
||||
newline-separated.
|
||||
|
||||
.B directory
|
||||
Open to this directory.
|
||||
|
||||
@ -48,7 +53,7 @@ Begin browsing in /usr/local/
|
||||
|
||||
.TP
|
||||
.B
|
||||
bb -s | xargs zip archive.zip
|
||||
bb -s -0 | xargs -0 zip archive.zip
|
||||
Select some files to add to a zip archive.
|
||||
|
||||
.TP
|
||||
|
20
bb.c
20
bb.c
@ -952,13 +952,25 @@ int main(int argc, char *argv[])
|
||||
char sep = '\n';
|
||||
int print_dir = 0, print_selection = 0;
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-d") == 0) {
|
||||
if (argv[i][0] == '-' && argv[i][1] == '-')
|
||||
continue;
|
||||
if (argv[i][0] == '-') {
|
||||
for (char *c = &argv[i][1]; *c; c++) {
|
||||
switch (*c) {
|
||||
case 'd':
|
||||
print_dir = 1;
|
||||
} else if (strcmp(argv[i], "-0") == 0) {
|
||||
break;
|
||||
case '0':
|
||||
sep = '\0';
|
||||
} else if (strcmp(argv[i], "-s") == 0) {
|
||||
break;
|
||||
case 's':
|
||||
print_selection = 1;
|
||||
} else if (path[0]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (argv[i][0]) {
|
||||
path = argv[i];
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user