Commit Graph

121 Commits

Author SHA1 Message Date
Sebastian Thiel
99e97ceece Assure API descriptions can contain '"' characters 2019-07-05 11:16:57 +08:00
Guy Taylor
57a7ee37e5 Always run Python in the Venv context 2018-12-21 13:05:40 +01:00
gheoan
43b953445e docs(mako): fix typo 2018-12-21 13:00:04 +01:00
Sebastian Thiel
0337435cd4 imp(serde): upgrade to v0.9
This provides proc macros, greatly simplifying the build
projects.
2017-02-03 08:23:00 +01:00
Sebastian Thiel
d1ebc0ff0b imp(cli): use hyper-rustls instead of openssl
The only openssl dependency left would be coming from yup-oauth2!
2017-02-01 07:07:05 +01:00
Sebastian Thiel
fad9d3b0ca doc(index): link to doc.rs for APIs
We also link more specifically to crates.io.

Some debt was taken on as the build_version is special and
duplicated right now.
2016-12-24 13:44:06 +01:00
Sebastian Thiel
d6accb8f61 doc(index): remove all download links
Instead refer to cargo install for installation.

[skip ci]
2016-12-24 10:49:37 +01:00
Sebastian Thiel
e646898137 feat(binaries): remove download information 2016-12-24 10:40:50 +01:00
Sebastian Thiel
fc34337ee4 doc(lib): use docs.rs for library documentation
We will still need to host the CLI docs though.
2016-12-24 10:35:48 +01:00
Sebastian Thiel
b6f5fc6eb3 fix(auth): use redirect flow
The interactive flow requires to paste a code back into the
command-line, which does only work when it's cat'ed, but not
if it is pasted.

This should let it handle everything internally, which is
way more user-friendly.
2016-07-17 19:31:13 +02:00
Sebastian Thiel
d37bb19df2 feat(authentication): Use flow for installed apps
That way, more complex APIs like drive and calendars
will work without any (sometimes non-existing) workarounds.
2016-05-20 18:26:48 +02:00
Sebastian Thiel
ab1aa55d39 feat(version-up): clap-rs v1.5 -> 2.0 2016-01-30 12:53:02 +01:00
Sebastian Thiel
8ab4fd0bd4 fix(serde-up): update to serde 0.5.0
Serde move all json code into a separate crate that we are now using
as well.
2015-08-08 10:55:21 +02:00
Sebastian Thiel
152cdd848a imp(cli): pretty-print errors in debug mode 2015-07-21 18:21:52 +02:00
Sebastian Thiel
be894becc3 fix(clap-up): use clap 1.0.3
* `SubCommand::new(...)` was renamed to `SubCommand::with_name(...)`
  which actually is now consistent with everything else
  (e.g. `Arg::with_name(...)`)
2015-07-15 09:51:01 +02:00
Sebastian Thiel
615ac64ec1 fix(cli): flush output stream on CLI output
For some reason, this is now a requirement - previously this didn't
seem to be necessary.

Don't know what changed there ... and it's odd it doesn't flush
when the process is going down or the handle is destroyed.
2015-06-26 16:00:12 +02:00
Sebastian Thiel
d0491a4950 fix(hyper-up): work with hyper v0.6.0
Currently the latter actually fails to link on OSX, and requires a local
override with [this fix](https://goo.gl/OTExmN).
2015-06-26 15:49:30 +02:00
Sebastian Thiel
27fdd8ee0c fix(rustup): type-inference fails on empty vec
Previously this wasn't the case, as the type could be inferred by the
type of the parent-vector to extend.

Apparently this feature was removed, probably for good reason.
2015-06-21 17:55:46 +02:00
Sebastian Thiel
62db3ae87c fix(cli): add type annotation
It seems to be required when building with an older rustc version.
This did work in nightly, and just seems to be some sort of limiation
in stable.
2015-06-19 18:03:55 +02:00
Sebastian Thiel
a9e0be6583 fix(cli): work on stable
CLI was slightly adjusted to not use unstable features.
Fortunately, there is no serde magic happening, which allows
us to keep it simple without using a build script.
2015-06-19 12:55:00 +02:00
Sebastian Thiel
b0a41c4e78 fix(api): first big step towards syntex
Even though there is a bug that caues {} to be used in stead of
(),
when exanding macros, which causes syntax errors that we have to
workaround, it's not a real issue.

What's happening additionally is missing hyper macros, which
now have to be expanded manually. Shouldn't be a problem,
pretty-printing when compiling is made for just that ;).

No, it's sad that `include!()` works so badly, it makes
using serde so difficult ... it's no fun i must say.

