Giter Club home page Giter Club logo

acdcli's People

Contributors

sgeb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

acdcli's Issues

Add `get` command to download a file into the current working directory

% acdcli get Documents/Subfolder/file.txt

It should:

  • download the content of file Documents/Subfolder/file.txt and store as file.txt in the current working directory
  • handle prefix / as optional in the command argument
  • print an error if file file.txt already exists in current working directory
  • print an error in case a suffix / is present
  • print an error in case no such file exists on the Amazon Cloud Drive

Implement `cp` to copy files

Copy a single file for now, support globs and whole folders at a later point.

For example:

% acdcli cp /Documents/Samples/sample.jpg /Documents/Pictures

Support target directory and file in `get` command

% acdcli get /Documents/Subfolder/file.txt ~/Desktop/anotherfile.txt

It should:

  • download the content of file Documents/Subfolder/file.txt and store as anotherfile.txt in directory $HOME/Desktop
  • handle prefix / as optional in the remote node path argument
  • respect common path rules for target directory (~, /, ., etc)
  • print an error if target directory does not exist
  • print an error if file anotherfile.txt already exists in target directory
  • print an error in case a suffix / is present in remote node path
  • print an error in case no such file exists on the Amazon Cloud Drive

Depends on issue #7.

Insecure amazon client/secret

Hi,

I noticed that you plan to embed Amazon's client id and secret in the binary. While this is convinient, this is also insecure.

wmn@cratos ~/code/src/github.com/sgeb/acdcli [master] ± % ACD_API_CLIENTID="amzn1.application-oa2-client.this_is_a_hash" ACD_API_SECRET="this_is_a_secret" make dev
==> Getting dependencies...
>> Getting package github.com/sgeb/go-acd
>> Getting package golang.org/x/oauth2
>> Getting package github.com/mitchellh/cli
>> Getting package github.com/dustin/go-humanize
>> Getting package github.com/mitchellh/gox
package github.com/mitchellh/cli
    imports golang.org/x/crypto/ssh/terminal: golang.org/x/crypto is a custom import path for https://go.googlesource.com/crypto, but /Users/wmn/code/src/golang.org/x/crypto is checked out from https://code.google.com/p/go.crypto
>> Setting github.com/dustin/go-humanize to version
>> Setting golang.org/x/oauth2 to version
>> Setting github.com/mitchellh/cli to version
>> Setting github.com/sgeb/go-acd to version
>> Setting github.com/mitchellh/gox to version
>> Building package github.com/sgeb/go-acd
>> Building package golang.org/x/oauth2
>> Building package github.com/mitchellh/cli
>> Building package github.com/dustin/go-humanize
>> Building package github.com/mitchellh/gox
>> All Done
==> Removing old directory...
==> Building...
Number of parallel builds: 8

-->    darwin/amd64: github.com/sgeb/acdcli/acdcli

==> Results:
total 15024
-rwxr-xr-x  1 wmn  staff   7.3M May 22 10:25 acdcli
wmn@cratos ~/code/src/github.com/sgeb/acdcli [master] ± % strings ~/code/bin/acdcli| grep 'a_hash\|a_secret'
this_is_a_secret
amzn1.application-oa2-client.this_is_a_hash

Although the secret does not have a known guessable prefix, it is always 64 chars which is easy guessable.

Take a look at https://github.com/caseymrm/drivesink, they have the client/secret hosted on a website and the users only get their access token and refresh token.

Implement `mv` to move files

Move a single file for now, support globs and whole folders at a later point.

For example:

% acdcli mv /Documents/Samples/sample.jpg /Documents/Pictures

Placeholder for further improvements and ideas

  • List of files sortable by size
  • Display date of last modification
  • Cache metadata locally, update periodically using eTag
  • Extract logTransport into separate library
  • Display periodic updates on download/upload progress, speed and ETA
  • Support CLI options to switch between 1000 and 1024 size units (i.e. MB vs MiB). I prefer the former, Amazon Cloud Drive displays the latter. Currently uses the latter to not confuse users where acdcli would display different sizes from amazon on the web.
  • ls accepts multiple parameters on the commandline
  • create intermediate directories for the target of a download
  • Commands share and unshare
  • Make sure paths work on windows (see os.IsPathSeparator)
  • Command sync

Support target directory in `get` command

% acdcli get /Documents/Subfolder/file.txt ~/Desktop/

It should:

  • download the content of file Documents/Subfolder/file.txt and store as file.txt in directory $HOME/Desktop
  • handle prefix / as optional in the remote node path argument
  • handle suffix / as optional in the target directory argument
  • respect common path rules for target directory (~, /, ., etc)
  • print an error if target directory does not exist
  • print an error if file file.txt already exists in target directory
  • print an error in case a suffix / is present in remote node path
  • print an error in case no such file exists on the Amazon Cloud Drive

Depends on issue #6.

Add `info` command to display a node's metadata (json)

% acdacli info /Documents/Subfolder/file.txt
[... metadata as json ...]

It should:

  • display the metadata of Documents/Subfolder/file.txt as pretty-printed JSON
  • handle prefix / as optional in the command argument
  • print an error in case a suffix / is present and the deepest node is not a directory
  • print an error in case Documents/Subfolder/file.txt does not exist

Extend `ls` command to list the folder passed as argument

% acdcli ls /Documents/Subfolder
AnotherFolder/
example.jpg
sample1.txt
test.txt

It should:

  • list the content of folder Documents/Subfolder if it is indeed a folder
  • list the nodes using the same order rules as in issue #2
  • list the file if the deepest node is a file
  • handle prefix / as optional in the command argument
  • print an error in case a suffix / is present and the deepest node is not a directory
  • print an error in case the node does not exist

List names of nodes in the root folder

Add a command ls to list the names of nodes in the root folder:

% acdcli ls
AAA/
Something/
abc/
zzz/
Afile.txt
Bfile.txt
anotherfile.txt
zfile.txt

The output should:

  • append / to folder names
  • list folders first
  • be sorted by name (uppercase before lowercase)
  • list all nodes, not just the first paginated output

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.