Giter Club home page Giter Club logo

boxcli's Introduction

boxcli - A Command Line Utility for Box

boxcli is written in Python with Click and Box SDK.

Clone the repo

$ git clone https://github.com/xuwang/boxcli
$ cd boxcli

Install

Using python virtualenv is highly recommended.

Setup Virtualenv (Optional)

# Install virtualenv if not already installed
$ sudo pip install virtualenv

# Create project venv
$ virtualenv venv

# Activate  project venv whenever you want to work the project
$ . venv/bin/activate

# And if you want to go back to the real world:
$ deactivate

Install boxcli

$ pip install --editable .

Setup Box App and Config JWT Auth for boxcli

  • Create and Config a new Box App by following instructions on This Doc

  • Config JWT Authentication by following instructions on This Doc

  • Set following values in env.sh:

     export BOX_CLIENT_ID=
     export BOX_CLIENT_SECRET=
     export BOX_ENTERPRISE_ID=
     export BOX_JWT_KEY_ID=
     export BOX_PRIVATE_KEY_FILE=
     export BOX_DEFAULT_APP_USER_NAME=
    

Create the Default App User if you don't already have one

boxcli handles box resources, i.e. folders/files, on behalf of a "box app user" as documented in Creating Your First App User:

$ source env.sh
$ boxcli user create "${BOX_DEFAULT_APP_USER_NAME}"

This is the default app user when you manange folder/files in Box.

Folder Operations

List folders

$ boxcli folder list

Create a folder

$ boxcli folder create myfiles

Delete a folder

$ boxcli folder delete  myfiles

Warning: All items under myfiles will be deleted recursively!

File Operations

List files

$ boxcli file list

Upload a file

$ boxcli file upload README.md

Download a file

$ boxcli file download README.md

Update content of a file

$ boxcli file update README.md

Delete a file

$ boxcli file delete README.md

Getting Help

$ boxcli --help 
Usage: boxcli [OPTIONS] COMMAND [ARGS]...
  box command line tool
Options:
  --help  Show this message and exit.
Commands:
  file    sub-commands for manage box files.
  folder  sub-commands for manage box folders.
  user    sub-commands for manage box app users.
...

$ boxcli folder --help
Usage: boxcli folder [OPTIONS] COMMAND [ARGS]...
  sub-commands for manage box folders.
Options:
  --help  Show this message and exit.
Commands:
  create  Create a folder.
  delete  Delete a folder.
  get     Get a folder attributes by path.
  list    List items in a folder.
...

boxcli's People

Contributors

xuwang avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

itc3repos

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.