Skip to content

Commit

Permalink
Fix root fix set and better handling of error message when fetching d…
Browse files Browse the repository at this point in the history
…rive information
  • Loading branch information
labbots committed Apr 21, 2020
1 parent 0d67bae commit 5302621
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 102 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ This script does not have very many dependencies. Most of the dependencies are a
## Usage

When the script is executed for the first time. It asks for few configuration variables interactively to connect with google APIs. The script requires Client ID and Client secret to access the APIs which can be generated at [google console].

### Generating Google OAuth2 Credentials
- Log into google developer console at [google console].
- Create new Project or use existing project if you don't have a project already created.
- Create new OAuth 2.0 Credentials
- Select Application type "other"
- Provide name for the new credentials
- This would provide a new client ID and Client Secret
- Enable Google Drive API for the project under "Library"

*Note:* When the script is run for the first time. The script must be authorized in browser. This may show a certificate warning if the application authorized domain is not configured on google console project.

### Running the script
Script also asks for root folder to be set to which the script uploads documents by default. The default folder will be the root of your google drive. If you want to upload documents to any specific directory by default then provide the google folder ID or URL of that folder when root folder ID/URL is requested.

For example
Expand Down
2 changes: 1 addition & 1 deletion google-oauth2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jsonValue() {
}

if [ "$1" == "create" ]; then
echo "\nVisit the below URL, tap on allow and then enter the code obtained:"
echo "Visit the below URL, tap on allow and then enter the code obtained:"
sleep 1
URL="https://accounts.google.com/o/oauth2/auth?client_id=$CLIENT_ID&redirect_uri=$REDIRECT_URI&scope=$SCOPE&response_type=code&prompt=consent"
echo -e """$URL""\n"
Expand Down
Loading

2 comments on commit 5302621

@Akianonymus
Copy link
Collaborator

@Akianonymus Akianonymus commented on 5302621 Apr 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why removed the proper intendation from case esac methods? I failed to mention earlier but i use a shell parser to beautify the scripts.

https://github.com/mvdan/sh

Just to maintain consistency.

The command i use shfmt -ci -sr -i 4 -w *sh
( directly writes to the file)
Intendation: 4 (-i)
Switch Cases Intendation (-ci)...

@labbots
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I formatted the code with shfmt default in my visual code. Its good to know the options you used. I will update the formatting with your options provided in my next commit.

Please sign in to comment.