udev/dump: also dump current tags
The "TAG" token in udev rules handles the current tags. Let's also show the current tags.
This commit is contained in:
@@ -270,6 +270,20 @@ static int dump_event_json(UdevEvent *event, sd_json_format_flags_t flags, FILE
|
||||
return r;
|
||||
}
|
||||
|
||||
tags = strv_free(tags);
|
||||
|
||||
FOREACH_DEVICE_CURRENT_TAG(dev, tag) {
|
||||
r = strv_extend(&tags, tag);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
if (!strv_isempty(tags)) {
|
||||
r = sd_json_variant_set_field_strv(&v, "currentTags", strv_sort(tags));
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
char **properties;
|
||||
if (device_get_properties_strv(dev, &properties) >= 0 && !strv_isempty(properties)) {
|
||||
r = sd_json_variant_set_field_strv(&v, "properties", strv_sort(properties));
|
||||
@@ -417,6 +431,12 @@ int dump_event(UdevEvent *event, sd_json_format_flags_t flags, FILE *f) {
|
||||
fprintf(f, " %s\n", tag);
|
||||
}
|
||||
|
||||
if (sd_device_get_current_tag_first(dev)) {
|
||||
fprintf(f, "%sCurrent Tags:%s\n", ansi_highlight(), ansi_normal());
|
||||
FOREACH_DEVICE_CURRENT_TAG(dev, tag)
|
||||
fprintf(f, " %s\n", tag);
|
||||
}
|
||||
|
||||
char **properties;
|
||||
if (device_get_properties_strv(dev, &properties) >= 0 && !strv_isempty(properties)) {
|
||||
bool space = true;
|
||||
|
||||
Reference in New Issue
Block a user