[tracker] tracker-status: Cleaned up status output



commit c30e486a9bcd8692cdd36fca71a9a97f377be0b0
Author: Martyn Russell <martyn lanedo com>
Date:   Mon Feb 1 20:46:53 2010 +0000

    tracker-status: Cleaned up status output
    
    Less text and also removed the --show-key option.
    Plus tracker-status didn't have an up to date man page.

 docs/manpages/tracker-status.1     |   65 +++++++++++++++++++++++++++++++----
 src/tracker-utils/tracker-status.c |   53 ++++++++++++++---------------
 2 files changed, 83 insertions(+), 35 deletions(-)
---
diff --git a/docs/manpages/tracker-status.1 b/docs/manpages/tracker-status.1
index ee0c203..739947b 100644
--- a/docs/manpages/tracker-status.1
+++ b/docs/manpages/tracker-status.1
@@ -1,29 +1,78 @@
 .TH tracker-status 1 "July 2009" GNU "User Commands"
 
 .SH NAME
-tracker-status \- Report the
-.B tracker-store
-status
+tracker-status \- Report the state of all data miners
 
 .SH SYNOPSIS
-.B tracker-status
+\fBtracker-status\fR [\fIOPTION\fR...]
 
 .SH DESCRIPTION
 .B tracker-status
-shows the status of
+shows the status of all miners installed. It also allows pausing and
+resuming of miners. For
 .B tracker-store
-which can be one of the following:
+state, you need to use
+.B tracker-control
 .PP
-Initializing, Watching, Indexing, Pending, Optimizing, Idle, Shutdown.
 
 .SH OPTIONS
 .TP
 .B \-?, \-\-help
 Show summary of options.
 .TP
+.B \-f, \-\-follow
+Follow status changes as they happen. This requires Ctrl+C to stop and
+return to the command line. Each new status is put on a new line. To
+get more information, you can use 
+.B \-\-detailed 
+with this.
+.TP
+.B \-d, \-\-detailed
+For the most part, this purely provides a timestamp with each status
+update to follow WHEN changes happened.
+.TP
+.B \-l, \-\-list-miners-running
+This will list all miners which have responded to a D-Bus call.
+Sometimes it is helpfult to use this command with
+.B \-\-list-miners-available.
+.TP
+.B \-a, \-\-list-miners-available
+This will list all miners which are available even if they are not
+running at the moment.
+.TP
+.B \-i, \-\-pause-details
+For listing all miners which are paused and the reasons for being
+paused, you can use this. It will also display the application that
+requested the pause too.
+.TP
+.B \-m, \-\-miner=MINER
+This argument is used with 
+.B \-\-pause
+and 
+.B \-\-resume
+to say which miner you want to pause or resume. You can use the full
+D-Bus name, e.g.
+.B org.freedesktop.Tracker1.Miner.Files
+OR you can use the suffix, e.g.
+.B Files
+.TP
+.B \-p, \-\-pause=REASON
+The REASON here is useful to know WHY the miner should be paused. A
+miner can be paused many times by multiple applications. Only when all
+pauses have been resumed will it continue. If successful, a cookie
+will be given to uniquely identify the request. This cookie is used to
+resume the pause at a later stage.
+.TP
+.B \-r, \-\-resume=COOKIE
+The COOKIE is given by a successful
+.B \-\-pause
+command. It is a number which identifies each pause request. When all
+pauses have been resumed, the miner will resume working.
+.TP
 .B \-V, \-\-version
 Print version.
 
 .SH SEE ALSO
 .BR tracker-store (1),
-.BR tracker-stats (1)
+.BR tracker-stats (1),
+.BR tracker-control (1)
diff --git a/src/tracker-utils/tracker-status.c b/src/tracker-utils/tracker-status.c
index f61002f..dfe3709 100644
--- a/src/tracker-utils/tracker-status.c
+++ b/src/tracker-utils/tracker-status.c
@@ -50,8 +50,8 @@
 static GMainLoop *main_loop;
 static GHashTable *miners_progress;
 static GHashTable *miners_status;
+static gint longest_miner_name_length = 0;
 
-static gboolean   show_key;
 static gboolean   list_miners_running;
 static gboolean   list_miners_available;
 static gboolean   pause_details;
@@ -71,10 +71,6 @@ static GOptionEntry entries[] = {
 	  N_("Include details with state updates (only applies to --follow)"),
 	  NULL
 	},
-	{ "show-key", 'k', 0, G_OPTION_ARG_NONE, &show_key,
-	  N_("Shows the key used when listing miners and their states"),
-	  NULL
-	},
 	{ "list-miners-running", 'l', 0, G_OPTION_ARG_NONE, &list_miners_running,
 	  N_("List all miners currently running"),
 	  NULL
@@ -165,6 +161,7 @@ miner_pause (TrackerMinerManager *manager,
 
 	if (!tracker_miner_manager_pause (manager, miner, reason, &cookie)) {
 		g_printerr (_("Could not pause miner: %s"), miner);
+		g_printerr ("\n");
 		return EXIT_FAILURE;
 	}
 
@@ -249,19 +246,28 @@ miner_print_state (TrackerMinerManager *manager,
 	name = tracker_miner_manager_get_display_name (manager, miner_name);
 
 	if (is_running) {
-		g_print ("%s  [%s] %s: %3.0f%%, %s, %s: '%s'\n",
+		const gchar *paused;
+		gint paused_len;
+
+		paused = _("PAUSED");
+		paused_len = strlen (paused);
+
+		g_print ("%s  %3.0f%%  %-*.*s %s%-*.*s%s %s %s\n",
 		         time_str,
-		         is_paused ? "P" : "R",
-		         _("Progress"),
 		         progress * 100,
+		         longest_miner_name_length,
+		         longest_miner_name_length,
 		         name,
-		         _("Status"),
-		         status ? status : _("Unknown"));
+		         is_paused ? "(" : " ",
+		         paused_len,
+		         paused_len,
+		         is_paused ? paused : " ",
+		         is_paused ? ")" : " ",
+		         status ? "-" : "",
+		         status ? status : "");
 	} else {
-		g_print ("%s  [ ] %s: %3.0f%%, %s\n",
+		g_print ("%s  ---   %s\n",
 		         time_str,
-		         _("Progress"),
-		         0.0,
 		         name);
 	}
 }
@@ -415,20 +421,6 @@ main (gint argc, gchar *argv[])
 		return EXIT_FAILURE;
 	}
 
-	if (show_key) {
-		/* Show status of all miners */
-
-		/* Translators: "Key" is in terms of a "legend". I.e.
-		 * R=Running, P=Paused, etc.
-		 */
-		g_print ("%s:\n", _("Key"));
-		g_print ("  %s\n", _("[R] = Running"));
-		g_print ("  %s\n", _("[P] = Paused"));
-		g_print ("  %s\n", _("[ ] = Not Running"));
-
-		return EXIT_SUCCESS;
-	}
-
 	manager = tracker_miner_manager_new ();
 	miners_available = tracker_miner_manager_get_available (manager);
 	miners_running = tracker_miner_manager_get_running (manager);
@@ -555,6 +547,13 @@ main (gint argc, gchar *argv[])
 
 	for (l = miners_available; l; l = l->next) {
 		const gchar *name;
+
+		name = tracker_miner_manager_get_display_name (manager, l->data);
+		longest_miner_name_length = MAX (longest_miner_name_length, strlen (name));
+	}
+
+	for (l = miners_available; l; l = l->next) {
+		const gchar *name;
 		gboolean is_running;
 
 		name = tracker_miner_manager_get_display_name (manager, l->data);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]