From a70bbf08ed15c4161a95a454ff03424872a522ac Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Thu, 13 Feb 2025 19:58:07 -0800 Subject: [PATCH] Improved output formatting for people objects --- src/GamUpdate.txt | 13 +++++++++++++ src/gam/__init__.py | 21 +++++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index bf68cff61..e016492bf 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -1,3 +1,16 @@ +7.04.02 + +Improved output formatting for the following commands: +``` +gam info peoplecontact +gam show peoplecontacts +gam info peopleprofile +gam show peopleprofile +gam info contacts +gam show contacts +gam show peopleprofile +``` + 7.04.01 Fixed bug where multiple `querytime` values in a query were not properly processed; diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 7b3579b44..9ae0406ef 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -25,7 +25,7 @@ """ __author__ = 'GAM Team ' -__version__ = '7.04.01' +__version__ = '7.04.02' __license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)' #pylint: disable=wrong-import-position @@ -21864,12 +21864,29 @@ def _printPerson(entityTypeName, user, person, csvPF, FJQC, parameters): 'JSON': json.dumps(cleanJSON(person), ensure_ascii=False, sort_keys=True)}) +PEOPLE_CONTACT_OBJECT_KEYS = { + 'addresses': 'type', + 'calendarUrls': 'type', + 'emailAddresses': 'type', + 'events': 'type', + 'externalIds': 'type', + 'genders': 'value', + 'imClients': 'type', + 'locations': 'type', + 'miscKeywords': 'type', + 'nicknames': 'type', + 'organizations': 'type', + 'relations': 'type', + 'urls': 'type', + 'userDefined': 'key', + } + def _showPerson(userEntityType, user, entityType, person, i, count, FJQC, parameters): _processPersonMetadata(person, parameters) if not FJQC.formatJSON: printEntity([userEntityType, user, entityType, person['resourceName']], i, count) Ind.Increment() - showJSON(None, person) + showJSON(None, person, dictObjectsKey=PEOPLE_CONTACT_OBJECT_KEYS) Ind.Decrement() else: printLine(json.dumps(cleanJSON(person), ensure_ascii=False, sort_keys=True))