Skip to content

Commit

Permalink
Remove config show in favor of parent command
Browse files Browse the repository at this point in the history
Signed-off-by: Mauro Morales <[email protected]>
  • Loading branch information
mauromorales committed Apr 8, 2024
1 parent 17fdb7d commit a5d17fb
Showing 1 changed file with 14 additions and 28 deletions.
42 changes: 14 additions & 28 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/kairos-io/kairos-agent/v2/pkg/action"
"github.com/kairos-io/kairos-agent/v2/pkg/constants"
"github.com/kairos-io/kairos-agent/v2/pkg/utils"
"github.com/mudler/go-pluggable"
"os"
"path/filepath"
"regexp"
"runtime"
"strings"

"github.com/kairos-io/kairos-agent/v2/pkg/action"
"github.com/kairos-io/kairos-agent/v2/pkg/constants"
"github.com/kairos-io/kairos-agent/v2/pkg/utils"
"github.com/mudler/go-pluggable"

"github.com/kairos-io/kairos-agent/v2/internal/agent"
"github.com/kairos-io/kairos-agent/v2/internal/bus"
"github.com/kairos-io/kairos-agent/v2/internal/common"
Expand Down Expand Up @@ -303,38 +304,23 @@ E.g. kairos-agent install-bundle container:quay.io/kairos/kairos...
},
{
Name: "config",
Usage: "get machine configuration",
Description: "Print machine state information, e.g. `state get uuid` returns the machine uuid",
Usage: "Shows the machine configuration",
Description: "Show the runtime configuration of the machine. It will scan the machine for all the configuration and will return the config file processed and found.",
Aliases: []string{"c"},
Action: func(c *cli.Context) error {
runtime, err := state.NewRuntime()
config, err := agentConfig.Scan(collector.Directories(constants.GetConfigScanDirs()...), collector.NoLogs)
if err != nil {
return err
}

fmt.Print(runtime)
return err
configStr, err := config.String()
if err != nil {
return err
}
fmt.Printf("%s", configStr)
return nil
},
Subcommands: []*cli.Command{
{
Name: "show",
Usage: "Shows the machine configuration",
Description: "Show the runtime configuration of the machine. It will scan the machine for all the configuration and will return the config file processed and found.",
Aliases: []string{},
Action: func(c *cli.Context) error {
config, err := agentConfig.Scan(collector.Directories(constants.GetConfigScanDirs()...), collector.NoLogs)
if err != nil {
return err
}

configStr, err := config.String()
if err != nil {
return err
}
fmt.Printf("%s", configStr)
return nil
},
},
{
Name: "get",
Usage: "Get specific data from the configuration",
Expand Down

0 comments on commit a5d17fb

Please sign in to comment.