Skip to content

Deprecation of arguments and sub-commands #571

@dlinn89

Description

@dlinn89

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:

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions