From a0dc04e7b09edc91c6d164ff4e0d81232d7ac8f9 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Thu, 4 Apr 2024 17:57:55 -0700 Subject: [PATCH] Updated `countsonly` option of `gam print|show notes` to additionally display the total number of notes. --- docs/GamUpdates.md | 6 +++++- docs/How-to-Upgrade-from-Standard-GAM.md | 4 ++-- docs/Users-Keep.md | 8 ++++---- docs/Version-and-Help.md | 12 ++++++------ src/GamUpdate.txt | 6 +++++- src/gam/__init__.py | 15 +++++++++------ 6 files changed, 31 insertions(+), 20 deletions(-) diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index dfb9ff7a..a10d675a 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -10,10 +10,14 @@ 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.09 + +Updated `countsonly` option of `gam print|show notes` to additionally display the total number of notes. + ### 6.72.08 Added option `countsonly` to `gam print|show notes` that displays -the number of notes a user owns and the number of notes of user can edit. +the number of notes a user owns and the number of notes a user can edit. ### 6.72.07 diff --git a/docs/How-to-Upgrade-from-Standard-GAM.md b/docs/How-to-Upgrade-from-Standard-GAM.md index 82d8914e..066a4387 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.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.72.09 - 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.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.72.09 - 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/Users-Keep.md b/docs/Users-Keep.md index fb1136f2..058a153f 100644 --- a/docs/Users-Keep.md +++ b/docs/Users-Keep.md @@ -139,8 +139,8 @@ By default, GAM displays all non-trashed notes: * `filter trashed` - Display notes in the trash * `role owner|writer` - Display notes where the user has the specified role -When option `countsonly` is specified, the number of notes a user owns and the number of notes of user can edit -if displayed. +When option `countsonly` is specified, the number of notes a user owns, the number of notes of user can edit +and the total number of notes is displayed. By default, Gam displays the information as an indented list of keys and values; the note text is displayed as individual lines. * `compact` - Display the note text with escaped carriage returns as \r and newlines as \n @@ -158,8 +158,8 @@ By default, GAM displays all non-trashed notes: * `filter trashed` - Display notes in the trash * `role owner|writer` - Display notes where the user has the specified role -When option `countsonly` is specified, the number of notes a user owns and the number of notes of user can edit -if displayed. +When option `countsonly` is specified, the number of notes a user owns, the number of notes of user can edit +and the total number of notes is displayed. By default, when writing CSV files, Gam uses a quote character of double quote `"`. The quote character is used to enclose columns that contain the quote character itself, the column delimiter (comma by default) and new-line characters. Any quote characters within the column are doubled. diff --git a/docs/Version-and-Help.md b/docs/Version-and-Help.md index 55e1c677..e2d8d48e 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.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.72.09 - 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.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.72.09 - 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.08 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.72.09 - 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.08 + Latest: 6.72.09 echo $? 1 ``` @@ -72,7 +72,7 @@ echo $? Print the current version number without details ``` gam version simple -6.72.08 +6.72.09 ``` 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.08 - https://github.com/taers232c/GAMADV-XTD3 +GAM 6.72.09 - 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/GamUpdate.txt b/src/GamUpdate.txt index 88173760..47ecaf7d 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,10 +2,14 @@ Merged GAM-Team version +6.72.09 + +Updated `countsonly` option of `gam print|show notes` to additionally display the total number of notes. + 6.72.08 Added option `countsonly` to `gam print|show notes` that displays -the number of notes a user owns and the number of notes of user can edit. +the number of notes a user owns and the number of notes a user can edit. 6.72.07 diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 27296f16..ddb0cc70 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -71349,7 +71349,7 @@ def printShowNotes(users): csvPF.RemoveJSONTitles(['owner', 'ownedByMe']) if countsOnly and csvPF: if not FJQC.formatJSON: - csvPF.SetTitles(['User', 'noteOwner', 'noteWriter']) + csvPF.SetTitles(['User', 'noteOwner', 'noteWriter', 'totalNotes']) else: csvPF.SetJSONTitles(['User', 'JSON']) fields = getItemFieldsFromFieldsList('notes', fieldsList, returnItemIfNoneList=False) @@ -71370,27 +71370,30 @@ def printShowNotes(users): throwReasons=GAPI.KEEP_THROW_REASONS, filter=noteFilter, fields=fields) if countsOnly: - noteCounts = {'User': user, 'noteOwner': 0, 'noteWriter': 0} + noteCounts = {'User': user, 'noteOwner': 0, 'noteWriter': 0, 'totalNotes': 0} for note in notes: + noteCounts['totalNotes'] += 1 for permission in note['permissions']: if permission.get('user', {}).get('email', '').lower() == user: noteCounts[NOTES_COUNTS_MAP[permission['role']]] += 1 break if not csvPF: if not FJQC.formatJSON: - printEntityKVList([Ent.USER, user], ['noteOwner', noteCounts['noteOwner'], 'noteWriter', noteCounts['noteWriter']], i, count) + printEntityKVList([Ent.USER, user], ['noteOwner', noteCounts['noteOwner'], + 'noteWriter', noteCounts['noteWriter'], + 'totalNotes', noteCounts['totalNotes']], i, count) else: printLine(json.dumps(cleanJSON(noteCounts), ensure_ascii=False, sort_keys=True)) else: - row = {'User': user, 'noteOwner': noteCounts['noteOwner'], 'noteWriter': noteCounts['noteWriter']} + row = {'User': user, 'noteOwner': noteCounts['noteOwner'], 'noteWriter': noteCounts['noteWriter'], + 'totalNotes': noteCounts['totalNotes']} if not FJQC.formatJSON: csvPF.WriteRowTitles(row) elif csvPF.CheckRowTitles(row): row = {'User': noteCounts.pop('User')} row['JSON'] = json.dumps(cleanJSON(noteCounts), ensure_ascii=False, sort_keys=True) csvPF.WriteRowNoFilter(row) - continue - if not csvPF: + elif not csvPF: jcount = len(notes) if not FJQC.formatJSON: entityPerformActionNumItems([Ent.USER, user], jcount, Ent.NOTE, i, count)