Added option showusagebytes to gam <UserTypeEntity> print|show drivesettings

This commit is contained in:
Ross Scroggs
2024-05-22 13:18:02 -07:00
parent 7de9e986e0
commit 29792677d7
8 changed files with 63 additions and 17 deletions

View File

@@ -182,7 +182,7 @@ gam user testuser show fileinfo anydrivefilename "Test File"
gam user testuser show fileinfo anydrivefilename:"Test File"
```
## Select file ownership
By default, files the user owns are sisplayed; you can select the ownership characteristic.
By default, files the user owns are displayed; you can select the ownership characteristic.
```
anyowner|(showownedby any|me|others)
```

View File

@@ -10,6 +10,13 @@ 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.76.06
Added option `showusagebytes` to `gam <UserTypeEntity> print|show drivesettings` that displays
the following fields in bytes ```usageBytes,usageInDriveBytes,usageInDriveTrashBytes```
in addition to the fields in their formatted form with units: ```usage,usageInDrive,usageInDriveTrash```.
This will be most useful with `print` as the rows can be sorted based on the `usagexxxBytes` columns.
### 6.76.05
Added options `deletefromoldowner`, `addtonewowner <CalendarAttribute>*` and `nolistmessages`

View File

@@ -335,7 +335,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.76.05 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.76.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.3 64-bit final
MacOS Sonoma 14.4.1 x86_64
@@ -1009,7 +1009,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.76.05 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.76.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.3 64-bit final
Windows-10-10.0.17134 AMD64

View File

@@ -141,10 +141,16 @@ The `quotechar <Character>` option allows you to choose an alternate quote chara
```
gam <UserTypeEntity> print drivesettings [todrive <ToDriveAttribute>*]
[allfields|<DriveSettingsFieldName>*|(fields <DriveSettingsFieldNameList>)]
[delimiter <Character>]
[delimiter <Character>] [showusagebytes]
gam <UserTypeEntity> show drivesettings
[allfields|<DriveSettingsFieldName>*|(fields <DriveSettingsFieldNameList>)]
[delimiter <Character>]
[delimiter <Character>] [showusagebytes]
```
If no fields are selected, these fields will be displayed:
`name,appInstalled,largestChangeId,limit,maxUploadSize,permissionId,rootFolderId,usage,usageInDrive,usageInDriveTrash`
By default, these fields are displayed in formatted form with units: ```usage,usageInDrive,usageInDriveTrash```.
The option `showusagebytes` also displays the following fields in bytes ```usageBytes,usageInDriveBytes,usageInDriveTrashBytes```.
This will be most useful with `print` as the rows can be sorted based on the `usagexxxBytes` columns.

View File

@@ -1,9 +1,9 @@
# Version and Help
\# Version and Help
Print the current version of Gam with details
```
gam version
GAMADV-XTD3 6.76.05 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.76.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.3 64-bit final
MacOS Sonoma 14.4.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.76.05 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.76.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.3 64-bit final
MacOS Sonoma 14.4.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.76.05 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.76.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.3 64-bit final
MacOS Sonoma 14.4.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.76.05
Latest: 6.76.06
echo $?
1
```
@@ -72,7 +72,7 @@ echo $?
Print the current version number without details
```
gam version simple
6.76.05
6.76.06
```
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.76.05 - https://github.com/taers232c/GAMADV-XTD3
GAM 6.76.06 - https://github.com/taers232c/GAMADV-XTD3
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.3 64-bit final
MacOS Sonoma 14.4.1 x86_64

View File

@@ -6904,8 +6904,12 @@ gam <UserTypeEntity> print|show driveactivity [todrive <ToDriveAttribute>*]
usageindrivetrash
<DriveSettingsFieldNameList> ::= "<DriveSettingsFieldName>(,<DriveSettingsFieldName>)*"
gam <UserTypeEntity> print drivesettings [todrive <ToDriveAttribute>*] [allfields|<DriveSettingsFieldName>*|(fields <DriveSettingsFieldNameList>)] [delimiter <Character>]
gam <UserTypeEntity> show drivesettings [allfields|<DriveSettingsFieldName>*|(fields <DriveSettingsFieldNameList>)] [delimiter <Character>]
gam <UserTypeEntity> print drivesettings [todrive <ToDriveAttribute>*]
[allfields|<DriveSettingsFieldName>*|(fields <DriveSettingsFieldNameList>)]
[delimiter <Character>] [showusagebytes]
gam <UserTypeEntity> show drivesettings
[allfields|<DriveSettingsFieldName>*|(fields <DriveSettingsFieldNameList>)]
[delimiter <Character>] [showusagebytes]
gam <UserTypeEntity> print emptydrivefolders [todrive <ToDriveAttribute>*]
[select <DriveFileEntity>]

View File

@@ -2,6 +2,13 @@
Merged GAM-Team version
6.76.06
Added option `showusagebytes` to `gam <UserTypeEntity> print|show drivesettings` that displays
the following fields in bytes ```usageBytes,usageInDriveBytes,usageInDriveTrashBytes```
in addition to the fields in their formatted form with units: ```usage,usageInDrive,usageInDriveTrash```.
This will be most useful with `print` as the rows can be sorted based on the `usagexxxBytes` columns.
6.76.05
Added options `deletefromoldowner`, `addtonewowner <CalendarAttribute>*` and `nolistmessages`

View File

@@ -51424,6 +51424,12 @@ DRIVESETTINGS_SCALAR_FIELDS = [
'usageInDriveTrash',
]
DRIVESETTINGS_USAGE_BYTES_FIELDS = {
'usage': 'usageBytes',
'usageInDrive': 'usageInDriveBytes',
'usageInDriveTrash': 'usageInDriveTrashBytes',
}
def _showSharedDriveThemeSettings(themes):
Ind.Increment()
for theme in themes:
@@ -51435,9 +51441,11 @@ def _showSharedDriveThemeSettings(themes):
Ind.Decrement()
# gam <UserTypeEntity> print drivesettings [todrive <ToDriveAttribute>*]
# [allfields|<DriveSettingsFieldName>*|(fields <DriveSettingsFieldNameList>)] [delimiter <Character>]
# [allfields|<DriveSettingsFieldName>*|(fields <DriveSettingsFieldNameList>)]
# [delimiter <Character>] [showusagebytes]
# gam <UserTypeEntity> show drivesettings
# [allfields|<DriveSettingsFieldName>*|(fields <DriveSettingsFieldNameList>)] [delimiter <Character>]
# [allfields|<DriveSettingsFieldName>*|(fields <DriveSettingsFieldNameList>)]
# [delimiter <Character>] [showusagebytes]
def printShowDriveSettings(users):
def _showFormats(title):
if title in fieldsList and title in feed:
@@ -51473,6 +51481,7 @@ def printShowDriveSettings(users):
csvPF = CSVPrintFile(['email'], ['email']+DRIVESETTINGS_SCALAR_FIELDS) if Act.csvFormat() else None
fieldsList = []
delimiter = GC.Values[GC.CSV_OUTPUT_FIELD_DELIMITER]
showUsageBytes = False
while Cmd.ArgumentsRemaining():
myarg = getArgument()
if csvPF and myarg == 'todrive':
@@ -51483,6 +51492,8 @@ def printShowDriveSettings(users):
fieldsList.extend(DRIVESETTINGS_FIELDS_CHOICE_MAP.values())
elif getFieldsList(myarg, DRIVESETTINGS_FIELDS_CHOICE_MAP, fieldsList):
pass
elif myarg == 'showusagebytes':
showUsageBytes = True
else:
unknownArgumentExit()
if not fieldsList:
@@ -51507,7 +51518,10 @@ def printShowDriveSettings(users):
else:
feed['limit'] = 'UNLIMITED'
for setting in ['usage', 'usageInDrive', 'usageInDriveTrash']:
feed[setting] = formatFileSize(int(feed['storageQuota'].get(setting, '0')))
uval = int(feed['storageQuota'].get(setting, '0'))
feed[setting] = formatFileSize(uval)
if showUsageBytes:
feed[DRIVESETTINGS_USAGE_BYTES_FIELDS[setting]] = uval
if 'rootFolderId' in fieldsList:
feed['rootFolderId'] = callGAPI(drive.files(), 'get',
throwReasons=GAPI.DRIVE_USER_THROW_REASONS,
@@ -51521,6 +51535,10 @@ def printShowDriveSettings(users):
Ind.Increment()
for setting in DRIVESETTINGS_SCALAR_FIELDS:
_showSetting(setting)
if showUsageBytes:
for title, setting in DRIVESETTINGS_USAGE_BYTES_FIELDS.items():
if title in fieldsList and setting in feed:
printKeyValueList([setting, feed[setting]])
_showSetting('folderColorPalette')
_showFormats('exportFormats')
_showFormats('importFormats')
@@ -51538,6 +51556,10 @@ def printShowDriveSettings(users):
row = {'email': user}
for setting in DRIVESETTINGS_SCALAR_FIELDS:
_addSetting(row, setting)
if showUsageBytes:
for title, setting in DRIVESETTINGS_USAGE_BYTES_FIELDS.items():
if title in fieldsList and setting in feed:
row[setting] = feed[setting]
_addSetting(row, 'folderColorPalette')
_addFormats(row, 'exportFormats')
_addFormats(row, 'importFormats')