You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for multiple accounts in config | Fix#98
Add four new flags
* -a | --account - Use a different account than default
* -la | --list accounts - List all the accounts configured with CLIENT_ID, CLIENT_SECRET and REFRESH_TOKEN
* -ca | --create-account - Create a new account
* -da | --delete-account - Delete an existing account
--list-accounts, --create-accounts and --delete-account flags can be used without any usual input required
The config format is changed, ACCOUNT_${account}_ prefix is added to every config var, where ${account} is the account name
The old configs will be automatically migrated with account name default( if default taken then a number suffix will be added like default1, default2, etc )
move authentication/config related functions to auth-utils.[bash|sh]
create more authentication functions to reduce some clutter
add a lot of error checks, minute situations like chmod failing, failing to write to config file
bash script changes: export all sub functions in their sub scripts
export variables when it is created that are needed for parallel uploads
You can use a config file in multiple machines, the values that are explicitly required are `CLIENT_ID`, `CLIENT_SECRET` and `REFRESH_TOKEN`.
373
376
374
377
If `ROOT_FOLDER` is not set, then it is asked if running in an interactive terminal, otherwise `root` is used.
@@ -382,13 +385,14 @@ A pre-generated config file can be also used where interactive terminal access i
382
385
Just have to print values to `"${HOME}/.googledrive.conf"`, e.g:
383
386
384
387
```shell
385
-
printf"%s\n""CLIENT_ID=\"client id\"
386
-
CLIENT_SECRET=\"client secret\"
387
-
REFRESH_TOKEN=\"refresh token\"
388
-
">|"${HOME}/.googledrive.conf"
388
+
printf"%s\n"'
389
+
ACCOUNT_default_CLIENT_ID="client id"
390
+
ACCOUNT_default_CLIENT_SECRET="client secret"
391
+
ACCOUNT_default_REFRESH_TOKEN="refresh token"
392
+
'>|"${HOME}/.googledrive.conf"
389
393
```
390
394
391
-
Note: Don't skip those backslashes before the double qoutes, it's necessary to handle spacing.
395
+
Note: If you have an old config, then nothing extra is needed, just need to run the script once and the default config will be automatically converted to the new format.
392
396
393
397
### Upload
394
398
@@ -422,6 +426,38 @@ These are the custom flags that are currently implemented:
422
426
423
427
---
424
428
429
+
- <strong>-a | --account 'account name'</strong>
430
+
431
+
Use different account than the default one.
432
+
433
+
To change the default account name, do
434
+
435
+
`gupload -a/--account default=account_name`
436
+
437
+
---
438
+
439
+
- <strong>-la | --list-accounts</strong>
440
+
441
+
Print all configured accounts in the config files.
0 commit comments