Just for stable ... I am not sure if it is worth it."
2015-06-18 22:51:17 +02:00
Sebastian Thiel
267868cea3 Merge branch 'master' into next 2015-05-18 10:49:24 +02:00
Sebastian Thiel
129fd38e00 imp(CLI): disallow empty values explicitly
[skip ci]
2015-05-18 10:19:38 +02:00
Sebastian Thiel
ca36dbc505 feat(config): improved structure setter code
We save about 30% of CLI code just because we offload the work of
settings structures into serde, building a generic `json::Value` to
contain all the data, and then let serde do the deserialization for us.

All we need for that is some information we let the generator provide
and translate it into the runtime.

Closes #111
2015-05-13 08:45:57 +02:00
Sebastian Thiel
464394af22 refactor(config): handle recursive mut json values
* recurively drill down a mutable, recursive enumeration, without borrow
  checker issues. The obvious solution doesn't work, but should.
  Stackoverflow ?
* infrastructure to set actual value, with support for ararys, pods and
  hashmaps
2015-05-12 19:48:37 +02:00
Sebastian Thiel
f83dff672b refactor(config): bring in all required field data
Previously we only knew the type as string, now we have enums and
additional type information, like whether or not it's a POD.

However, borrow-checker doesn't like the current code, will need more
work.
2015-05-12 12:17:36 +02:00
Sebastian Thiel
a2dd71451d feat(config): basis for simplified value setting
Previously we would set static structures manully, using complex cases
and utility functions. Now we setup the foundation to allow setting
a generic `json::value::Value` instead, which can later be deserialized
into the target structure.

Related to #111
2015-05-12 11:17:42 +02:00
Sebastian Thiel
2ca0529297 fix(rustup): dc630d01e 2015-05-09
* Vec::add was removed ... which forces me to write 4 lines instead of
  one very readable one :(.
  Not everything is to the better here, even though I can imagine they
  did it to prevent people from thinking this is a cheap operation.

[skip ci]
2015-05-11 10:58:00 +02:00
Sebastian Thiel
383595c44e docs(CLI): added Download information
That way, it's easy to obtain the respective precompiled binary, as
well as seeing the source-code.

Overall, it makes promoting the tools easier as the CLI docs can be
linked directly.

Closes #108
[skip ci]
2015-05-10 19:40:25 +02:00
Sebastian Thiel
fff466f6bc docs(CLI): after_help url for method scmds
That way, whenever the extended help of a method (e.g. apis get-rest)
is queried, you can easily jump to the online docs to get details about
required data-structures or parameters for instance.

[skip ci]
2015-05-09 14:36:40 +02:00
Sebastian Thiel
5894c8163a imp(CLI): remove null in pretty-printed json
Without all that clutter, it's so much more enjoyable to read the
output.

The implementation is based on a suggestion of @erickt, which is
converts into a json::Value (able to represent any json structure),
on which the filtering is applied.

If we should ever implement pretty-printing in json-tools, we might
still consider using these capabilities instead, as we would avoid
building potentially large datastructures, all we would need is
a sufficiently large destination buffer which is a single alloc and
a consecutive region in memory.

Closes #102
[skip ci]
2015-05-08 19:12:45 +02:00
Sebastian Thiel
2485343caa refactor(CLI): use arg_enum! clap-rs macro
That way, we get a better (case-insensitive) implementation of `FromStr`
which reduces the amount of code we have to maintain.

Closes #101
[skip ci]
2015-05-06 11:58:45 +02:00
Sebastian Thiel
ef63790422 refactor(CLI): better vector building
Instead of using multiple lines to add vectors up involving iterators,
I just add slices together. This should produce less, and possibly
faster machine code, with less ascii code.

Downloads tested with drive2, and are verified to be working !

Close #97
2015-05-06 11:04:19 +02:00
Sebastian Thiel
f1fe6bac01 refactor(CLI): move global params to runtime
Global params were repeated per method, even though they were global,
per API. Now they are kept in vectors and used at runtime, accordingly.
We save a little bit of code, have simple matches, and less repition.

It's unclear if this reduces the size of the binary though ... or the
compile times, as the extra loop is an extra loop after all ;).

Still need to test the download mode using drive1

Related to #97
[skip ci]
2015-05-05 21:44:27 +02:00
Sebastian Thiel
9274938f9f fix(CLI): completed list of parameter names
Previously the 'did-you-mean' functionality only knew the global
paramters, but not the method-local ones.
2015-05-05 20:46:45 +02:00
Sebastian Thiel
bbab1f2e38 refactor(CLI): use raw strings for argparser
That way, we should be save from contained '"' characters, and whatever
else.

Closes #100
2015-05-05 20:02:26 +02:00
Sebastian Thiel
96415d17ca feat(CLI): did you mean for struct values
* functionality is cursor-aware, and fixes the actual string the user
  passed in. That way, it is made very clear how the suggested value
  is to be used.
