fix(version-up): code updated to v0.1.6, latest CLI

* also includes publishing tag files
This commit is contained in:
Sebastian Thiel
2015-04-26 13:42:31 +02:00
parent 4e275eaadd
commit c2dd9c7a02
770 changed files with 63340 additions and 31427 deletions

View File

@@ -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..]))
}

View File

@@ -19,37 +19,38 @@ use std::io::{self, Write};
docopt!(Options derive Debug, "
Usage:
plus1 [options] activities get <activity-id> [-p <v>]... [-o <out>]
plus1 [options] activities list <user-id> <collection> [-p <v>]... [-o <out>]
plus1 [options] activities search <query> [-p <v>]... [-o <out>]
plus1 [options] comments get <comment-id> [-p <v>]... [-o <out>]
plus1 [options] comments list <activity-id> [-p <v>]... [-o <out>]
plus1 [options] moments insert <user-id> <collection> -r <kv>... [-p <v>]... [-o <out>]
plus1 [options] moments list <user-id> <collection> [-p <v>]... [-o <out>]
plus1 [options] moments remove <id> [-p <v>]...
plus1 [options] people get <user-id> [-p <v>]... [-o <out>]
plus1 [options] people list <user-id> <collection> [-p <v>]... [-o <out>]
plus1 [options] people list-by-activity <activity-id> <collection> [-p <v>]... [-o <out>]
plus1 [options] people search <query> [-p <v>]... [-o <out>]
plus1 [options] activities get <activity-id> [-p <v>...] [-o <out>]
plus1 [options] activities list <user-id> <collection> [-p <v>...] [-o <out>]
plus1 [options] activities search <query> [-p <v>...] [-o <out>]
plus1 [options] comments get <comment-id> [-p <v>...] [-o <out>]
plus1 [options] comments list <activity-id> [-p <v>...] [-o <out>]
plus1 [options] moments insert <user-id> <collection> -r <kv>... [-p <v>...] [-o <out>]
plus1 [options] moments list <user-id> <collection> [-p <v>...] [-o <out>]
plus1 [options] moments remove <id> [-p <v>...]
plus1 [options] people get <user-id> [-p <v>...] [-o <out>]
plus1 [options] people list <user-id> <collection> [-p <v>...] [-o <out>]
plus1 [options] people list-by-activity <activity-id> <collection> [-p <v>...] [-o <out>]
plus1 [options] people search <query> [-p <v>...] [-o <out>]
plus1 --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_plus1_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;
@@ -98,6 +99,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(),
@@ -147,6 +151,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(),
@@ -202,6 +209,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(),
@@ -245,6 +255,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(),
@@ -297,6 +310,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(),
@@ -313,39 +329,23 @@ impl Engine {
fn _moments_insert(&self, dry_run: bool, err: &mut InvalidOptionsError)
-> Option<api::Error> {
let mut request = api::Moment::default();
let mut call = self.hub.moments().insert(&request, &self.opt.arg_user_id, &self.opt.arg_collection);
for parg in self.opt.arg_v.iter() {
let (key, value) = parse_kv_arg(&*parg, err, false);
match key {
"debug" => {
call = call.debug(arg_from_str(value.unwrap_or("false"), err, "debug", "boolean"));
},
"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::Moment::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);
}
if value.is_none() {
field_cursor = temp_cursor.clone();
if err.issues.len() > last_errc {
err.issues.remove(last_errc);
}
continue;
}
fn request_object_init(request: &mut api::Moment) {
if request.object.is_none() {
request.object = Some(Default::default());
@@ -364,7 +364,7 @@ impl Engine {
}
}
match &field_name.to_string()[..] {
match &temp_cursor.to_string()[..] {
"start-date" => {
request.start_date = Some(value.unwrap_or("").to_string());
},
@@ -869,15 +869,43 @@ impl Engine {
request.id = 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.moments().insert(request, &self.opt.arg_user_id, &self.opt.arg_collection);
for parg in self.opt.arg_v.iter() {
let (key, value) = parse_kv_arg(&*parg, err, false);
match key {
"debug" => {
call = call.debug(arg_from_str(value.unwrap_or("false"), err, "debug", "boolean"));
},
"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(),
@@ -933,6 +961,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(),
@@ -976,6 +1007,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!(),
@@ -1017,6 +1051,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(),
@@ -1069,6 +1106,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(),
@@ -1118,6 +1158,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(),
@@ -1170,6 +1213,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(),
@@ -1300,6 +1346,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();
@@ -1307,8 +1354,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);
}
}