mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-01 17:14:19 +01:00
fix(version-up): code updated to v0.1.6, latest CLI
* also includes publishing tag files
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
[package]
|
||||
|
||||
name = "google-taskqueue1_beta2-cli"
|
||||
version = "0.0.1+20141111"
|
||||
version = "0.1.0+20141111"
|
||||
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
|
||||
description = "A complete library to interact with taskqueue (protocol v1beta2)"
|
||||
repository = "https://github.com/Byron/google-apis-rs/tree/master/gen/taskqueue1_beta2-cli"
|
||||
|
||||
@@ -1,4 +1,109 @@
|
||||
# HELLO TASKQUEUE:V1BETA2
|
||||
<!---
|
||||
DO NOT EDIT !
|
||||
This file was generated automatically from 'src/mako/cli/README.md.mako'
|
||||
DO NOT EDIT !
|
||||
-->
|
||||
The `taskqueue1-beta2` command-line interface *(CLI)* allows to use most features of the *Google taskqueue* service from the comfort of your terminal.
|
||||
|
||||
By default all output is printed to standard out, but flags can be set to direct it into a file independent of your shell's
|
||||
capabilities. Errors will be printed to standard error, and cause the program's exit code to be non-zero.
|
||||
|
||||
If data-structures are requested, these will be returned as pretty-printed JSON, to be useful as input to other tools.
|
||||
|
||||
# Usage
|
||||
|
||||
This documentation was generated from the *taskqueue* API at revision *20141111*. The CLI is at version *0.1.0*.
|
||||
|
||||
```bash
|
||||
taskqueue1-beta2 [options] taskqueues get <project> <taskqueue> [-p <v>...] [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks delete <project> <taskqueue> <task> [-p <v>...]
|
||||
taskqueue1-beta2 [options] tasks get <project> <taskqueue> <task> [-p <v>...] [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks insert <project> <taskqueue> -r <kv>... [-p <v>...] [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks lease <project> <taskqueue> <num-tasks> <lease-secs> [-p <v>...] [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks list <project> <taskqueue> [-p <v>...] [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks patch <project> <taskqueue> <task> <new-lease-seconds> -r <kv>... [-p <v>...] [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks update <project> <taskqueue> <task> <new-lease-seconds> -r <kv>... [-p <v>...] [-o <out>]
|
||||
taskqueue1-beta2 --help
|
||||
|
||||
All documentation details can be found at
|
||||
http://byron.github.io/google-apis-rs/google_taskqueue1_beta2_cli/index.html
|
||||
|
||||
Configuration:
|
||||
--scope <url>
|
||||
Specify the authentication a method should be executed in. Each scope
|
||||
requires the user to grant this application permission to use it.
|
||||
If unset, it defaults to the shortest scope url for a particular method.
|
||||
--config-dir <folder>
|
||||
A directory into which we will store our persistent data. Defaults to
|
||||
a user-writable directory that we will create during the first invocation.
|
||||
[default: ~/.google-service-cli]
|
||||
--debug
|
||||
Output all server communication to standard error. `tx` and `rx` are placed
|
||||
into the same stream.
|
||||
--debug-auth
|
||||
Output all communication related to authentication to standard error. `tx`
|
||||
and `rx` are placed into the same stream.
|
||||
|
||||
```
|
||||
|
||||
# Configuration
|
||||
|
||||
The program will store all persistent data in the `~/.google-service-cli` directory in *JSON* files prefixed with `taskqueue1-beta2-`. You can change the directory used to store configuration with the `--config-dir` flag on a per-invocation basis.
|
||||
|
||||
More information about the various kinds of persistent data are given in the following paragraphs.
|
||||
|
||||
# Authentication
|
||||
|
||||
Most APIs require a user to authenticate any request. If this is the case, the [scope][scopes] determines the
|
||||
set of permissions granted. The granularity of these is usually no more than *read-only* or *full-access*.
|
||||
|
||||
If not set, the system will automatically select the smallest feasible scope, e.g. when invoking a
|
||||
method that is read-only, it will ask only for a read-only scope.
|
||||
You may use the `--scope` flag to specify a scope directly.
|
||||
All applicable scopes are documented in the respective method's CLI documentation.
|
||||
|
||||
The first time a scope is used, the user is asked for permission. Follow the instructions given
|
||||
by the CLI to grant permissions, or to decline.
|
||||
|
||||
If a scope was authenticated by the user, the respective information will be stored as *JSON* in the configuration
|
||||
directory, e.g. `~/.google-service-cli/taskqueue1-beta2-token-<scope-hash>.json`. No manual management of these tokens
|
||||
is necessary.
|
||||
|
||||
To revoke granted authentication, please refer to the [official documentation][revoke-access].
|
||||
|
||||
# Application Secrets
|
||||
|
||||
In order to allow any application to use Google services, it will need to be registered using the
|
||||
[Google Developer Console][google-dev-console]. APIs the application may use are then enabled for it
|
||||
one by one. Most APIs can be used for free and have a daily quota.
|
||||
|
||||
To allow more comfortable usage of the CLI without forcing anyone to register an own application, the CLI
|
||||
comes with a default application secret that is configured accordingly. This also means that heavy usage
|
||||
all around the world may deplete the daily quota.
|
||||
|
||||
You can workaround this limitation by putting your own secrets file at this location:
|
||||
`~/.google-service-cli/taskqueue1-beta2-secret.json`, assuming that the required *taskqueue* API
|
||||
was enabled for it. Such a secret file can be downloaded in the *Google Developer Console* at
|
||||
*APIs & auth -> Credentials -> Download JSON* and used as is.
|
||||
|
||||
Learn more about how to setup Google projects and enable APIs using the [official documentation][google-project-new].
|
||||
|
||||
|
||||
Include information about application secret files, and how we automatically write a default one.
|
||||
# Debugging
|
||||
|
||||
Even though the CLI does its best to provide usable error messages, sometimes it might be desirable to know
|
||||
what exactly led to a particular issue. This is done by allowing all client-server communication to be
|
||||
output to standard error *as-is*.
|
||||
|
||||
The `--debug` flag will print all client-server communication to standard error, whereas the `--debug-auth` flag
|
||||
will cause all communication related to authentication to standard error.
|
||||
If the `--debug` flag is set, error-results will be debug-printed, possibly yielding more information about the
|
||||
issue at hand.
|
||||
|
||||
You may consider redirecting standard error into a file for ease of use, e.g. `taskqueue1-beta2 --debug <resource> <method> [options] 2>debug.txt`.
|
||||
|
||||
|
||||
[scopes]: https://developers.google.com/+/api/oauth#scopes
|
||||
[revoke-access]: http://webapps.stackexchange.com/a/30849
|
||||
[google-dev-console]: https://console.developers.google.com/
|
||||
[google-project-new]: https://developers.google.com/console/help/new/
|
||||
@@ -1,4 +1,4 @@
|
||||
site_name: taskqueue v0.0.1+20141111
|
||||
site_name: taskqueue v0.1.0+20141111
|
||||
site_url: http://byron.github.io/google-apis-rs/google-taskqueue1_beta2-cli
|
||||
site_description: Write integrating applications with bcore
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ pub fn parse_kv_arg<'a>(kv: &'a str, err: &mut InvalidOptionsError, for_hashmap:
|
||||
let key = &kv[..pos];
|
||||
if kv.len() <= pos + 1 {
|
||||
add_err();
|
||||
return (key, None)
|
||||
return (key, Some(""))
|
||||
}
|
||||
(key, Some(&kv[pos+1..]))
|
||||
}
|
||||
|
||||
@@ -19,33 +19,34 @@ use std::io::{self, Write};
|
||||
|
||||
docopt!(Options derive Debug, "
|
||||
Usage:
|
||||
taskqueue1-beta2 [options] taskqueues get <project> <taskqueue> [-p <v>]... [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks delete <project> <taskqueue> <task> [-p <v>]...
|
||||
taskqueue1-beta2 [options] tasks get <project> <taskqueue> <task> [-p <v>]... [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks insert <project> <taskqueue> -r <kv>... [-p <v>]... [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks lease <project> <taskqueue> <num-tasks> <lease-secs> [-p <v>]... [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks list <project> <taskqueue> [-p <v>]... [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks patch <project> <taskqueue> <task> <new-lease-seconds> -r <kv>... [-p <v>]... [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks update <project> <taskqueue> <task> <new-lease-seconds> -r <kv>... [-p <v>]... [-o <out>]
|
||||
taskqueue1-beta2 [options] taskqueues get <project> <taskqueue> [-p <v>...] [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks delete <project> <taskqueue> <task> [-p <v>...]
|
||||
taskqueue1-beta2 [options] tasks get <project> <taskqueue> <task> [-p <v>...] [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks insert <project> <taskqueue> -r <kv>... [-p <v>...] [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks lease <project> <taskqueue> <num-tasks> <lease-secs> [-p <v>...] [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks list <project> <taskqueue> [-p <v>...] [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks patch <project> <taskqueue> <task> <new-lease-seconds> -r <kv>... [-p <v>...] [-o <out>]
|
||||
taskqueue1-beta2 [options] tasks update <project> <taskqueue> <task> <new-lease-seconds> -r <kv>... [-p <v>...] [-o <out>]
|
||||
taskqueue1-beta2 --help
|
||||
|
||||
All documentation details can be found TODO: <URL to github.io docs here, see #51>
|
||||
All documentation details can be found at
|
||||
http://byron.github.io/google-apis-rs/google_taskqueue1_beta2_cli/index.html
|
||||
|
||||
Configuration:
|
||||
--scope <url>
|
||||
Specify the authentication a method should be executed in. Each scope requires
|
||||
the user to grant this application permission to use it.
|
||||
Specify the authentication a method should be executed in. Each scope
|
||||
requires the user to grant this application permission to use it.
|
||||
If unset, it defaults to the shortest scope url for a particular method.
|
||||
--config-dir <folder>
|
||||
A directory into which we will store our persistent data. Defaults to a user-writable
|
||||
directory that we will create during the first invocation.
|
||||
A directory into which we will store our persistent data. Defaults to
|
||||
a user-writable directory that we will create during the first invocation.
|
||||
[default: ~/.google-service-cli]
|
||||
--debug
|
||||
Output all server communication to standard error. `tx` and `rx` are placed into
|
||||
the same stream.
|
||||
Output all server communication to standard error. `tx` and `rx` are placed
|
||||
into the same stream.
|
||||
--debug-auth
|
||||
Output all communication related to authentication to standard error. `tx` and `rx` are placed into
|
||||
the same stream.
|
||||
Output all communication related to authentication to standard error. `tx`
|
||||
and `rx` are placed into the same stream.
|
||||
");
|
||||
|
||||
mod cmn;
|
||||
@@ -97,6 +98,9 @@ impl Engine {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out);
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
@@ -140,6 +144,9 @@ impl Engine {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
_ => unreachable!(),
|
||||
@@ -181,6 +188,9 @@ impl Engine {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out);
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
@@ -197,37 +207,24 @@ impl Engine {
|
||||
|
||||
fn _tasks_insert(&self, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Option<api::Error> {
|
||||
let mut request = api::Task::default();
|
||||
let mut call = self.hub.tasks().insert(&request, &self.opt.arg_project, &self.opt.arg_taskqueue);
|
||||
for parg in self.opt.arg_v.iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"alt"
|
||||
|"fields"
|
||||
|"key"
|
||||
|"oauth-token"
|
||||
|"pretty-print"
|
||||
|"quota-user"
|
||||
|"user-ip" => {
|
||||
let map = [
|
||||
("oauth-token", "oauth_token"),
|
||||
("pretty-print", "prettyPrint"),
|
||||
("quota-user", "quotaUser"),
|
||||
("user-ip", "userIp"),
|
||||
];
|
||||
call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"))
|
||||
},
|
||||
_ => err.issues.push(CLIError::UnknownParameter(key.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
let mut field_name = FieldCursor::default();
|
||||
let mut request = api::Task::default();
|
||||
let mut field_cursor = FieldCursor::default();
|
||||
for kvarg in self.opt.arg_kv.iter() {
|
||||
let last_errc = err.issues.len();
|
||||
let (key, value) = parse_kv_arg(&*kvarg, err, false);
|
||||
if let Err(field_err) = field_name.set(&*key) {
|
||||
let mut temp_cursor = field_cursor.clone();
|
||||
if let Err(field_err) = temp_cursor.set(&*key) {
|
||||
err.issues.push(field_err);
|
||||
}
|
||||
match &field_name.to_string()[..] {
|
||||
if value.is_none() {
|
||||
field_cursor = temp_cursor.clone();
|
||||
if err.issues.len() > last_errc {
|
||||
err.issues.remove(last_errc);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
match &temp_cursor.to_string()[..] {
|
||||
"kind" => {
|
||||
request.kind = Some(value.unwrap_or("").to_string());
|
||||
},
|
||||
@@ -253,15 +250,40 @@ impl Engine {
|
||||
request.enqueue_timestamp = Some(value.unwrap_or("").to_string());
|
||||
},
|
||||
_ => {
|
||||
err.issues.push(CLIError::Field(FieldError::Unknown(field_name.to_string())));
|
||||
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string())));
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut call = self.hub.tasks().insert(request, &self.opt.arg_project, &self.opt.arg_taskqueue);
|
||||
for parg in self.opt.arg_v.iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"alt"
|
||||
|"fields"
|
||||
|"key"
|
||||
|"oauth-token"
|
||||
|"pretty-print"
|
||||
|"quota-user"
|
||||
|"user-ip" => {
|
||||
let map = [
|
||||
("oauth-token", "oauth_token"),
|
||||
("pretty-print", "prettyPrint"),
|
||||
("quota-user", "quotaUser"),
|
||||
("user-ip", "userIp"),
|
||||
];
|
||||
call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"))
|
||||
},
|
||||
_ => err.issues.push(CLIError::UnknownParameter(key.to_string())),
|
||||
}
|
||||
}
|
||||
let protocol = "standard-request";
|
||||
if dry_run {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out);
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
@@ -313,6 +335,9 @@ impl Engine {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out);
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
@@ -356,6 +381,9 @@ impl Engine {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out);
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
@@ -372,38 +400,24 @@ impl Engine {
|
||||
|
||||
fn _tasks_patch(&self, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Option<api::Error> {
|
||||
let mut request = api::Task::default();
|
||||
let new_lease_seconds: i32 = arg_from_str(&self.opt.arg_new_lease_seconds, err, "<new-lease-seconds>", "integer");
|
||||
let mut call = self.hub.tasks().patch(&request, &self.opt.arg_project, &self.opt.arg_taskqueue, &self.opt.arg_task, new_lease_seconds);
|
||||
for parg in self.opt.arg_v.iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"alt"
|
||||
|"fields"
|
||||
|"key"
|
||||
|"oauth-token"
|
||||
|"pretty-print"
|
||||
|"quota-user"
|
||||
|"user-ip" => {
|
||||
let map = [
|
||||
("oauth-token", "oauth_token"),
|
||||
("pretty-print", "prettyPrint"),
|
||||
("quota-user", "quotaUser"),
|
||||
("user-ip", "userIp"),
|
||||
];
|
||||
call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"))
|
||||
},
|
||||
_ => err.issues.push(CLIError::UnknownParameter(key.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
let mut field_name = FieldCursor::default();
|
||||
let mut request = api::Task::default();
|
||||
let mut field_cursor = FieldCursor::default();
|
||||
for kvarg in self.opt.arg_kv.iter() {
|
||||
let last_errc = err.issues.len();
|
||||
let (key, value) = parse_kv_arg(&*kvarg, err, false);
|
||||
if let Err(field_err) = field_name.set(&*key) {
|
||||
let mut temp_cursor = field_cursor.clone();
|
||||
if let Err(field_err) = temp_cursor.set(&*key) {
|
||||
err.issues.push(field_err);
|
||||
}
|
||||
match &field_name.to_string()[..] {
|
||||
if value.is_none() {
|
||||
field_cursor = temp_cursor.clone();
|
||||
if err.issues.len() > last_errc {
|
||||
err.issues.remove(last_errc);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
match &temp_cursor.to_string()[..] {
|
||||
"kind" => {
|
||||
request.kind = Some(value.unwrap_or("").to_string());
|
||||
},
|
||||
@@ -429,15 +443,41 @@ impl Engine {
|
||||
request.enqueue_timestamp = Some(value.unwrap_or("").to_string());
|
||||
},
|
||||
_ => {
|
||||
err.issues.push(CLIError::Field(FieldError::Unknown(field_name.to_string())));
|
||||
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string())));
|
||||
}
|
||||
}
|
||||
}
|
||||
let new_lease_seconds: i32 = arg_from_str(&self.opt.arg_new_lease_seconds, err, "<new-lease-seconds>", "integer");
|
||||
let mut call = self.hub.tasks().patch(request, &self.opt.arg_project, &self.opt.arg_taskqueue, &self.opt.arg_task, new_lease_seconds);
|
||||
for parg in self.opt.arg_v.iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"alt"
|
||||
|"fields"
|
||||
|"key"
|
||||
|"oauth-token"
|
||||
|"pretty-print"
|
||||
|"quota-user"
|
||||
|"user-ip" => {
|
||||
let map = [
|
||||
("oauth-token", "oauth_token"),
|
||||
("pretty-print", "prettyPrint"),
|
||||
("quota-user", "quotaUser"),
|
||||
("user-ip", "userIp"),
|
||||
];
|
||||
call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"))
|
||||
},
|
||||
_ => err.issues.push(CLIError::UnknownParameter(key.to_string())),
|
||||
}
|
||||
}
|
||||
let protocol = "standard-request";
|
||||
if dry_run {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out);
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
@@ -454,38 +494,24 @@ impl Engine {
|
||||
|
||||
fn _tasks_update(&self, dry_run: bool, err: &mut InvalidOptionsError)
|
||||
-> Option<api::Error> {
|
||||
let mut request = api::Task::default();
|
||||
let new_lease_seconds: i32 = arg_from_str(&self.opt.arg_new_lease_seconds, err, "<new-lease-seconds>", "integer");
|
||||
let mut call = self.hub.tasks().update(&request, &self.opt.arg_project, &self.opt.arg_taskqueue, &self.opt.arg_task, new_lease_seconds);
|
||||
for parg in self.opt.arg_v.iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"alt"
|
||||
|"fields"
|
||||
|"key"
|
||||
|"oauth-token"
|
||||
|"pretty-print"
|
||||
|"quota-user"
|
||||
|"user-ip" => {
|
||||
let map = [
|
||||
("oauth-token", "oauth_token"),
|
||||
("pretty-print", "prettyPrint"),
|
||||
("quota-user", "quotaUser"),
|
||||
("user-ip", "userIp"),
|
||||
];
|
||||
call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"))
|
||||
},
|
||||
_ => err.issues.push(CLIError::UnknownParameter(key.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
let mut field_name = FieldCursor::default();
|
||||
let mut request = api::Task::default();
|
||||
let mut field_cursor = FieldCursor::default();
|
||||
for kvarg in self.opt.arg_kv.iter() {
|
||||
let last_errc = err.issues.len();
|
||||
let (key, value) = parse_kv_arg(&*kvarg, err, false);
|
||||
if let Err(field_err) = field_name.set(&*key) {
|
||||
let mut temp_cursor = field_cursor.clone();
|
||||
if let Err(field_err) = temp_cursor.set(&*key) {
|
||||
err.issues.push(field_err);
|
||||
}
|
||||
match &field_name.to_string()[..] {
|
||||
if value.is_none() {
|
||||
field_cursor = temp_cursor.clone();
|
||||
if err.issues.len() > last_errc {
|
||||
err.issues.remove(last_errc);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
match &temp_cursor.to_string()[..] {
|
||||
"kind" => {
|
||||
request.kind = Some(value.unwrap_or("").to_string());
|
||||
},
|
||||
@@ -511,15 +537,41 @@ impl Engine {
|
||||
request.enqueue_timestamp = Some(value.unwrap_or("").to_string());
|
||||
},
|
||||
_ => {
|
||||
err.issues.push(CLIError::Field(FieldError::Unknown(field_name.to_string())));
|
||||
err.issues.push(CLIError::Field(FieldError::Unknown(temp_cursor.to_string())));
|
||||
}
|
||||
}
|
||||
}
|
||||
let new_lease_seconds: i32 = arg_from_str(&self.opt.arg_new_lease_seconds, err, "<new-lease-seconds>", "integer");
|
||||
let mut call = self.hub.tasks().update(request, &self.opt.arg_project, &self.opt.arg_taskqueue, &self.opt.arg_task, new_lease_seconds);
|
||||
for parg in self.opt.arg_v.iter() {
|
||||
let (key, value) = parse_kv_arg(&*parg, err, false);
|
||||
match key {
|
||||
"alt"
|
||||
|"fields"
|
||||
|"key"
|
||||
|"oauth-token"
|
||||
|"pretty-print"
|
||||
|"quota-user"
|
||||
|"user-ip" => {
|
||||
let map = [
|
||||
("oauth-token", "oauth_token"),
|
||||
("pretty-print", "prettyPrint"),
|
||||
("quota-user", "quotaUser"),
|
||||
("user-ip", "userIp"),
|
||||
];
|
||||
call = call.param(map.iter().find(|t| t.0 == key).unwrap_or(&("", key)).1, value.unwrap_or("unset"))
|
||||
},
|
||||
_ => err.issues.push(CLIError::UnknownParameter(key.to_string())),
|
||||
}
|
||||
}
|
||||
let protocol = "standard-request";
|
||||
if dry_run {
|
||||
None
|
||||
} else {
|
||||
assert!(err.issues.len() == 0);
|
||||
if self.opt.flag_scope.len() > 0 {
|
||||
call = call.add_scope(&self.opt.flag_scope);
|
||||
}
|
||||
let mut ostream = writer_from_opts(self.opt.flag_o, &self.opt.arg_out);
|
||||
match match protocol {
|
||||
"standard-request" => call.doit(),
|
||||
@@ -632,6 +684,7 @@ impl Engine {
|
||||
|
||||
fn main() {
|
||||
let opts: Options = Options::docopt().decode().unwrap_or_else(|e| e.exit());
|
||||
let debug = opts.flag_debug;
|
||||
match Engine::new(opts) {
|
||||
Err(err) => {
|
||||
writeln!(io::stderr(), "{}", err).ok();
|
||||
@@ -639,8 +692,11 @@ fn main() {
|
||||
},
|
||||
Ok(engine) => {
|
||||
if let Some(err) = engine.doit() {
|
||||
writeln!(io::stderr(), "{:?}", err).ok();
|
||||
writeln!(io::stderr(), "{}", err).ok();
|
||||
if debug {
|
||||
writeln!(io::stderr(), "{:?}", err).ok();
|
||||
} else {
|
||||
writeln!(io::stderr(), "{}", err).ok();
|
||||
}
|
||||
env::set_exit_status(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user