Add aliases to maintained examples

This commit is contained in:
2026-10-19 19:56:33 +00:00
parent c3bb3941d3
commit 666c006a89
8 changed files with 194 additions and 11 deletions

View File

@@ -37,14 +37,21 @@ func newApp() (*commandkit.App, error) {
if input.Tags.Set {
tags = fmt.Sprintf("explicit %v", input.Tags.Value)
}
if _, err := fmt.Fprintf(invocation.Streams.Out, "Hello; count=%s; tags=%s\n", count, tags); err != nil {
if _, err := fmt.Fprintf(invocation.Streams.Out, "Hello; count=%s; tags=%s; entered=%q; canonical=%q\n", count, tags, invocation.EnteredPath(), invocation.CanonicalPath()); err != nil {
return commandkit.Failure(err)
}
return commandkit.Success()
},
})
workspace := commandkit.Group("workspace", "Workspace commands.", greet)
return commandkit.New(commandkit.Identity{Name: "core-example", Version: "1.0"}, workspace)
declarations := []commandkit.Declaration{
workspace,
commandkit.Alias("hello", "workspace greet"),
commandkit.Alias("ws", "workspace"),
commandkit.FlagAliasFor("workspace greet", "--times", "--count"),
commandkit.FlagAlias("--hlep", "--help"),
}
return commandkit.New(commandkit.Identity{Name: "core-example", Version: "1.0"}, declarations...)
}
func main() {