xbps-bin: apply some indentation when printing array object values.
--HG-- extra : convert_revision : bdb070f76cafed9faf69b7cd3769edae0d96b05a
This commit is contained in:
parent
c3c632e387
commit
fea830f2b4
@ -233,6 +233,8 @@ xbps_show_pkg_info(prop_dictionary_t dict)
|
||||
{
|
||||
prop_object_iterator_t iter;
|
||||
prop_object_t obj, obj2;
|
||||
const char *sep = NULL;
|
||||
bool rundeps = false;
|
||||
|
||||
if (dict == NULL || prop_dictionary_count(dict) == 0)
|
||||
return;
|
||||
@ -255,12 +257,23 @@ xbps_show_pkg_info(prop_dictionary_t dict)
|
||||
prop_number_unsigned_integer_value(obj2));
|
||||
|
||||
} else if (prop_object_type(obj2) == PROP_TYPE_ARRAY) {
|
||||
/*
|
||||
* Apply some indentation for array objs other than
|
||||
* "run_depends".
|
||||
*/
|
||||
if (strcmp(prop_dictionary_keysym_cstring_nocopy(obj),
|
||||
"run_depends") == 0) {
|
||||
rundeps = true;
|
||||
sep = " ";
|
||||
}
|
||||
printf("\n\t");
|
||||
if (!xbps_callback_array_iter_in_dict(dict,
|
||||
prop_dictionary_keysym_cstring_nocopy(obj),
|
||||
xbps_list_strings_in_array2, NULL))
|
||||
xbps_list_strings_in_array2, (void *)sep))
|
||||
return;
|
||||
printf("\n");
|
||||
if (rundeps)
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -321,16 +334,23 @@ static bool
|
||||
xbps_list_strings_in_array2(prop_object_t obj, void *arg)
|
||||
{
|
||||
static uint16_t count;
|
||||
const char *sep;
|
||||
|
||||
if (prop_object_type(obj) != PROP_TYPE_STRING)
|
||||
return false;
|
||||
|
||||
if (arg == NULL) {
|
||||
sep = "\n\t";
|
||||
count = 0;
|
||||
} else
|
||||
sep = (const char *)arg;
|
||||
|
||||
if (count == 4) {
|
||||
printf("\n\t");
|
||||
count = 0;
|
||||
}
|
||||
|
||||
printf("%s ", prop_string_cstring_nocopy(obj));
|
||||
printf("%s%s", prop_string_cstring_nocopy(obj), sep);
|
||||
count++;
|
||||
return true;
|
||||
}
|
||||
|
@ -104,31 +104,6 @@ xbps_find_string_in_array(prop_array_t, const char *);
|
||||
prop_object_iterator_t
|
||||
xbps_get_array_iter_from_dict(prop_dictionary_t, const char *);
|
||||
|
||||
/*
|
||||
* Lists information about all packages found in a dictionary, by
|
||||
* using a triplet: pkgname, version and short_desc.
|
||||
*
|
||||
* Arguments:
|
||||
* - prop_object_t: the object to be processed.
|
||||
* - void *: argument passed.
|
||||
*
|
||||
* Returns true on success, false otherwise.
|
||||
*/
|
||||
bool
|
||||
xbps_list_pkgs_in_dict(prop_object_t, void *);
|
||||
|
||||
/*
|
||||
* Lists all string values in an array object in a dictionary.
|
||||
*
|
||||
* Arguments:
|
||||
* - prop_object_t: the object to be processed.
|
||||
* - void *: argument passed.
|
||||
*
|
||||
* Returns true on success, false otherwise.
|
||||
*/
|
||||
bool
|
||||
xbps_list_strings_in_array(prop_object_t, void *);
|
||||
|
||||
/*
|
||||
* Registers a repository specified by an URI into the pool.
|
||||
*
|
||||
@ -150,18 +125,9 @@ xbps_register_repository(const char *);
|
||||
void
|
||||
xbps_show_pkg_info(prop_dictionary_t);
|
||||
|
||||
/*
|
||||
* Shows information of a package by searching in all repositories
|
||||
* registered in the pool. It will show information from the
|
||||
* first repository that has the package.
|
||||
*
|
||||
* Arguments:
|
||||
* - prop_object_t: the object to be processed.
|
||||
* - const char *: passed argument (pkgname string).
|
||||
*
|
||||
* Returns true on success, false otherwise.
|
||||
*/
|
||||
bool
|
||||
xbps_show_pkg_info_from_repolist(prop_object_t obj, void *arg);
|
||||
/* Internal functions. */
|
||||
bool xbps_list_pkgs_in_dict(prop_object_t, void *);
|
||||
bool xbps_list_strings_in_array(prop_object_t, void *);
|
||||
bool xbps_show_pkg_info_from_repolist(prop_object_t obj, void *arg);
|
||||
|
||||
#endif /* !_XBPS_PLIST_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user