mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
cli: Use -0,-1,-2 instead of "-u n"
I've no idea for what other purpose I'd use numbered options. This is much shorter, and can easily be combined with other options (e.g. -rx1).
This commit is contained in:
parent
c29f318128
commit
b6e4092ea7
2 changed files with 11 additions and 15 deletions
12
doc/ncdu.pod
12
doc/ncdu.pod
|
|
@ -30,13 +30,13 @@ Quiet mode. While calculating disk space, ncdu will update the screen 10 times
|
|||
a second by default, this will be decreased to once every 2 seconds in quiet
|
||||
mode. Use this feature to save bandwidth over remote connections.
|
||||
|
||||
=item -u I<0,1,2>
|
||||
=item -0, -1, -2
|
||||
|
||||
Interface used to give feedback on scanning progress. C<0> will prevent any
|
||||
output from being displayed before ncdu is done scanning, while C<1> will
|
||||
display compact progress information on a single line of output. C<2> presents
|
||||
a full-screen ncurses interface while scanning (the default). C<0> and C<1> do
|
||||
not initialize ncurses before the directory has been scanned, while C<2> is the
|
||||
Interface used to give feedback on scanning progress. C<-0> will prevent any
|
||||
output from being displayed before ncdu is done scanning, while C<-1> will
|
||||
display compact progress information on a single line of output. C<-2> presents
|
||||
a full-screen ncurses interface while scanning (the default). C<-0> and C<-1> do
|
||||
not initialize ncurses before the directory has been scanned, while C<-2> is the
|
||||
only interface that provides feedback on recoverable errors. This does not
|
||||
affect the interface used when re-scanning a directory from the ncurses
|
||||
browser, where the full ncurses interface is always used.
|
||||
|
|
|
|||
14
src/main.c
14
src/main.c
|
|
@ -113,18 +113,11 @@ static void argv_parse(int argc, char **argv) {
|
|||
for(i=1; i<argc; i++) {
|
||||
if(argv[i][0] == '-') {
|
||||
/* flags requiring arguments */
|
||||
if(!strcmp(argv[i], "-X") || !strcmp(argv[i], "-u") || !strcmp(argv[i], "-o") || !strcmp(argv[i], "-f")
|
||||
if(!strcmp(argv[i], "-X") || !strcmp(argv[i], "-o") || !strcmp(argv[i], "-f")
|
||||
|| !strcmp(argv[i], "--exclude-from") || !strcmp(argv[i], "--exclude")) {
|
||||
if(i+1 >= argc) {
|
||||
printf("Option %s requires an argument\n", argv[i]);
|
||||
exit(1);
|
||||
} else if(strcmp(argv[i], "-u") == 0) {
|
||||
i++;
|
||||
if(!(argv[i][0] == '0' || argv[i][0] == '1' || argv[i][0] == '2') || argv[i][1] != 0) {
|
||||
printf("Option -u expects either 0, 1 or 2 as argument.\n");
|
||||
exit(1);
|
||||
}
|
||||
dir_ui = argv[i][0]-'0';
|
||||
} else if(strcmp(argv[i], "-o") == 0)
|
||||
export = argv[++i];
|
||||
else if(strcmp(argv[i], "-f") == 0)
|
||||
|
|
@ -141,6 +134,9 @@ static void argv_parse(int argc, char **argv) {
|
|||
len = strlen(argv[i]);
|
||||
for(j=1; j<len; j++)
|
||||
switch(argv[i][j]) {
|
||||
case '0': dir_ui = 0; break;
|
||||
case '1': dir_ui = 1; break;
|
||||
case '2': dir_ui = 2; break;
|
||||
case 'x': dir_scan_smfs = 1; break;
|
||||
case 'r': read_only = 1; break;
|
||||
case 'q': update_delay = 2000; break;
|
||||
|
|
@ -154,7 +150,7 @@ static void argv_parse(int argc, char **argv) {
|
|||
printf(" -r Read only\n");
|
||||
printf(" -o FILE Export scanned directory to FILE\n");
|
||||
printf(" -f FILE Import scanned directory from FILE\n");
|
||||
printf(" -u <0-2> UI to use when scanning (0=minimal,2=verbose)\n");
|
||||
printf(" -0,-1,-2 UI to use when scanning (0=none,2=full ncurses)\n");
|
||||
printf(" --exclude PATTERN Exclude files that match PATTERN\n");
|
||||
printf(" -X, --exclude-from FILE Exclude files that match any pattern in FILE\n");
|
||||
exit(0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue