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
|
.B bb
|
||||||
[\fI-d\fR]
|
[\fI-d\fR]
|
||||||
[\fI-s\fR]
|
[\fI-s\fR]
|
||||||
|
[\fI-0\fR]
|
||||||
[\fIdirectory\fR]
|
[\fIdirectory\fR]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\fBbb\fR is a tiny TUI console application for browsing and managing files.
|
\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
|
.B \-s
|
||||||
Print the selected files on exit.
|
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
|
.B directory
|
||||||
Open to this directory.
|
Open to this directory.
|
||||||
|
|
||||||
@ -48,7 +53,7 @@ Begin browsing in /usr/local/
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B
|
.B
|
||||||
bb -s | xargs zip archive.zip
|
bb -s -0 | xargs -0 zip archive.zip
|
||||||
Select some files to add to a zip archive.
|
Select some files to add to a zip archive.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
|
26
bb.c
26
bb.c
@ -952,13 +952,25 @@ int main(int argc, char *argv[])
|
|||||||
char sep = '\n';
|
char sep = '\n';
|
||||||
int print_dir = 0, print_selection = 0;
|
int print_dir = 0, print_selection = 0;
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
if (strcmp(argv[i], "-d") == 0) {
|
if (argv[i][0] == '-' && argv[i][1] == '-')
|
||||||
print_dir = 1;
|
continue;
|
||||||
} else if (strcmp(argv[i], "-0") == 0) {
|
if (argv[i][0] == '-') {
|
||||||
sep = '\0';
|
for (char *c = &argv[i][1]; *c; c++) {
|
||||||
} else if (strcmp(argv[i], "-s") == 0) {
|
switch (*c) {
|
||||||
print_selection = 1;
|
case 'd':
|
||||||
} else if (path[0]) {
|
print_dir = 1;
|
||||||
|
break;
|
||||||
|
case '0':
|
||||||
|
sep = '\0';
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
print_selection = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (argv[i][0]) {
|
||||||
path = argv[i];
|
path = argv[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user