mirror of
https://github.com/kairos-io/provider-kairos.git
synced 2025-08-12 04:41:51 +00:00
This PR extracts the registration command into a `kairos-register` binary of its own. The old sub command is kept so users can see a deprecation notice and adapt for a future release when it's removed. The version number is shared between binaries. ⚠️ I'm not entirely sure about the gorelease, and would benefit from a couple of extra 👀 on this, thanks! relates to kairos-io/kairos#1211 --------- Signed-off-by: Mauro Morales <mauro.morales@spectrocloud.com> Signed-off-by: Mauro Morales <contact@mauromorales.com> Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com> Signed-off-by: GitHub <noreply@github.com> Co-authored-by: Dimitris Karakasilis <dimitris@karakasilis.me> Co-authored-by: Itxaka <itxaka.garcia@spectrocloud.com> Co-authored-by: ci-robbot [bot] <105103991+ci-robbot@users.noreply.github.com> Co-authored-by: mudler <mudler@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
51 lines
828 B
Go
51 lines
828 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/kairos-io/kairos-sdk/bus"
|
|
iCli "github.com/kairos-io/provider-kairos/internal/cli"
|
|
"github.com/kairos-io/provider-kairos/internal/provider"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
func checkErr(err error) {
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
os.Exit(0)
|
|
}
|
|
|
|
func main() {
|
|
if len(os.Args) >= 2 && bus.IsEventDefined(os.Args[1]) {
|
|
checkErr(provider.Start())
|
|
}
|
|
|
|
checkErr(Start())
|
|
}
|
|
|
|
func Start() error {
|
|
toolName := "kairosctl"
|
|
name := toolName
|
|
app := &cli.App{
|
|
Name: name,
|
|
Version: iCli.VERSION,
|
|
Authors: []*cli.Author{
|
|
{
|
|
Name: iCli.Author,
|
|
},
|
|
},
|
|
Copyright: iCli.Author,
|
|
Commands: []*cli.Command{
|
|
iCli.RegisterCMD(toolName),
|
|
iCli.BridgeCMD(toolName),
|
|
&iCli.GetKubeConfigCMD,
|
|
&iCli.RoleCMD,
|
|
},
|
|
}
|
|
|
|
return app.Run(os.Args)
|
|
}
|