TL;DR
Add a method to mark columns in tables as deprecated and show a warning if the column is used.
Expected behavior
It should be possible to mark a column as deprecated with a message containing details. Whenever the user selects to show that column they should see the deprecation message on stderr.
Code example to mark the column deprecated:
var ListCmd = &base.ListCmd[*hcloud.Server, schema.Server]{
OutputTable: func(t *output.Table[*hcloud.Server], client hcapi2.Client) {
t.
AddAllowedFields(&hcloud.Server{}).
AddFieldFn("datacenter", func(server *hcloud.Server) string {
if server.Datacenter != nil {
return server.Datacenter.Name
}
return "-"
}).
MarkFieldAsDeprecated("datacenter", "The datacenter column is deprecated. Use location column instead.")
}
}
And then the user sees the warning message when the use the column:
$ hcloud server list -o=columns=id,datacenter
Warning: The datacenter column is deprecated. Use location column instead. # stderr
ID DATACENTER
123 hel1-dc2
TL;DR
Add a method to mark columns in tables as deprecated and show a warning if the column is used.
Expected behavior
It should be possible to mark a column as deprecated with a message containing details. Whenever the user selects to show that column they should see the deprecation message on
stderr.Code example to mark the column deprecated:
And then the user sees the warning message when the use the column:
$ hcloud server list -o=columns=id,datacenter Warning: The datacenter column is deprecated. Use location column instead. # stderr ID DATACENTER 123 hel1-dc2