Giter Club home page Giter Club logo

buncli's Introduction

bun CLI

A reference front-end for the BunAPI library.

This application is a CLI front-end for the unofficial BunnyCDN dotnet core library. Manage your storage zones with simple commands!

Requirements

The only requirement is the dotnet core 2.1 runtime. This is installed by default on Windows 10, but on Linux or OSX you may need to install it. A tutorial for installing dotnet using package management can be found here. If you just want the binaries you can find those here.

If you're not sure if you have the dotnet core runtime already, you can run this command:

dotnet --version
2.1.403

If the version is 2.1 or higher you're all set to go!

Installation

Since this application is so small it's recommended you build it from source. The following commands should get you off the ground.

git clone https://github.com/bloomtom/buncli.git
cd BunCLI
dotnet build --configuration Release
dotnet BunCLI\bin\Release\netcoreapp2.1\bun.dll --help

Command Options

The following is an output of the --help option.

>dotnet bun.dll --help
bun 0.1.1
MIT License - Copyright 2018 bloomtom

  l          List files stored in a storage zone.

  u          Upload a file from disk or stdin.

  g          Get/download a file. The downloaded file is written to the standard output.

  r          Remove/delete a file.

  help       Display more information on a specific command.

  version    Display version information.

You can get more information about a command by asking for --help on a specific verb:

>dotnet bun.dll u --help
bun 0.1.1
MIT License - Copyright 2018 bloomtom
USAGE:
Upload a file from disk:
>  dotnet bun.dll u --key 01234567-89ab --path somefile.txt --zone MyZone

  -n, --name    The file name to upload as. Defaults to the filename on disk.

  -p, --path    The file path on disk.

  -z, --zone    The storage zone.

  -k, --key     Your API key for the desired storage zone.

  --help        Display this help screen.

  --version     Display version information.

So to upload a file you can simply run dotnet bun.dll u -p myfile.txt.

When running the upload or download command, data can also be taken and written to the standard input and output respectively. To upload a file you can use the < operator. The following will upload somefile.txt and name it MyFile.txt in your BunnyCDN storage.

dotnet bun.dll u -n MyFile.txt < somefile.txt

You can also use pipes. The following is equivalent to the above.

# Forgive the UUOC.
cat somefile.txt | dotnet bun.dll u -n MyFile.txt

Similarly, for downloading you can use the > operator. The following will download MyFile.txt and write it into newfile.txt

dotnet bun.dll g -n MyFile.txt > newfile.txt

Environment Variables

You may have noticed that the example commands don't specify an api key or storage zone, and they aren't specified as required in the help screens. This is because you can use environment variables to set a default key and zone. The following will set these for your current shell session.

set BUN_ZONE=MyZone
set BUN_KEY=01234567-89ab...

If no environment variables are set for the zone or key, and they aren't specified in command options, an error will be thrown.

Key not defined. Either pass the key as an argument or set the BUN_KEY environment variable.

Command options always take priority over environment variables. So if you have a default zone set, you can override it by passing -z.

buncli's People

Contributors

bloomtom avatar dependabot[bot] avatar

Stargazers

 avatar  avatar

Watchers

 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.