From bad4866bf7fc2b92d71425f502ee605803cfb3c2 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Mon, 15 Apr 2024 15:59:57 -0700 Subject: [PATCH] Added option `oneitemperrow` to 'gam print vaultholds` --- docs/GamUpdates.md | 5 +++++ docs/How-to-Upgrade-from-Standard-GAM.md | 4 ++-- docs/Vault-Takeout.md | 4 ++++ docs/Version-and-Help.md | 12 +++++------ src/GamCommands.txt | 1 + src/GamUpdate.txt | 5 +++++ src/gam/__init__.py | 26 +++++++++++++++++------- 7 files changed, 42 insertions(+), 15 deletions(-) diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index e71ebdca..f6e631ce 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -10,6 +10,11 @@ Add the `-s` option to the end of the above commands to suppress creating the `g See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation +### 6.72.11 + +Added option `oneitemperrow` to 'gam print vaultholds` to have each of a +hold's accounts displayed on a separate row with all of the other hold fields. + ### 6.72.10 Added `timeofdayrange=/` and `timeofdayrange!=/` to `` that allows diff --git a/docs/How-to-Upgrade-from-Standard-GAM.md b/docs/How-to-Upgrade-from-Standard-GAM.md index 246dc257..a2bf0e2b 100644 --- a/docs/How-to-Upgrade-from-Standard-GAM.md +++ b/docs/How-to-Upgrade-from-Standard-GAM.md @@ -334,7 +334,7 @@ writes the credentials into the file oauth2.txt. admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found -GAMADV-XTD3 6.72.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.72.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.2 64-bit final MacOS Sonoma 14.2.1 x86_64 @@ -1006,7 +1006,7 @@ writes the credentials into the file oauth2.txt. C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt C:\GAMADV-XTD3>gam version WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found -GAMADV-XTD3 6.72.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.72.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.2 64-bit final Windows-10-10.0.17134 AMD64 diff --git a/docs/Vault-Takeout.md b/docs/Vault-Takeout.md index 453c2af7..bf98cef8 100644 --- a/docs/Vault-Takeout.md +++ b/docs/Vault-Takeout.md @@ -657,7 +657,11 @@ By default, Gam displays the information as an indented list of keys and values. gam print vaultholds|holds [todrive *] [matters ] [fields ] [shownames] [formatjson [quotechar ]] + [oneitemperrow] ``` +By default, all accounts for a hold are displayed on a single row; +use `oneitemperrow` to have each account displayed on a separate row. + By default, Gam displays the information as columns of fields; the following option causes the output to be in JSON format, * `formatjson` - Display the fields in JSON format. diff --git a/docs/Version-and-Help.md b/docs/Version-and-Help.md index 975616ea..af796dbc 100644 --- a/docs/Version-and-Help.md +++ b/docs/Version-and-Help.md @@ -3,7 +3,7 @@ Print the current version of Gam with details ``` gam version -GAMADV-XTD3 6.72.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.72.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.2 64-bit final MacOS Sonoma 14.2.1 x86_64 @@ -15,7 +15,7 @@ Time: 2023-06-02T21:10:00-07:00 Print the current version of Gam with details and time offset information ``` gam version timeoffset -GAMADV-XTD3 6.72.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.72.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.2 64-bit final MacOS Sonoma 14.2.1 x86_64 @@ -27,7 +27,7 @@ Your system time differs from www.googleapis.com by less than 1 second Print the current version of Gam with extended details and SSL information ``` gam version extended -GAMADV-XTD3 6.72.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.72.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.2 64-bit final MacOS Sonoma 14.2.1 x86_64 @@ -64,7 +64,7 @@ MacOS High Sierra 10.13.6 x86_64 Path: /Users/Admin/bin/gamadv-xtd3 Version Check: Current: 5.35.08 - Latest: 6.72.10 + Latest: 6.72.11 echo $? 1 ``` @@ -72,7 +72,7 @@ echo $? Print the current version number without details ``` gam version simple -6.72.10 +6.72.11 ``` In Linux/MacOS you can do: ``` @@ -82,7 +82,7 @@ echo $VER Print the current version of Gam and address of this Wiki ``` gam help -GAM 6.72.10 - https://github.com/taers232c/GAMADV-XTD3 +GAM 6.72.11 - https://github.com/taers232c/GAMADV-XTD3 Ross Scroggs Python 3.12.2 64-bit final MacOS Sonoma 14.2.1 x86_64 diff --git a/src/GamCommands.txt b/src/GamCommands.txt index ca993081..eea6160c 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -5137,6 +5137,7 @@ gam info vaulthold|hold gam print vaultholds|holds [todrive *] [matters ] [fields ] [shownames] [formatjson [quotechar ]] + [oneitemperrow] gam show vaultholds|holds [matters ] [fields ] [shownames] [formatjson] diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index f7703122..744cde74 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,6 +2,11 @@ Merged GAM-Team version +6.72.11 + +Added option `oneitemperrow` to 'gam print vaultholds` to have each of a +hold's accounts displayed on a separate row with all of the other hold fields. + 6.72.10 Added `timeofdayrange=/` and `timeofdayrange!=/` to `` that allows diff --git a/src/gam/__init__.py b/src/gam/__init__.py index a29165bc..a75ecc77 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -39316,16 +39316,27 @@ PRINT_VAULT_HOLDS_TITLES = ['matterId', 'matterName', 'holdId', 'name', 'updateT # gam print vaultholds|holds [todrive *] [matters ] # [fields ] [shownames] # [formatjson [quotechar ]] +# [oneitemperrow] # gam show vaultholds|holds [matters ] # [fields ] [shownames] # [formatjson] def doPrintShowVaultHolds(): + def _printVaultHold(hold): + row = flattenJSON(hold, flattened={'matterId': matterId, 'matterName': matterName}, timeObjects=VAULT_HOLD_TIME_OBJECTS) + if not FJQC.formatJSON: + csvPF.WriteRowTitles(row) + elif csvPF.CheckRowTitles(row): + csvPF.WriteRowNoFilter({'matterId': matterId, 'matterName': matterName, + 'holdId': hold['holdId'], 'name': hold['name'], + 'JSON': json.dumps(cleanJSON(hold, timeObjects=VAULT_HOLD_TIME_OBJECTS), ensure_ascii=False, sort_keys=True)}) + v = buildGAPIObject(API.VAULT) csvPF = CSVPrintFile(PRINT_VAULT_HOLDS_TITLES, 'sortall') if Act.csvFormat() else None FJQC = FormatJSONQuoteChar() matters = [] cd = None fieldsList = [] + oneItemPerRow = False while Cmd.ArgumentsRemaining(): myarg = getArgument() if csvPF and myarg == 'todrive': @@ -39336,6 +39347,8 @@ def doPrintShowVaultHolds(): cd = buildGAPIObject(API.DIRECTORY) elif getFieldsList(myarg, VAULT_HOLD_FIELDS_CHOICE_MAP, fieldsList, initialField=['holdId', 'name']): pass + elif csvPF and myarg == 'oneitemperrow': + oneItemPerRow = True else: FJQC.GetFormatJSONQuoteChar(myarg, False) fields = getItemFieldsFromFieldsList('holds', fieldsList) @@ -39399,13 +39412,12 @@ def doPrintShowVaultHolds(): else: for hold in holds: _cleanVaultHold(hold, cd) - row = flattenJSON(hold, flattened={'matterId': matterId, 'matterName': matterName}, timeObjects=VAULT_HOLD_TIME_OBJECTS) - if not FJQC.formatJSON: - csvPF.WriteRowTitles(row) - elif csvPF.CheckRowTitles(row): - csvPF.WriteRowNoFilter({'matterId': matterId, 'matterName': matterName, - 'holdId': hold['holdId'], 'name': hold['name'], - 'JSON': json.dumps(cleanJSON(hold, timeObjects=VAULT_HOLD_TIME_OBJECTS), ensure_ascii=False, sort_keys=True)}) + if not oneItemPerRow or not hold.get('accounts', []): + _printVaultHold(hold) + else: + for account in hold.pop('accounts'): + hold['account'] = account + _printVaultHold(hold) if csvPF: csvPF.writeCSVfile('Vault Holds')