xbps-bin: apply some indentation when printing array object values.
--HG-- extra : convert_revision : bdb070f76cafed9faf69b7cd3769edae0d96b05a
This commit is contained in:
parent
c3c632e387
commit
fea830f2b4
2 changed files with 26 additions and 40 deletions
|
@ -233,6 +233,8 @@ xbps_show_pkg_info(prop_dictionary_t dict)
|
||||||
{
|
{
|
||||||
prop_object_iterator_t iter;
|
prop_object_iterator_t iter;
|
||||||
prop_object_t obj, obj2;
|
prop_object_t obj, obj2;
|
||||||
|
const char *sep = NULL;
|
||||||
|
bool rundeps = false;
|
||||||
|
|
||||||
if (dict == NULL || prop_dictionary_count(dict) == 0)
|
if (dict == NULL || prop_dictionary_count(dict) == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -255,12 +257,23 @@ xbps_show_pkg_info(prop_dictionary_t dict)
|
||||||
prop_number_unsigned_integer_value(obj2));
|
prop_number_unsigned_integer_value(obj2));
|
||||||
|
|
||||||
} else if (prop_object_type(obj2) == PROP_TYPE_ARRAY) {
|
} 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");
|
printf("\n\t");
|
||||||
if (!xbps_callback_array_iter_in_dict(dict,
|
if (!xbps_callback_array_iter_in_dict(dict,
|
||||||
prop_dictionary_keysym_cstring_nocopy(obj),
|
prop_dictionary_keysym_cstring_nocopy(obj),
|
||||||
xbps_list_strings_in_array2, NULL))
|
xbps_list_strings_in_array2, (void *)sep))
|
||||||
return;
|
return;
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
if (rundeps)
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,16 +334,23 @@ static bool
|
||||||
xbps_list_strings_in_array2(prop_object_t obj, void *arg)
|
xbps_list_strings_in_array2(prop_object_t obj, void *arg)
|
||||||
{
|
{
|
||||||
static uint16_t count;
|
static uint16_t count;
|
||||||
|
const char *sep;
|
||||||
|
|
||||||
if (prop_object_type(obj) != PROP_TYPE_STRING)
|
if (prop_object_type(obj) != PROP_TYPE_STRING)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (arg == NULL) {
|
||||||
|
sep = "\n\t";
|
||||||
|
count = 0;
|
||||||
|
} else
|
||||||
|
sep = (const char *)arg;
|
||||||
|
|
||||||
if (count == 4) {
|
if (count == 4) {
|
||||||
printf("\n\t");
|
printf("\n\t");
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s ", prop_string_cstring_nocopy(obj));
|
printf("%s%s", prop_string_cstring_nocopy(obj), sep);
|
||||||
count++;
|
count++;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,31 +104,6 @@ xbps_find_string_in_array(prop_array_t, const char *);
|
||||||
prop_object_iterator_t
|
prop_object_iterator_t
|
||||||
xbps_get_array_iter_from_dict(prop_dictionary_t, const char *);
|
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.
|
* Registers a repository specified by an URI into the pool.
|
||||||
*
|
*
|
||||||
|
@ -150,18 +125,9 @@ xbps_register_repository(const char *);
|
||||||
void
|
void
|
||||||
xbps_show_pkg_info(prop_dictionary_t);
|
xbps_show_pkg_info(prop_dictionary_t);
|
||||||
|
|
||||||
/*
|
/* Internal functions. */
|
||||||
* Shows information of a package by searching in all repositories
|
bool xbps_list_pkgs_in_dict(prop_object_t, void *);
|
||||||
* registered in the pool. It will show information from the
|
bool xbps_list_strings_in_array(prop_object_t, void *);
|
||||||
* first repository that has the package.
|
bool xbps_show_pkg_info_from_repolist(prop_object_t obj, void *arg);
|
||||||
*
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
#endif /* !_XBPS_PLIST_H_ */
|
#endif /* !_XBPS_PLIST_H_ */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue