basic/glyph-util: rename "special glyph" to just "glyph"
Admittedly, some of our glyphs _are_ special, e.g. "O=" for SPECIAL_GLYPH_TOUCH ;) But we don't need this in the name. The very long names make some invocations very wordy, e.g. special_glyph(SPECIAL_GLYPH_SLIGHTLY_UNHAPPY_SMILEY). Also, I want to add GLYPH_SPACE, which is not special at all.
This commit is contained in:
@@ -278,7 +278,7 @@ int verb_enable(int argc, char *argv[], void *userdata) {
|
||||
" D-Bus, udev, scripted systemctl call, ...).\n"
|
||||
"%1$s In case of template units, the unit is meant to be enabled with some\n"
|
||||
" instance name specified.",
|
||||
special_glyph(SPECIAL_GLYPH_BULLET));
|
||||
glyph(GLYPH_BULLET));
|
||||
|
||||
if (streq(verb, "disable") && arg_runtime_scope == RUNTIME_SCOPE_USER && !arg_quiet && !arg_no_warn) {
|
||||
/* If some of the units are disabled in user scope but still enabled in global scope,
|
||||
|
||||
@@ -36,7 +36,7 @@ static int list_dependencies_print(const char *name, UnitActiveState state, int
|
||||
on = ansi_highlight_red();
|
||||
}
|
||||
|
||||
printf("%s%s%s ", on, special_glyph(unit_active_state_to_glyph(state)), ansi_normal());
|
||||
printf("%s%s%s ", on, glyph(unit_active_state_to_glyph(state)), ansi_normal());
|
||||
}
|
||||
|
||||
if (!arg_plain) {
|
||||
@@ -46,7 +46,7 @@ static int list_dependencies_print(const char *name, UnitActiveState state, int
|
||||
printf("%s...\n",max_len % 2 ? "" : " ");
|
||||
return 0;
|
||||
}
|
||||
printf("%s", special_glyph(branches & (1 << i) ? SPECIAL_GLYPH_TREE_VERTICAL : SPECIAL_GLYPH_TREE_SPACE));
|
||||
printf("%s", glyph(branches & (1 << i) ? GLYPH_TREE_VERTICAL : GLYPH_TREE_SPACE));
|
||||
}
|
||||
len += 2;
|
||||
|
||||
@@ -55,7 +55,7 @@ static int list_dependencies_print(const char *name, UnitActiveState state, int
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("%s", special_glyph(last ? SPECIAL_GLYPH_TREE_RIGHT : SPECIAL_GLYPH_TREE_BRANCH));
|
||||
printf("%s", glyph(last ? GLYPH_TREE_RIGHT : GLYPH_TREE_BRANCH));
|
||||
}
|
||||
|
||||
if (arg_full) {
|
||||
|
||||
@@ -33,7 +33,7 @@ static int output_waiting_jobs(sd_bus *bus, Table *table, uint32_t id, const cha
|
||||
return log_oom();
|
||||
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, special_glyph(SPECIAL_GLYPH_TREE_RIGHT),
|
||||
TABLE_STRING, glyph(GLYPH_TREE_RIGHT),
|
||||
TABLE_STRING, row,
|
||||
TABLE_EMPTY,
|
||||
TABLE_EMPTY);
|
||||
|
||||
@@ -200,7 +200,7 @@ static int output_machines_list(struct machine_info *machine_infos, unsigned n)
|
||||
mname = strjoin(strna(m->name), " (host)");
|
||||
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, circle ? special_glyph(SPECIAL_GLYPH_BLACK_CIRCLE) : " ",
|
||||
TABLE_STRING, circle ? glyph(GLYPH_BLACK_CIRCLE) : " ",
|
||||
TABLE_SET_COLOR, on_state,
|
||||
TABLE_STRING, m->is_host ? mname : strna(m->name),
|
||||
TABLE_STRING, strna(m->state),
|
||||
|
||||
@@ -173,7 +173,7 @@ static int output_units_list(const UnitInfo *unit_infos, size_t c) {
|
||||
return log_oom();
|
||||
|
||||
r = table_add_many(table,
|
||||
TABLE_STRING, circle ? special_glyph(SPECIAL_GLYPH_BLACK_CIRCLE) : " ",
|
||||
TABLE_STRING, circle ? glyph(GLYPH_BLACK_CIRCLE) : " ",
|
||||
TABLE_SET_COLOR, on_circle,
|
||||
TABLE_SET_BOTH_UNDERLINES, underline,
|
||||
TABLE_STRING, id,
|
||||
@@ -220,12 +220,12 @@ static int output_units_list(const UnitInfo *unit_infos, size_t c) {
|
||||
"%1$s ACTIVE %2$s The high-level unit activation state, i.e. generalization of SUB.%3$s\n"
|
||||
"%1$s SUB %2$s The low-level unit activation state, values depend on unit type.%3$s\n",
|
||||
ansi_grey(),
|
||||
special_glyph(SPECIAL_GLYPH_ARROW_RIGHT),
|
||||
glyph(GLYPH_ARROW_RIGHT),
|
||||
ansi_normal());
|
||||
if (job_count > 0)
|
||||
printf("%s JOB %s Pending job for the unit.%s\n",
|
||||
ansi_grey(),
|
||||
special_glyph(SPECIAL_GLYPH_ARROW_RIGHT),
|
||||
glyph(GLYPH_ARROW_RIGHT),
|
||||
ansi_normal());
|
||||
}
|
||||
|
||||
|
||||
@@ -346,9 +346,9 @@ static void print_status_info(
|
||||
format_enable_state(i->unit_file_state, &enable_on, &enable_off);
|
||||
format_enable_state(i->unit_file_preset, &preset_on, &preset_off);
|
||||
|
||||
const SpecialGlyph glyph = unit_active_state_to_glyph(unit_active_state_from_string(i->active_state));
|
||||
const Glyph icon = unit_active_state_to_glyph(unit_active_state_from_string(i->active_state));
|
||||
|
||||
printf("%s%s%s %s", active_on, special_glyph(glyph), active_off, strna(i->id));
|
||||
printf("%s%s%s %s", active_on, glyph(icon), active_off, strna(i->id));
|
||||
|
||||
if (i->description && !streq_ptr(i->id, i->description))
|
||||
printf(" - %s", i->description);
|
||||
@@ -414,7 +414,7 @@ static void print_status_info(
|
||||
|
||||
printf("%s\n"
|
||||
" %s", dir,
|
||||
special_glyph(SPECIAL_GLYPH_TREE_RIGHT));
|
||||
glyph(GLYPH_TREE_RIGHT));
|
||||
}
|
||||
|
||||
last = ! (*(dropin + 1) && startswith(*(dropin + 1), dir));
|
||||
@@ -489,7 +489,7 @@ static void print_status_info(
|
||||
|
||||
printf("%s %s%s%s %s\n",
|
||||
t == i->triggered_by ? "TriggeredBy:" : " ",
|
||||
on, special_glyph(unit_active_state_to_glyph(state)), off,
|
||||
on, glyph(unit_active_state_to_glyph(state)), off,
|
||||
*t);
|
||||
}
|
||||
|
||||
@@ -516,7 +516,7 @@ static void print_status_info(
|
||||
|
||||
printf("%s %s%s%s %s\n",
|
||||
t == i->triggers ? " Triggers:" : " ",
|
||||
on, special_glyph(SPECIAL_GLYPH_BLACK_CIRCLE), off,
|
||||
on, glyph(GLYPH_BLACK_CIRCLE), off,
|
||||
*t);
|
||||
}
|
||||
|
||||
@@ -535,7 +535,7 @@ static void print_status_info(
|
||||
LIST_FOREACH(conditions, c, i->conditions)
|
||||
if (c->tristate < 0)
|
||||
printf(" %s %s=%s%s%s was not met\n",
|
||||
--n ? special_glyph(SPECIAL_GLYPH_TREE_BRANCH) : special_glyph(SPECIAL_GLYPH_TREE_RIGHT),
|
||||
--n ? glyph(GLYPH_TREE_BRANCH) : glyph(GLYPH_TREE_RIGHT),
|
||||
c->name,
|
||||
c->trigger ? "|" : "",
|
||||
c->negate ? "!" : "",
|
||||
@@ -2343,7 +2343,7 @@ static int show_system_status(sd_bus *bus) {
|
||||
off = ansi_normal();
|
||||
}
|
||||
|
||||
printf("%s%s%s %s\n", on, special_glyph(SPECIAL_GLYPH_BLACK_CIRCLE), off, arg_host ?: hn);
|
||||
printf("%s%s%s %s\n", on, glyph(GLYPH_BLACK_CIRCLE), off, arg_host ?: hn);
|
||||
|
||||
printf(" State: %s%s%s\n",
|
||||
on, strna(mi.state), off);
|
||||
|
||||
@@ -1274,7 +1274,7 @@ static int run(int argc, char *argv[]) {
|
||||
"%s%s/proc/ is not mounted. This is not a supported mode of operation. Please fix\n"
|
||||
"your invocation environment to mount /proc/ and /sys/ properly. Proceeding anyway.\n"
|
||||
"Your mileage may vary.",
|
||||
emoji_enabled() ? special_glyph(SPECIAL_GLYPH_WARNING_SIGN) : "",
|
||||
emoji_enabled() ? glyph(GLYPH_WARNING_SIGN) : "",
|
||||
emoji_enabled() ? " " : "");
|
||||
|
||||
if (arg_action != ACTION_SYSTEMCTL && running_in_chroot() > 0) {
|
||||
|
||||
Reference in New Issue
Block a user