diff options
| author | Petter Rasmussen | 2016-01-23 22:08:01 +0100 |
|---|---|---|
| committer | Petter Rasmussen | 2016-01-23 22:08:01 +0100 |
| commit | 01ef731036bfff516ee26baa8e3c1ec25c60ecbb (patch) | |
| tree | 0a3a180057e6d7ee1a206a0f85e2cef651978286 /gdrive.go | |
| parent | 5386c4913a6b069f187da24615f545e2838265d6 (diff) | |
| download | gdrive-01ef731036bfff516ee26baa8e3c1ec25c60ecbb.tar.bz2 | |
Implement upload via stdin
Diffstat (limited to 'gdrive.go')
| -rw-r--r-- | gdrive.go | 33 |
1 files changed, 30 insertions, 3 deletions
@@ -11,6 +11,7 @@ const Version = "2.0.0" const DefaultMaxFiles = 30 const DefaultNameWidth = 40 +const DefaultUploadChunkSize = 8 * 1024 * 1024 const DefaultQuery = "trashed = false and 'me' in owners" const DefaultShareRole = "reader" const DefaultShareType = "anyone" @@ -181,12 +182,38 @@ func main() { Description: "Hide progress", OmitValue: true, }, + cli.StringFlag{ + Name: "mime", + Patterns: []string{"--mime"}, + Description: "Force mime type", + }, cli.BoolFlag{ - Name: "stdin", - Patterns: []string{"--stdin"}, - Description: "Use stdin as file content", + Name: "share", + Patterns: []string{"--share"}, + Description: "Share file", OmitValue: true, }, + }, + }, + }, + &cli.Handler{ + Pattern: "[global options] upload stdin [options] <name>", + Description: "Upload file from stdin", + Callback: uploadStdinHandler, + Flags: cli.Flags{ + "global options": globalFlags, + "options": []cli.Flag{ + cli.StringSliceFlag{ + Name: "parent", + Patterns: []string{"-p", "--parent"}, + Description: "Parent id, used to upload file to a specific directory, can be specified multiple times to give many parents", + }, + cli.IntFlag{ + Name: "chunksize", + Patterns: []string{"--chunksize"}, + Description: fmt.Sprintf("Set chunk size in bytes, default: %d", DefaultUploadChunkSize), + DefaultValue: DefaultUploadChunkSize, + }, cli.StringFlag{ Name: "mime", Patterns: []string{"--mime"}, |