* it's a known weakness of the implementation that it operates on a
  flattened list of field names, and thus may make nonsensical
  suggestions.
* added punctuation to all errors

Fixes #67
[skip ci]
2015-05-02 14:07:28 +02:00
Sebastian Thiel
89432cc646 fix(CLI): gate usage of upload_media_params
Previously the local stack variable would be used even though it
wasn't initialized as there were no upload flags. Now this only
happens if there are media params.

[skip ci]
2015-05-02 09:57:08 +02:00
Sebastian Thiel
75b80de3c6 feat(CLI): -u <mode> <file> parsing
* As `possible_values()` applies to all arguments, we cannot use it
  anymore but have to check the UploadProtocol type ourselves.
  Besides that, switching to the latest `clap` simplified our lives
  a little.
* ajusted docs to not enforce using `-r` all the time

Fixes #92
[skip ci]
2015-05-01 20:00:25 +02:00
Sebastian Thiel
bf6a2ba60c fix(CLI): handle repeated required strings
In a single case we wouldn't properly pass on string arguments that
were repeated. Now we handle them with a nice one-liner.

Fixes #96

[skip ci]
2015-05-01 15:22:59 +02:00
Sebastian Thiel
153324ebcc fix(CLI): 'about()' text for main commands
It shows up in the help, and makes it easier to navigate the command
tree without bringing up the html documentation.

Fixes #95
[skip ci]
2015-04-30 17:30:45 +02:00
Sebastian Thiel
2f200217f9 fix(CLI): unified error handling
* Use `Result` everywhere, instead of Option or tuples
* Properly handle error occurring after the dry-run. We do it in an
  extensible way, in case we need to do more than handle invalid output
  files at some point. Output files that could not be opened will now
  result in a nice error message with all the information we have.

Fixes #66
2015-04-30 16:31:49 +02:00
Sebastian Thiel
894b5b5ec7 feat(CLI): adjust to serde usage in yup-oauth
* More detailed error type for JsonTokenStorage
* removed all traces of rustc_serialize
* use pretty-printers everywhere to allow writing human-readable json
  files for secretes and for tokens

Fixes #93
2015-04-30 15:20:56 +02:00
Sebastian Thiel
fac50418a7 fix(CLI): escape subcommand descriptions
Otherwise, we could have had invalid rust strings.

[skip ci]
2015-04-30 13:48:11 +02:00
Sebastian Thiel
bd27046cc8 docs(clap): update STRUCT_FLAG and UPLOAD flags
* adjust documentation to resemble actual upload flag semantics. It was
  still using the one previously used in docopt.
* Make -m <mime-type> optional, defaulting to 'application/octet-stream'

Should have been fixed alongside of #81
2015-04-30 13:40:48 +02:00
Sebastian Thiel
d0ce221ba3 fix(clap):re-introduce UploadProtocol,fix CallType
* CallType now represents either Upload or Standard calls, whereas
  the Upload variant is represented by the UploadProtocol enum.
  That way it's clear what happens, and we don't mix orthogonal concepts
  in one enumeration just for convenience.

All tested APIs seem to build, verified

* upload
* download
* request structures
* parameters
* scopes
* config-dir
* debug[-auth]

Fixes #81
2015-04-30 10:20:02 +02:00
Sebastian Thiel
b039b38244 fix(clap): update docs and fix calltype handling
* mkdoc docs grammar is now hierarchical, making the command structure
  more obvious and easier to understand. It's a nice addition to the
  auto-generated, hierachical usage of clap.
* UploadProtocol enum is now CallType, to ease handling the different
  ways the Call has to be executed. It looks quite clean, even though
  combining upload protocols and the calltype is a bit hacky.
2015-04-30 10:05:55 +02:00
Sebastian Thiel
7a38f7e4d5 fix(clap): various fixes and improvements
* `--version` now includes the API revision we embody
  (using crate_version())
* Allow multiple scopes to be specified, instead of just one. Previously
  this was problemantic due to argument parsing of docopt being greedy.
  However, this also means we have to specify the `-r` flag for each
  invocation. See https://github.com/kbknapp/clap-rs/issues/89 .
* Adapted to new signature of `Arg::possible_values()` and used the
  previously orphaned `UploadProtocol` enum.
* Deduplicated code a little by adding the new `opt_values()` generator
  function.

 Related to #81
2015-04-30 09:03:11 +02:00
Sebastian Thiel
63e23dd48f fix(clap): print usage if command is missing
Also, fixed config-dir substitution in flag's help message
2015-04-29 22:08:47 +02:00
Sebastian Thiel
5320a48e68 fix(clap): tweaks to make youtube3 work
Mainly minor cleanup, and handling of generator branches that
didn't show up in smaller APIs that were used during the first steps.

related to #81
2015-04-29 21:59:06 +02:00