예제 #1
0
def cmd__hello(*, name: str = "World") -> None:
    """hello message"""
    from egoist.generators.clikit import runtime, clikit

    with runtime.generate(clikit) as m:
        hello = m.import_("m/hello")
        m.stmt(hello.Hello(name))
예제 #2
0
def gofmtrpc(*, addr: str = ":9999", sentinel: str = "") -> GoError:
    """gofmtrpc with JSONRPC"""
    from egoist.generators.clikit import runtime, clikit

    with runtime.generate(clikit) as m:
        gofmtrpc_pkg = m.import_("github.com/podhmo/egoist/gofmtrpc")
        m.return_(gofmtrpc_pkg.Run(addr, sentinel))
예제 #3
0
def hello(
        *, name: tx.Annotated[str,
                              Description("greeting target name")]) -> None:
    """hello message"""
    from egoist.generators.clikit import runtime, clikit

    with runtime.generate(clikit):
        runtime.printf("hello %s\n", name)
예제 #4
0
def hello(*, name: str = "foo") -> None:
    """hello message"""
    from egoist.generators.clikit import runtime, clikit

    options = runtime.get_cli_options()
    options.name.help = "name of person"

    with runtime.generate(clikit):
        runtime.printf("hello %s\n", name)
예제 #5
0
def hello(*, name: str) -> None:
    """hello message"""
    from egoist.generators.clikit import runtime, clikit

    with runtime.generate(clikit) as m:
        args = runtime.get_cli_rest_args()
        target = m.symbol("target")
        with m.for_(f"_, {target} := range {args}"):
            runtime.printf("%s: hello %s\n", name, target)
예제 #6
0
def hello(*,
          name: str = "world",
          age: types.uint,
          debug: types.bool,
          dur: types.duration) -> None:
    """hello message"""
    from egoist.generators.clikit import runtime, clikit

    with runtime.generate(clikit):
        runtime.printf("hello %s(%d)\n", name, age)
예제 #7
0
def hello(*, name: str, age: int = 20, who: str = "foo") -> None:
    """hello message"""
    from egoist.generators.clikit import runtime, clikit

    options = runtime.get_cli_options()
    options.name.help = "the name of target person"
    options.age.help = "age of subject"
    options.who.help = "name of subject"

    with runtime.generate(clikit) as m:
        hello_pkg = m.import_("m/internal/hello")
        m.stmt(hello_pkg.Hello(name, age, who))  # m.stmtを忘れずに
예제 #8
0
def wire_example(*, grumby: bool = False) -> None:
    """
    google/wire event examples
    """
    from egoist.generators.clikit import runtime, clikit
    from egoist.go import di

    internal = app.maybe_dotted("internal")  # ./internal.py

    with runtime.generate(clikit) as m:
        b = di.Builder()

        # Greeter depends on Message
        # and, Event depends on Greeter
        b.add_provider(internal.NewMessage)
        b.add_provider(internal.NewGreeter)
        b.add_provider(internal.NewEvent)

        injector = b.build(variables=locals())
        event = injector.inject(m)
        m.stmt(event.Start())
예제 #9
0
def hello(*, name: str) -> None:
    """hello message"""
    from egoist.generators.clikit import runtime, clikit

    with runtime.generate(clikit):
        runtime.printf("hello %s\n", name)
예제 #10
0
def hello(*, name: str) -> None:
    """hello message"""
    with runtime.generate(clikit):
        runtime.printf("hello %s\n", name)
예제 #11
0
def byebye(*, name: str) -> None:
    """byebye message"""
    from egoist.generators.clikit import runtime, clikit

    with runtime.generate(clikit):
        runtime.printf("byebye %s\n", name)