mirror of
https://github.com/flatpak/flatpak.git
synced 2026-07-05 05:37:10 -04:00
Add a utility for printing aligned
Add a new utility for printing TITLE: value while properly handling Unicode wrt to alignment. This will be shared between info and remote-info. Closes: #2502 Approved by: alexlarsson
This commit is contained in:
committed by
Atomic Bot
parent
d3447eb3fa
commit
90ade7ad96
@@ -1088,3 +1088,18 @@ as_store_find_app (AsStore *store,
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
print_aligned (int len, const char *title, const char *value)
|
||||
{
|
||||
const char *on = "";
|
||||
const char *off = "";
|
||||
|
||||
if (flatpak_fancy_output ())
|
||||
{
|
||||
on = FLATPAK_ANSI_BOLD_ON;
|
||||
off = FLATPAK_ANSI_BOLD_OFF;
|
||||
}
|
||||
|
||||
g_print ("%s%*s%s%s %s\n", on, len - (int)g_utf8_strlen (title, -1), "", title, off, value);
|
||||
}
|
||||
|
||||
@@ -141,6 +141,8 @@ typedef enum {
|
||||
char * ellipsize_string (const char *text, int len);
|
||||
char * ellipsize_string_full (const char *text, int len, FlatpakEllipsizeMode mode);
|
||||
|
||||
void print_aligned (int len, const char *title, const char *value);
|
||||
|
||||
AsApp *as_store_find_app (AsStore *store,
|
||||
const char *ref);
|
||||
const char *as_app_get_localized_name (AsApp *app);
|
||||
|
||||
Reference in New Issue
Block a user