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))
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))
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)
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)
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)
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)
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を忘れずに
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())
def hello(*, name: str) -> None: """hello message""" from egoist.generators.clikit import runtime, clikit with runtime.generate(clikit): runtime.printf("hello %s\n", name)
def hello(*, name: str) -> None: """hello message""" with runtime.generate(clikit): runtime.printf("hello %s\n", name)
def byebye(*, name: str) -> None: """byebye message""" from egoist.generators.clikit import runtime, clikit with runtime.generate(clikit): runtime.printf("byebye %s\n", name)