alecthomas / alecthomas/kong

Deprecation of arguments and sub-commands

Abierto
#571 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Go
Estrellas
3.2k
Forks
188
Merge medio
1 d 1 h
PR fusionados (30 d)
2

Descripción

First of all: Kong is a really nice and easy to use tool, and appreciate the work put into it. A big shoutout to all maintainers and contributors ❤️

Now to my question:
As software services evolve, some arguments and/or subcommands may no longer be necessary or not even supported anymore.

Consider the following minimal example:

```go
package main

import (
"fmt"

"github.com/alecthomas/kong"
)

type Config struct {
Foo struct {
A int `name:"a" default:"1"`
_ int `name:"b" default:"1"`
} `embed:"" prefix:"foo."`
}

func main() {
config := new(Config)
_ = kong.Parse(
config,
kong.UsageOnError(),
)
fmt.Println(config)
}
```

In this example I no longer wish to support the `foo.b` option. Calling the application with `foo.b=1337` terminates the application, since the value has no well defined destination to go to.
I know that I could add an annotation `kong:"-"` or use the `IgnoreFields` option prevent this, but as I understand this is intended for non-CLI fields, whereas I wish to explicitly communicate that this previously valid option is no longer supported.
Is there any idiomatic way to express deprecation of formerly valid arguments with `kong` which I may have overlooked, or would this be a new feature?

Thank you already for looking into it!

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.