* mu: use g_print, no g_message (the latter is hidden) for output

This commit is contained in:
djcb 2012-06-12 00:12:22 +03:00
parent 1774a42882
commit 46a6b445b3
3 changed files with 22 additions and 26 deletions

View File

@ -850,15 +850,10 @@ execute_find (MuStore *store, MuConfig *opts, GError **err)
static void
show_usage (void)
{
const char *usage_str =
"usage: mu find [options] <search expression>\n";
g_message ("%s", usage_str);
g_print ("%s", "usage: mu find [options] <search expression>\n");
}
MuError
mu_cmd_find (MuStore *store, MuConfig *opts, GError **err)
{

View File

@ -243,23 +243,25 @@ show_time (unsigned t, unsigned processed, gboolean color)
if (color) {
if (t)
g_message ("elapsed: "
g_print ("elapsed: "
MU_COLOR_GREEN "%u" MU_COLOR_DEFAULT
" second(s), ~ "
MU_COLOR_GREEN "%u" MU_COLOR_DEFAULT
" msg/s",
t, processed/t);
else
g_message ("elapsed: "
g_print ("elapsed: "
MU_COLOR_GREEN "%u" MU_COLOR_DEFAULT
" second(s)", t);
} else {
if (t)
g_message ("elapsed: %u second(s), ~ %u msg/s",
g_print ("elapsed: %u second(s), ~ %u msg/s",
t, processed/t);
else
g_message ("elapsed: %u second(s)", t);
g_print ("elapsed: %u second(s)", t);
}
g_print ("\n");
}
@ -272,8 +274,9 @@ cleanup_missing (MuIndex *midx, MuConfig *opts, MuIndexStats *stats,
time_t t;
IndexData idata;
g_message ("cleaning up messages [%s]",
mu_runtime_path (MU_RUNTIME_PATH_XAPIANDB));
if (!opts->quiet)
g_print ("cleaning up messages [%s]\n",
mu_runtime_path (MU_RUNTIME_PATH_XAPIANDB));
mu_index_stats_clear (stats);
@ -301,13 +304,13 @@ static void
index_title (const char* maildir, const char* xapiandir, gboolean color)
{
if (color)
g_message ("indexing messages under "
g_print ("indexing messages under "
MU_COLOR_BLUE "%s" MU_COLOR_DEFAULT
" ["
MU_COLOR_BLUE "%s" MU_COLOR_DEFAULT
"]", maildir, xapiandir);
"]\n", maildir, xapiandir);
else
g_message ("indexing messages under %s [%s]",
g_print ("indexing messages under %s [%s]\n",
maildir, xapiandir);
}
@ -322,8 +325,9 @@ cmd_index (MuIndex *midx, MuConfig *opts, MuIndexStats *stats,
t = time (NULL);
index_title (opts->maildir, mu_runtime_path(MU_RUNTIME_PATH_XAPIANDB),
!opts->nocolor);
if (!opts->quiet)
index_title (opts->maildir, mu_runtime_path(MU_RUNTIME_PATH_XAPIANDB),
!opts->nocolor);
idata.color = !opts->nocolor;
rv = mu_index_run (midx, opts->maildir, opts->reindex, stats,
@ -395,9 +399,6 @@ mu_cmd_index (MuStore *store, MuConfig *opts, GError **err)
if (!midx)
return MU_G_ERROR_CODE(err);
/* note, 'opts->quiet' already cause g_message output not to
* be shown; here, we make sure we only print progress info if
* opts->quiet is false case and when stdout is a tty */
show_progress = !opts->quiet && isatty(fileno(stdout));
mu_index_stats_clear (&stats);

View File

@ -322,7 +322,7 @@ mu_cmd_add (MuStore *store, MuConfig *opts, GError **err)
/* note: params[0] will be 'add' */
if (!opts->params[0] || !opts->params[1]) {
g_message ("usage: mu add <file> [<files>]");
g_print ("usage: mu add <file> [<files>]\n");
g_set_error (err, MU_ERROR_DOMAIN, MU_ERROR_IN_PARAMETERS,
"missing source and/or target");
return MU_ERROR_IN_PARAMETERS;
@ -394,11 +394,11 @@ mu_cmd_remove (MuStore *store, MuConfig *opts, GError **err)
static void
show_usage (void)
{
g_message ("usage: mu command [options] [parameters]");
g_message ("where command is one of index, find, cfind, view, mkdir, "
"extract, add, remove or server");
g_message ("see the mu, mu-<command> or mu-easy manpages for "
"more information");
g_print ("usage: mu command [options] [parameters]\n");
g_print ("where command is one of index, find, cfind, view, mkdir, "
"extract, add, remove or server\n");
g_print ("see the mu, mu-<command> or mu-easy manpages for "
"more information\n");
}
static void