* mu: use g_print, no g_message (the latter is hidden) for output
This commit is contained in:
@ -850,15 +850,10 @@ execute_find (MuStore *store, MuConfig *opts, GError **err)
|
|||||||
static void
|
static void
|
||||||
show_usage (void)
|
show_usage (void)
|
||||||
{
|
{
|
||||||
const char *usage_str =
|
g_print ("%s", "usage: mu find [options] <search expression>\n");
|
||||||
"usage: mu find [options] <search expression>\n";
|
|
||||||
g_message ("%s", usage_str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MuError
|
MuError
|
||||||
mu_cmd_find (MuStore *store, MuConfig *opts, GError **err)
|
mu_cmd_find (MuStore *store, MuConfig *opts, GError **err)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -243,23 +243,25 @@ show_time (unsigned t, unsigned processed, gboolean color)
|
|||||||
|
|
||||||
if (color) {
|
if (color) {
|
||||||
if (t)
|
if (t)
|
||||||
g_message ("elapsed: "
|
g_print ("elapsed: "
|
||||||
MU_COLOR_GREEN "%u" MU_COLOR_DEFAULT
|
MU_COLOR_GREEN "%u" MU_COLOR_DEFAULT
|
||||||
" second(s), ~ "
|
" second(s), ~ "
|
||||||
MU_COLOR_GREEN "%u" MU_COLOR_DEFAULT
|
MU_COLOR_GREEN "%u" MU_COLOR_DEFAULT
|
||||||
" msg/s",
|
" msg/s",
|
||||||
t, processed/t);
|
t, processed/t);
|
||||||
else
|
else
|
||||||
g_message ("elapsed: "
|
g_print ("elapsed: "
|
||||||
MU_COLOR_GREEN "%u" MU_COLOR_DEFAULT
|
MU_COLOR_GREEN "%u" MU_COLOR_DEFAULT
|
||||||
" second(s)", t);
|
" second(s)", t);
|
||||||
} else {
|
} else {
|
||||||
if (t)
|
if (t)
|
||||||
g_message ("elapsed: %u second(s), ~ %u msg/s",
|
g_print ("elapsed: %u second(s), ~ %u msg/s",
|
||||||
t, processed/t);
|
t, processed/t);
|
||||||
else
|
else
|
||||||
g_message ("elapsed: %u second(s)", t);
|
g_print ("elapsed: %u second(s)", t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_print ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -272,7 +274,8 @@ cleanup_missing (MuIndex *midx, MuConfig *opts, MuIndexStats *stats,
|
|||||||
time_t t;
|
time_t t;
|
||||||
IndexData idata;
|
IndexData idata;
|
||||||
|
|
||||||
g_message ("cleaning up messages [%s]",
|
if (!opts->quiet)
|
||||||
|
g_print ("cleaning up messages [%s]\n",
|
||||||
mu_runtime_path (MU_RUNTIME_PATH_XAPIANDB));
|
mu_runtime_path (MU_RUNTIME_PATH_XAPIANDB));
|
||||||
|
|
||||||
mu_index_stats_clear (stats);
|
mu_index_stats_clear (stats);
|
||||||
@ -301,13 +304,13 @@ static void
|
|||||||
index_title (const char* maildir, const char* xapiandir, gboolean color)
|
index_title (const char* maildir, const char* xapiandir, gboolean color)
|
||||||
{
|
{
|
||||||
if (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
|
||||||
" ["
|
" ["
|
||||||
MU_COLOR_BLUE "%s" MU_COLOR_DEFAULT
|
MU_COLOR_BLUE "%s" MU_COLOR_DEFAULT
|
||||||
"]", maildir, xapiandir);
|
"]\n", maildir, xapiandir);
|
||||||
else
|
else
|
||||||
g_message ("indexing messages under %s [%s]",
|
g_print ("indexing messages under %s [%s]\n",
|
||||||
maildir, xapiandir);
|
maildir, xapiandir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,6 +325,7 @@ cmd_index (MuIndex *midx, MuConfig *opts, MuIndexStats *stats,
|
|||||||
|
|
||||||
t = time (NULL);
|
t = time (NULL);
|
||||||
|
|
||||||
|
if (!opts->quiet)
|
||||||
index_title (opts->maildir, mu_runtime_path(MU_RUNTIME_PATH_XAPIANDB),
|
index_title (opts->maildir, mu_runtime_path(MU_RUNTIME_PATH_XAPIANDB),
|
||||||
!opts->nocolor);
|
!opts->nocolor);
|
||||||
|
|
||||||
@ -395,9 +399,6 @@ mu_cmd_index (MuStore *store, MuConfig *opts, GError **err)
|
|||||||
if (!midx)
|
if (!midx)
|
||||||
return MU_G_ERROR_CODE(err);
|
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));
|
show_progress = !opts->quiet && isatty(fileno(stdout));
|
||||||
|
|
||||||
mu_index_stats_clear (&stats);
|
mu_index_stats_clear (&stats);
|
||||||
|
|||||||
12
mu/mu-cmd.c
12
mu/mu-cmd.c
@ -322,7 +322,7 @@ mu_cmd_add (MuStore *store, MuConfig *opts, GError **err)
|
|||||||
|
|
||||||
/* note: params[0] will be 'add' */
|
/* note: params[0] will be 'add' */
|
||||||
if (!opts->params[0] || !opts->params[1]) {
|
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,
|
g_set_error (err, MU_ERROR_DOMAIN, MU_ERROR_IN_PARAMETERS,
|
||||||
"missing source and/or target");
|
"missing source and/or target");
|
||||||
return MU_ERROR_IN_PARAMETERS;
|
return MU_ERROR_IN_PARAMETERS;
|
||||||
@ -394,11 +394,11 @@ mu_cmd_remove (MuStore *store, MuConfig *opts, GError **err)
|
|||||||
static void
|
static void
|
||||||
show_usage (void)
|
show_usage (void)
|
||||||
{
|
{
|
||||||
g_message ("usage: mu command [options] [parameters]");
|
g_print ("usage: mu command [options] [parameters]\n");
|
||||||
g_message ("where command is one of index, find, cfind, view, mkdir, "
|
g_print ("where command is one of index, find, cfind, view, mkdir, "
|
||||||
"extract, add, remove or server");
|
"extract, add, remove or server\n");
|
||||||
g_message ("see the mu, mu-<command> or mu-easy manpages for "
|
g_print ("see the mu, mu-<command> or mu-easy manpages for "
|
||||||
"more information");
|
"more information\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user