Giter Site home page Giter Site logo

drive-cli's Introduction

Briefly-logo

Drive Cli

PyPI version Python version contributions welcome License: MIT HitCount

Get the ability to access Google Drive without leaving your terminal.


Inspiration

  • Google Drive has become a vital part of our day to day life. As much as non-programmers use it, so do programmers in several situations, where we need not use git/github.

  • Drive-CLI is a command-line utility for google drive which helps you access, sync, download, upload, etc. directly to your drive without leaving the command-line. The best part being the commands are similar to git CLI so that you can easily remember them ๐Ÿ’†


Features

  • view-files: list your files; filter them by name, type.
  • clone: download file/folder from drive using sharing link or file ID and get it linked.
  • add_remote: upload existing local file to drive and get it linked.
  • cat: view files contents of text format without actually downloading them.
  • rm: remove particular file or folder.
  • ls: list all the files present in the drive of equivalent current directory.
  • status: list changes made to local files since last pull or pull.
  • pull: get latest changes from drive to local files.
  • push: push the local changes to drive.

Demo


Installation

  • For Usage
    #install using pip 
    $ pip install drive-cli
  • For Development
    • clone the repo
        $ git clone https://github.com/nurdtechie98/drive-cli.git
    • get your client_secret.json from Oauth. Make sure to enable Drive Api for the project.
    • rename the client secret to oauth.json and place it in the drive_cli directory.
    • install the package:
        # move into package directory
        $ cd drive-cli
        # install package in edit mode
        $ pip install -e . #note the dot

Usage

Help

The help for any command in particular, or for the entire list of commands, can be displayed using the help command.

$ drive --help

Usage: drive [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  add_remote  upload any existing file or folder to drive.
  clone       download any file using a sharing link or file ID. It will be
              automatically tracked henceforth.
  login       login to your google account and authenticate the service.
  logout      logout from the account logged in with.
  ls          list all the files present in this directory in the drive
              for tracked directories.
  pull        get latest updates from online drive of the file.
  push        push modification from local files to the drive.
  rm          delete a particular file in drive.
  status      list changes committed since last sync.
  view-files  filter search files and file ID for files user has access to.

Add Remote

Existing files or folders that have not been added to drive can be added and get tracked. In case you need to add a particular file, use the file parameter. The file folder can also be added inside particular parent folder in the drive using the file id of the folder.

# adding entire folder named test to drive
$ cd test
$ drive add_remote
Created a tracked directory
uploading .DS_Store
uploading main.js
uploading test.html
uploading style.css

# adding a particular file (mailer.py) in current directory
$ drive add_remote --file mailer.py
uploaded mailer.py

#adding the file or folder inside particular parent file(test) using its file id
$ drive add_remote --file mailer.py --pid 1RJOWpW5MuP9RXpgZbp9OdauhaBtJd49g
uploaded mailer.py
content added under directory test

Clone

Download a file or folder present in drive using its file id or its sharing link. In case it is a folder it gets tracked.

# using file id note: since it is google doc it will be asked for a choice to select from
$ drive clone 1syTNkfXoc3pzpJSL0Z5LDioTFc46_LjzHjDDUvk90ks
Choose type to export to
 (ENTER to select, s to stop):

 => pdf
    txt
    doc
    zip
    html
    rtf
    odt
Preparing: watson script for download
downloading file  [####################################]  100%
completed download of watson script

# using file sharing link
$ drive clone https://docs.google.com/document/d/1syTNkfXoc3pzpJSL0Z5LDioTFc46_LjzHjDDUvk90ks
Choose type to export to
 (ENTER to select, s to stop):

 => pdf
    txt
    doc
    zip
    html
    rtf
    odt
Preparing: watson script for download
downloading file  [####################################]  100%
completed download of watson script

Uninstalling

    $ pip uninstall drive-cli

Contributing

  • We're are open to enhancements & bug-fixes ๐Ÿ˜„. Take a look here to get started
  • Feel free to add issues and submit patches

Author

Chirag Shetty - nurdtechie98

See also the list of contributors who participated in this project.


License

This project is licensed under the MIT - see the LICENSE file for details.

drive-cli's People

Contributors

nurdtechie98 avatar inishchith avatar arghyadeep99 avatar jean avatar ss18 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.