summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2012-09-06 14:11:44 +0200
committerYorhel <git@yorhel.nl>2012-09-06 14:11:44 +0200
commitb6e4092ea7f5de6addb19c2aa30ed83e33376287 (patch)
tree53c7db4d216f0cd2c53be8933393d7741503145e
parentc29f31812898f6dd6a6650531e883022977acd6e (diff)
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).
-rw-r--r--doc/ncdu.pod12
-rw-r--r--src/main.c14
2 files changed, 11 insertions, 15 deletions
diff --git a/doc/ncdu.pod b/doc/ncdu.pod
index f5fcc78..e7619cd 100644
--- a/doc/ncdu.pod
+++ b/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.
diff --git a/src/main.c b/src/main.c
index 64a530c..3aed380 100644
--- a/src/main.c
+++ b/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);