[notmuch] [PATCH] simplify notmuch new output

2010-01-26 Thread Jameson Rollins
This patch just simplifies the notmuch new output to make it easier to
read, as well as more easily machine parsable.
---
 notmuch-new.c |   31 ---
 1 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index f25c71f..e07107e 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -816,41 +816,34 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
tv_now);

 if (add_files_state.processed_files) {
-   printf ("Processed %d %s in ", add_files_state.processed_files,
-   add_files_state.processed_files == 1 ?
-   "file" : "total files");
+   printf ("processed: %d %s (",
+   add_files_state.processed_files,
+   add_files_state.processed_files == 1 ? "file" : "files");
notmuch_time_print_formatted_seconds (elapsed);
+   printf (")");
if (elapsed > 1) {
-   printf (" (%d files/sec.). \n",
+   printf (" (%d files/sec.)\n",
(int) (add_files_state.processed_files / elapsed));
} else {
-   printf (".\n");
+   printf ("\n");
}
 }

 if (add_files_state.added_messages) {
-   printf ("Added %d new %s to the database.",
-   add_files_state.added_messages,
-   add_files_state.added_messages == 1 ?
-   "message" : "messages");
-} else {
-   printf ("No new mail.");
+   printf (" new: %d\n",
+   add_files_state.added_messages);
 }

 if (removed_files) {
-   printf (" Removed %d %s.",
-   removed_files,
-   removed_files == 1 ? "message" : "messages");
+   printf (" deletes: %d\n",
+   removed_files);
 }

 if (renamed_files) {
-   printf (" Detected %d file %s.",
-   renamed_files,
-   renamed_files == 1 ? "rename" : "renames");
+   printf (" renames: %d\n",
+   renamed_files);
 }

-printf ("\n");
-
 if (ret) {
printf ("\nNote: At least one error was encountered: %s\n",
notmuch_status_to_string (ret));
-- 
1.6.5
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



[notmuch] [PATCH] simplify notmuch new output

2010-01-26 Thread Jameson Rollins
This patch just simplifies the notmuch new output to make it easier to
read, as well as more easily machine parsable.
---
 notmuch-new.c |   31 ---
 1 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index f25c71f..e07107e 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -816,41 +816,34 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
tv_now);
 
 if (add_files_state.processed_files) {
-   printf ("Processed %d %s in ", add_files_state.processed_files,
-   add_files_state.processed_files == 1 ?
-   "file" : "total files");
+   printf ("processed: %d %s (",
+   add_files_state.processed_files,
+   add_files_state.processed_files == 1 ? "file" : "files");
notmuch_time_print_formatted_seconds (elapsed);
+   printf (")");
if (elapsed > 1) {
-   printf (" (%d files/sec.). \n",
+   printf (" (%d files/sec.)\n",
(int) (add_files_state.processed_files / elapsed));
} else {
-   printf (".\n");
+   printf ("\n");
}
 }
 
 if (add_files_state.added_messages) {
-   printf ("Added %d new %s to the database.",
-   add_files_state.added_messages,
-   add_files_state.added_messages == 1 ?
-   "message" : "messages");
-} else {
-   printf ("No new mail.");
+   printf (" new: %d\n",
+   add_files_state.added_messages);
 }
 
 if (removed_files) {
-   printf (" Removed %d %s.",
-   removed_files,
-   removed_files == 1 ? "message" : "messages");
+   printf (" deletes: %d\n",
+   removed_files);
 }
 
 if (renamed_files) {
-   printf (" Detected %d file %s.",
-   renamed_files,
-   renamed_files == 1 ? "rename" : "renames");
+   printf (" renames: %d\n",
+   renamed_files);
 }
 
-printf ("\n");
-
 if (ret) {
printf ("\nNote: At least one error was encountered: %s\n",
notmuch_status_to_string (ret));
-- 
1.6.5


pgpTmEdxyTmdd.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch