mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-04 04:41:35 +00:00
Show/print full teamdrives info
This commit is contained in:
@@ -8149,6 +8149,7 @@ def printShowTeamDrives(users, csvFormat):
|
|||||||
controlflow.invalid_argument_exit(
|
controlflow.invalid_argument_exit(
|
||||||
myarg, f"gam {['show', 'print'][csvFormat]} teamdrives")
|
myarg, f"gam {['show', 'print'][csvFormat]} teamdrives")
|
||||||
tds = []
|
tds = []
|
||||||
|
titles = []
|
||||||
for user in users:
|
for user in users:
|
||||||
sys.stderr.write(f'Getting Team Drives for {user}\n')
|
sys.stderr.write(f'Getting Team Drives for {user}\n')
|
||||||
user, drive = buildDrive3GAPIObject(user)
|
user, drive = buildDrive3GAPIObject(user)
|
||||||
@@ -8164,20 +8165,21 @@ def printShowTeamDrives(users, csvFormat):
|
|||||||
if not results:
|
if not results:
|
||||||
continue
|
continue
|
||||||
for td in results:
|
for td in results:
|
||||||
if 'id' not in td:
|
td = utils.flatten_json(td)
|
||||||
continue
|
for key in td:
|
||||||
if 'name' not in td:
|
if key not in titles:
|
||||||
td['name'] = '<Unknown Team Drive>'
|
titles.append(key)
|
||||||
this_td = {'id': td['id'], 'name': td['name']}
|
tds.append(td)
|
||||||
if this_td in tds:
|
|
||||||
continue
|
|
||||||
tds.append({'id': td['id'], 'name': td['name']})
|
|
||||||
if csvFormat:
|
if csvFormat:
|
||||||
titles = ['name', 'id']
|
|
||||||
display.write_csv_file(tds, titles, 'Team Drives', todrive)
|
display.write_csv_file(tds, titles, 'Team Drives', todrive)
|
||||||
else:
|
else:
|
||||||
for td in tds:
|
for td in tds:
|
||||||
print(f'Name: {td["name"]} ID: {td["id"]}')
|
name = td.pop('name')
|
||||||
|
my_id = td.pop('id')
|
||||||
|
print(f'Name: {name} ID: {my_id}')
|
||||||
|
display.print_json(td)
|
||||||
|
print()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def doDeleteTeamDrive(users):
|
def doDeleteTeamDrive(users):
|
||||||
|
|||||||
Reference in New Issue
Block a user