Skip to content

Commit 3c8f51d

Browse files
committed
chore: move cli formatters and version modules to machinery
To be used in the `go-talos-support` module without importing the whole Talos repo. Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
1 parent 8152a6d commit 3c8f51d

File tree

43 files changed

+67
-58
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+67
-58
lines changed

cmd/installer/cmd/installer/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/siderolabs/talos/cmd/installer/pkg/install"
1616
"github.com/siderolabs/talos/internal/app/machined/pkg/runtime/v1alpha1/platform"
1717
"github.com/siderolabs/talos/pkg/machinery/config/configloader"
18-
"github.com/siderolabs/talos/pkg/version"
18+
"github.com/siderolabs/talos/pkg/machinery/version"
1919
)
2020

2121
// installCmd represents the installation command.

cmd/installer/pkg/install/install.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"github.com/siderolabs/talos/internal/pkg/mount"
2626
"github.com/siderolabs/talos/pkg/machinery/constants"
2727
"github.com/siderolabs/talos/pkg/machinery/kernel"
28-
"github.com/siderolabs/talos/pkg/version"
28+
"github.com/siderolabs/talos/pkg/machinery/version"
2929
)
3030

3131
// Options represents the set of options available for an install.

cmd/installer/pkg/install/preflight.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/siderolabs/talos/pkg/machinery/constants"
2323
"github.com/siderolabs/talos/pkg/machinery/resources/k8s"
2424
"github.com/siderolabs/talos/pkg/machinery/role"
25-
"github.com/siderolabs/talos/pkg/version"
25+
"github.com/siderolabs/talos/pkg/machinery/version"
2626
)
2727

2828
// PreflightChecks runs the preflight checks.

cmd/talosctl/cmd/mgmt/cluster/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ import (
4545
"github.com/siderolabs/talos/pkg/machinery/config/types/v1alpha1"
4646
"github.com/siderolabs/talos/pkg/machinery/constants"
4747
"github.com/siderolabs/talos/pkg/machinery/nethelpers"
48+
"github.com/siderolabs/talos/pkg/machinery/version"
4849
"github.com/siderolabs/talos/pkg/provision"
4950
"github.com/siderolabs/talos/pkg/provision/access"
5051
"github.com/siderolabs/talos/pkg/provision/providers"
51-
"github.com/siderolabs/talos/pkg/version"
5252
)
5353

5454
const (

cmd/talosctl/cmd/talos/inspect.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/siderolabs/talos/cmd/talosctl/pkg/talos/helpers"
1515
"github.com/siderolabs/talos/pkg/cli"
1616
"github.com/siderolabs/talos/pkg/machinery/client"
17+
"github.com/siderolabs/talos/pkg/machinery/formatters"
1718
)
1819

1920
// inspectCmd represents the inspect command.
@@ -54,7 +55,7 @@ to render the graph:
5455
cli.Warning("%s", err)
5556
}
5657

57-
return cli.RenderGraph(ctx, c, resp, os.Stdout, inspectDependenciesCmdFlags.withResources)
58+
return formatters.RenderGraph(ctx, c, resp, os.Stdout, inspectDependenciesCmdFlags.withResources)
5859
})
5960
},
6061
}

cmd/talosctl/cmd/talos/mounts.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515

1616
"github.com/siderolabs/talos/pkg/cli"
1717
"github.com/siderolabs/talos/pkg/machinery/client"
18+
"github.com/siderolabs/talos/pkg/machinery/formatters"
1819
)
1920

2021
// mountsCmd represents the mounts command.
@@ -37,7 +38,7 @@ var mountsCmd = &cobra.Command{
3738
cli.Warning("%s", err)
3839
}
3940

40-
return cli.RenderMounts(resp, os.Stdout, &remotePeer)
41+
return formatters.RenderMounts(resp, os.Stdout, &remotePeer)
4142
})
4243
},
4344
}

cmd/talosctl/cmd/talos/root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ import (
2020
"google.golang.org/grpc/peer"
2121

2222
"github.com/siderolabs/talos/cmd/talosctl/pkg/talos/global"
23-
"github.com/siderolabs/talos/pkg/cli"
2423
_ "github.com/siderolabs/talos/pkg/grpc/codec" // register codec
2524
"github.com/siderolabs/talos/pkg/machinery/api/common"
2625
machineapi "github.com/siderolabs/talos/pkg/machinery/api/machine"
2726
"github.com/siderolabs/talos/pkg/machinery/client"
2827
"github.com/siderolabs/talos/pkg/machinery/constants"
28+
"github.com/siderolabs/talos/pkg/machinery/formatters"
2929
)
3030

3131
var kubernetes bool
@@ -165,7 +165,7 @@ func getServiceFromNode() []string {
165165

166166
for _, msg := range resp.Messages {
167167
for _, s := range msg.Services {
168-
svc := cli.ServiceInfoWrapper{ServiceInfo: s}
168+
svc := formatters.ServiceInfoWrapper{ServiceInfo: s}
169169
svcIDs = append(svcIDs, svc.Id)
170170
}
171171
}

cmd/talosctl/cmd/talos/service.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616

1717
"github.com/siderolabs/talos/pkg/cli"
1818
"github.com/siderolabs/talos/pkg/machinery/client"
19+
"github.com/siderolabs/talos/pkg/machinery/formatters"
1920
)
2021

2122
// serviceCmd represents the service command.
@@ -89,7 +90,7 @@ func serviceList(ctx context.Context, c *client.Client) error {
8990

9091
for _, msg := range resp.Messages {
9192
for _, s := range msg.Services {
92-
svc := cli.ServiceInfoWrapper{ServiceInfo: s}
93+
svc := formatters.ServiceInfoWrapper{ServiceInfo: s}
9394

9495
node := defaultNode
9596

@@ -122,7 +123,7 @@ func serviceInfo(ctx context.Context, c *client.Client, id string) error {
122123
return fmt.Errorf("service %q is not registered on any nodes", id)
123124
}
124125

125-
return cli.RenderServicesInfo(services, os.Stdout, defaultNode, true)
126+
return formatters.RenderServicesInfo(services, os.Stdout, defaultNode, true)
126127
}
127128

128129
func serviceStart(ctx context.Context, c *client.Client, id string) error {

cmd/talosctl/cmd/talos/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"github.com/siderolabs/talos/pkg/images"
2727
"github.com/siderolabs/talos/pkg/machinery/api/machine"
2828
"github.com/siderolabs/talos/pkg/machinery/client"
29-
"github.com/siderolabs/talos/pkg/version"
29+
"github.com/siderolabs/talos/pkg/machinery/version"
3030
)
3131

3232
var upgradeCmdFlags struct {

cmd/talosctl/cmd/talos/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
"github.com/siderolabs/talos/pkg/cli"
1818
"github.com/siderolabs/talos/pkg/machinery/client"
19-
"github.com/siderolabs/talos/pkg/version"
19+
"github.com/siderolabs/talos/pkg/machinery/version"
2020
)
2121

2222
// versionCmdFlags represents the `talosctl version` command's flags.

0 commit comments

Comments
 (0)