-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converted interface to use click library
- Loading branch information
Showing
4 changed files
with
101 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,72 @@ | ||
rural | ||
===== | ||
|
||
Simple command line utility for uploading files to AWS S3, copying a public link | ||
to that file to the clipboard. | ||
Simple command line utility for uploading files to Amazon Web Services (AWS) | ||
Simple Storage Service (S3) and copying a public link to that file to the | ||
clipboard. | ||
|
||
Installation | ||
------------ | ||
``` | ||
$ git clone https://github.com/woodb/rural.git | ||
$ cd rural | ||
$ sudo python setup.py install | ||
$ rural --configure | ||
```zsh | ||
pip install rural | ||
``` | ||
|
||
Usage | ||
----- | ||
After configuring rural, you can upload any file via the following command: | ||
Once ```rural``` has been configured, it's a simple command line interface. | ||
|
||
```zsh | ||
$ rural myfile.pdf | ||
https://my-s3-bucket.s3.amazonaws.com/myfile.pdf | ||
$ pbpaste | ||
https://my-s3-bucket.s3.amazonaws.com/myfile.pdf | ||
``` | ||
|
||
To show more information, you can use multiple verbosity flags. | ||
|
||
```zsh | ||
$ rural -vv -b my-other-bucket myfile2.pdf | ||
AWS Access Key ID: LsUCBGhw7qZZLUmlmhvtX | ||
AWS Secret Access Key: mKDbRLKUmhocgVepept6QRLDv6GkBkNG1AxOnr | ||
Bucket: my-other-bucket | ||
[========================================] 100% | ||
https://my-other-bucket.s3.amazonaws.com/myfile2.pdf | ||
``` | ||
|
||
For other options, use the ```--help``` flag. | ||
|
||
|
||
Configuration | ||
------------- | ||
```rural``` requires both an AWS access key ID and AWS secret access key that | ||
allow for access to a specified S3 bucket. | ||
|
||
You can configure rural with environment variables ```AWS_ACCESS_KEY_ID```, | ||
```AWS_SECRET_ACCESS_KEY```, and ```RURAL_BUCKET_NAME```. We recommend that | ||
you set these in your environment configuration files (e.g. ```~/.zshrc```). | ||
|
||
```zsh | ||
$ export AWS_ACCESS_KEY_ID=LsUCBGhw7qZZLUmlmhvtX | ||
$ export AWS_SECRET_ACCESS_KEY=mKDbRLKUmhocgVepept6QRLDv6GkBkNG1AxOnr | ||
$ export RURAL_BUCKET_NAME=my-s3-bucket | ||
$ rural myfile.pdf | ||
$ | ||
https://my-s3-bucket.s3.amazonaws.com/myfile.pdf | ||
$ pbpaste | ||
https://my-s3-bucket.s3.amazonaws.com/myfile.pdf | ||
``` | ||
|
||
Additionally, ```rural``` configuration can be overridden at runtime. | ||
|
||
```zsh | ||
$ rural --aws-access-key-id=LsUCBGhw7qZZLUmlmhvtX \ | ||
> --aws-secret-access-key=mKDbRLKUmhocgVepept6QRLDv6GkBkNG1AxOnr \ | ||
> --bucket-name=my-s3-bucket \ | ||
> myfile.pdf | ||
https://my-s3-bucket.s3.amazonaws.com/myfile.pdf | ||
$ pbpaste | ||
https://my-s3-bucket.s3.amazonaws.com/myfile.pdf | ||
``` | ||
|
||
This will put the public link to the file into the clipboard and is valid for 24 hours. | ||
Compatibility | ||
------------- | ||
```rural``` requires Python 2.6 or higher, and might not work on Windows. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
boto | ||
xerox | ||
pyyaml | ||
boto==2.27.0 | ||
click==0.7 | ||
xerox==0.3.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters