summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhaedrus Leeds <mwleeds@protonmail.com>2022-07-25 21:45:02 -0500
committerPhaedrus Leeds <mwleeds@protonmail.com>2022-07-25 22:23:28 -0500
commit0fefcac8f410c481dde7c3c6b849ce4015ae1efe (patch)
tree1b05fb7f6e85e842e36236c73e052c479aac85e0
parentac7a8da85b9ab968fc26559059c90163572a4095 (diff)
downloadflatpak-mwleeds/cli-msg-use-bold-more.tar.gz
app: Use bold_on/bold_off variables for consistency/claritymwleeds/cli-msg-use-bold-more
-rw-r--r--app/flatpak-builtins-uninstall.c12
-rw-r--r--app/flatpak-builtins-utils.c10
-rw-r--r--app/flatpak-cli-transaction.c63
3 files changed, 44 insertions, 41 deletions
diff --git a/app/flatpak-builtins-uninstall.c b/app/flatpak-builtins-uninstall.c
index 6672c26f..11dea813 100644
--- a/app/flatpak-builtins-uninstall.c
+++ b/app/flatpak-builtins-uninstall.c
@@ -162,14 +162,14 @@ confirm_runtime_removal (gboolean yes_opt,
g_autoptr(GError) local_error = NULL;
g_autofree char *ref_name = NULL;
const char *ref_branch;
- const char *on = "";
- const char *off = "";
+ const char *bold_on = "";
+ const char *bold_off = "";
gboolean is_extension;
if (flatpak_fancy_output ())
{
- on = FLATPAK_ANSI_BOLD_ON;
- off = FLATPAK_ANSI_BOLD_OFF;
+ bold_on = FLATPAK_ANSI_BOLD_ON;
+ bold_off = FLATPAK_ANSI_BOLD_OFF;
}
is_extension = flatpak_dir_is_runtime_extension (udir->dir, ref);
@@ -218,10 +218,10 @@ confirm_runtime_removal (gboolean yes_opt,
if (is_extension)
g_print (_("Info: applications using the extension %s%s%s branch %s%s%s:\n"),
- on, ref_name, off, on, ref_branch, off);
+ bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off);
else
g_print (_("Info: applications using the runtime %s%s%s branch %s%s%s:\n"),
- on, ref_name, off, on, ref_branch, off);
+ bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off);
g_print (" ");
for (guint i = 0; i < apps->len; i++)
diff --git a/app/flatpak-builtins-utils.c b/app/flatpak-builtins-utils.c
index 21c843e5..37b431f7 100644
--- a/app/flatpak-builtins-utils.c
+++ b/app/flatpak-builtins-utils.c
@@ -1194,16 +1194,16 @@ flatpak_dir_load_appstream_store (FlatpakDir *self,
void
print_aligned (int len, const char *title, const char *value)
{
- const char *on = "";
- const char *off = "";
+ const char *bold_on = "";
+ const char *bold_off = "";
if (flatpak_fancy_output ())
{
- on = FLATPAK_ANSI_BOLD_ON;
- off = FLATPAK_ANSI_BOLD_OFF;
+ bold_on = FLATPAK_ANSI_BOLD_ON;
+ bold_off = FLATPAK_ANSI_BOLD_OFF;
}
- g_print ("%s%*s%s%s %s\n", on, len - (int) cell_width (title), "", title, off, value);
+ g_print ("%s%*s%s%s %s\n", bold_on, len - (int) cell_width (title), "", title, bold_off, value);
}
void
diff --git a/app/flatpak-cli-transaction.c b/app/flatpak-cli-transaction.c
index ca377796..9ca45a61 100644
--- a/app/flatpak-cli-transaction.c
+++ b/app/flatpak-cli-transaction.c
@@ -474,13 +474,13 @@ operation_error (FlatpakTransaction *transaction,
g_autoptr(FlatpakRef) rref = flatpak_ref_parse (ref, NULL);
gboolean non_fatal = (detail & FLATPAK_TRANSACTION_ERROR_DETAILS_NON_FATAL) != 0;
g_autofree char *text = NULL;
- const char *on = "";
- const char *off = "";
+ const char *bold_on = "";
+ const char *bold_off = "";
if (flatpak_fancy_output ())
{
- on = FLATPAK_ANSI_BOLD_ON;
- off = FLATPAK_ANSI_BOLD_OFF;
+ bold_on = FLATPAK_ANSI_BOLD_ON;
+ bold_off = FLATPAK_ANSI_BOLD_OFF;
}
if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_SKIPPED))
@@ -510,28 +510,28 @@ operation_error (FlatpakTransaction *transaction,
{
if (non_fatal)
text = g_strdup_printf (_("Warning: %s%s%s already installed"),
- on, flatpak_ref_get_name (rref), off);
+ bold_on, flatpak_ref_get_name (rref), bold_off);
else
text = g_strdup_printf (_("Error: %s%s%s already installed"),
- on, flatpak_ref_get_name (rref), off);
+ bold_on, flatpak_ref_get_name (rref), bold_off);
}
else if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED))
{
if (non_fatal)
text = g_strdup_printf (_("Warning: %s%s%s not installed"),
- on, flatpak_ref_get_name (rref), off);
+ bold_on, flatpak_ref_get_name (rref), bold_off);
else
text = g_strdup_printf (_("Error: %s%s%s not installed"),
- on, flatpak_ref_get_name (rref), off);
+ bold_on, flatpak_ref_get_name (rref), bold_off);
}
else if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_NEED_NEW_FLATPAK))
{
if (non_fatal)
text = g_strdup_printf (_("Warning: %s%s%s needs a later flatpak version"),
- on, flatpak_ref_get_name (rref), off);
+ bold_on, flatpak_ref_get_name (rref), bold_off);
else
text = g_strdup_printf (_("Error: %s%s%s needs a later flatpak version"),
- on, flatpak_ref_get_name (rref), off);
+ bold_on, flatpak_ref_get_name (rref), bold_off);
}
else if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_OUT_OF_SPACE))
{
@@ -561,28 +561,28 @@ operation_error (FlatpakTransaction *transaction,
g_propagate_prefixed_error (&self->first_operation_error,
g_error_copy (error),
_("Failed to install %s%s%s: "),
- on, flatpak_ref_get_name (rref), off);
+ bold_on, flatpak_ref_get_name (rref), bold_off);
break;
case FLATPAK_TRANSACTION_OPERATION_UPDATE:
g_propagate_prefixed_error (&self->first_operation_error,
g_error_copy (error),
_("Failed to update %s%s%s: "),
- on, flatpak_ref_get_name (rref), off);
+ bold_on, flatpak_ref_get_name (rref), bold_off);
break;
case FLATPAK_TRANSACTION_OPERATION_INSTALL_BUNDLE:
g_propagate_prefixed_error (&self->first_operation_error,
g_error_copy (error),
_("Failed to install bundle %s%s%s: "),
- on, flatpak_ref_get_name (rref), off);
+ bold_on, flatpak_ref_get_name (rref), bold_off);
break;
case FLATPAK_TRANSACTION_OPERATION_UNINSTALL:
g_propagate_prefixed_error (&self->first_operation_error,
g_error_copy (error),
_("Failed to uninstall %s%s%s: "),
- on, flatpak_ref_get_name (rref), off);
+ bold_on, flatpak_ref_get_name (rref), bold_off);
break;
default:
@@ -710,13 +710,13 @@ print_eol_info_message (FlatpakDir *dir,
{
gboolean is_pinned = flatpak_dir_ref_is_pinned (dir, flatpak_decomposed_get_ref (ref));
g_autofree char *ref_branch = flatpak_decomposed_dup_branch (ref);
- const char *on = "";
- const char *off = "";
+ const char *bold_on = "";
+ const char *bold_off = "";
if (flatpak_fancy_output ())
{
- on = FLATPAK_ANSI_BOLD_ON;
- off = FLATPAK_ANSI_BOLD_OFF;
+ bold_on = FLATPAK_ANSI_BOLD_ON;
+ bold_off = FLATPAK_ANSI_BOLD_OFF;
}
/* Here we go to great lengths not to split the sentences. See
@@ -741,16 +741,19 @@ print_eol_info_message (FlatpakDir *dir,
{
/* Only runtimes can be pinned */
g_print (_("\nInfo: (pinned) runtime %s%s%s branch %s%s%s is end-of-life, in favor of %s%s%s branch %s%s%s\n"),
- on, ref_name, off, on, ref_branch, off, on, eolr_name, off, on, eolr_branch, off);
+ bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off,
+ bold_on, eolr_name, bold_off, bold_on, eolr_branch, bold_off);
}
else
{
if (flatpak_decomposed_is_runtime (ref))
g_print (_("\nInfo: runtime %s%s%s branch %s%s%s is end-of-life, in favor of %s%s%s branch %s%s%s\n"),
- on, ref_name, off, on, ref_branch, off, on, eolr_name, off, on, eolr_branch, off);
+ bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off,
+ bold_on, eolr_name, bold_off, bold_on, eolr_branch, bold_off);
else
g_print (_("\nInfo: app %s%s%s branch %s%s%s is end-of-life, in favor of %s%s%s branch %s%s%s\n"),
- on, ref_name, off, on, ref_branch, off, on, eolr_name, off, on, eolr_branch, off);
+ bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off,
+ bold_on, eolr_name, bold_off, bold_on, eolr_branch, bold_off);
}
}
else if (reason)
@@ -759,16 +762,16 @@ print_eol_info_message (FlatpakDir *dir,
{
/* Only runtimes can be pinned */
g_print (_("\nInfo: (pinned) runtime %s%s%s branch %s%s%s is end-of-life, with reason:\n"),
- on, ref_name, off, on, ref_branch, off);
+ bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off);
}
else
{
if (flatpak_decomposed_is_runtime (ref))
g_print (_("\nInfo: runtime %s%s%s branch %s%s%s is end-of-life, with reason:\n"),
- on, ref_name, off, on, ref_branch, off);
+ bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off);
else
g_print (_("\nInfo: app %s%s%s branch %s%s%s is end-of-life, with reason:\n"),
- on, ref_name, off, on, ref_branch, off);
+ bold_on, ref_name, bold_off, bold_on, ref_branch, bold_off);
}
g_print (" %s\n", reason);
}
@@ -1164,13 +1167,13 @@ print_permissions (FlatpakCliTransaction *self,
int i, j;
int rows, cols;
int table_rows, table_cols;
- const char *on = "";
- const char *off = "";
+ const char *bold_on = "";
+ const char *bold_off = "";
if (flatpak_fancy_output ())
{
- on = FLATPAK_ANSI_BOLD_ON;
- off = FLATPAK_ANSI_BOLD_OFF;
+ bold_on = FLATPAK_ANSI_BOLD_ON;
+ bold_off = FLATPAK_ANSI_BOLD_OFF;
}
if (metadata == NULL)
@@ -1212,9 +1215,9 @@ print_permissions (FlatpakCliTransaction *self,
g_print ("\n");
if (old_metadata)
- g_print (_("New %s%s%s permissions:"), on, flatpak_ref_get_name (rref), off);
+ g_print (_("New %s%s%s permissions:"), bold_on, flatpak_ref_get_name (rref), bold_off);
else
- g_print (_("%s%s%s permissions:"), on, flatpak_ref_get_name (rref), off);
+ g_print (_("%s%s%s permissions:"), bold_on, flatpak_ref_get_name (rref), bold_off);
g_print ("\n");