google-apis-rs / generator

A binding and CLI generator for all google APIs
Apache License 2.0
71 stars 14 forks source link

An MVP CLI for urlshortener V1 #10

Open Byron opened 4 years ago

Byron commented 4 years ago

This includes a handmade prototype with the following capabilities

For the prototype code generation

As a basic requirement: the CLI should be at least as powerful as the ones in OP, and on a similar level of quality.

This is the current epic, there will be many related tasks.

Unanswered questions

Byron commented 4 years ago

Quick POC to assert we can now construct the whole clap App on the heap right away, which allows to drop the ugly workaround previously employed:

//# default-boxed = "*"
use default_boxed::DefaultBoxed;
use clap;

// #[derive(DefaultBoxed)]
struct Foo<'a, 'b> {
    e: clap::App<'a, 'b>
}

impl<'a, 'b> Default for Foo<'a, 'b> {
    fn default() -> Foo<'a, 'b> {
        Foo {
            e: clap::App::new("foo"),
        }
    }
}

fn main() {
    // std::mem::drop(Foo::default());
    let foo = Foo::default_boxed();
    foo.e.get_matches();
}