Skip to content

Commit b02b8f2

Browse files
committed
Move cmd/system to subpackage
Signed-off-by: apostasie <[email protected]>
1 parent 05074f8 commit b02b8f2

File tree

10 files changed

+44
-16
lines changed

10 files changed

+44
-16
lines changed

cmd/nerdctl/multi_platform_linux_test.go renamed to cmd/nerdctl/container/multi_platform_linux_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17-
package main
17+
package container
1818

1919
import (
2020
"fmt"

cmd/nerdctl/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import (
4343
"github.com/containerd/nerdctl/v2/cmd/nerdctl/login"
4444
"github.com/containerd/nerdctl/v2/cmd/nerdctl/namespace"
4545
"github.com/containerd/nerdctl/v2/cmd/nerdctl/network"
46+
"github.com/containerd/nerdctl/v2/cmd/nerdctl/system"
4647
"github.com/containerd/nerdctl/v2/cmd/nerdctl/volume"
4748
"github.com/containerd/nerdctl/v2/pkg/config"
4849
ncdefaults "github.com/containerd/nerdctl/v2/pkg/defaults"
@@ -286,8 +287,8 @@ Config file ($NERDCTL_TOML): %s
286287
// #endregion
287288

288289
// #region System
289-
newEventsCommand(),
290-
newInfoCommand(),
290+
system.NewEventsCommand(),
291+
system.NewInfoCommand(),
291292
newVersionCommand(),
292293
// #endregion
293294

@@ -303,7 +304,7 @@ Config file ($NERDCTL_TOML): %s
303304
image.NewImageCommand(),
304305
network.NewNetworkCommand(),
305306
volume.NewVolumeCommand(),
306-
newSystemCommand(),
307+
system.NewSystemCommand(),
307308
namespace.NewNamespaceCommand(),
308309
builder.NewBuilderCommand(),
309310
// #endregion

cmd/nerdctl/system.go renamed to cmd/nerdctl/system/system.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
limitations under the License.
1515
*/
1616

17-
package main
17+
package system
1818

1919
import (
2020
"github.com/spf13/cobra"
2121

2222
"github.com/containerd/nerdctl/v2/cmd/nerdctl/helpers"
2323
)
2424

25-
func newSystemCommand() *cobra.Command {
25+
func NewSystemCommand() *cobra.Command {
2626
var systemCommand = &cobra.Command{
2727
Annotations: map[string]string{helpers.Category: helpers.Management},
2828
Use: "system",
@@ -33,8 +33,8 @@ func newSystemCommand() *cobra.Command {
3333
}
3434
// versionCommand is not here
3535
systemCommand.AddCommand(
36-
newEventsCommand(),
37-
newInfoCommand(),
36+
NewEventsCommand(),
37+
NewInfoCommand(),
3838
newSystemPruneCommand(),
3939
)
4040
return systemCommand

cmd/nerdctl/system_events.go renamed to cmd/nerdctl/system/system_events.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17-
package main
17+
package system
1818

1919
import (
2020
"github.com/spf13/cobra"
@@ -25,7 +25,7 @@ import (
2525
"github.com/containerd/nerdctl/v2/pkg/cmd/system"
2626
)
2727

28-
func newEventsCommand() *cobra.Command {
28+
func NewEventsCommand() *cobra.Command {
2929
shortHelp := `Get real time events from the server`
3030
longHelp := shortHelp + "\nNOTE: The output format is not compatible with Docker."
3131
var eventsCommand = &cobra.Command{

cmd/nerdctl/system_events_linux_test.go renamed to cmd/nerdctl/system/system_events_linux_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17-
package main
17+
package system
1818

1919
import (
2020
"fmt"

cmd/nerdctl/system_info.go renamed to cmd/nerdctl/system/system_info.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17-
package main
17+
package system
1818

1919
import (
2020
"github.com/spf13/cobra"
@@ -25,7 +25,7 @@ import (
2525
"github.com/containerd/nerdctl/v2/pkg/cmd/system"
2626
)
2727

28-
func newInfoCommand() *cobra.Command {
28+
func NewInfoCommand() *cobra.Command {
2929
var infoCommand = &cobra.Command{
3030
Use: "info",
3131
Args: cobra.NoArgs,

cmd/nerdctl/system_info_test.go renamed to cmd/nerdctl/system/system_info_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17-
package main
17+
package system
1818

1919
import (
2020
"encoding/json"

cmd/nerdctl/system_prune.go renamed to cmd/nerdctl/system/system_prune.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17-
package main
17+
package system
1818

1919
import (
2020
"fmt"

cmd/nerdctl/system_prune_linux_test.go renamed to cmd/nerdctl/system/system_prune_linux_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
limitations under the License.
1515
*/
1616

17-
package main
17+
package system
1818

1919
import (
2020
"bytes"

cmd/nerdctl/system/system_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
Copyright The containerd Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package system
18+
19+
import (
20+
"testing"
21+
22+
"github.com/containerd/nerdctl/v2/pkg/testutil"
23+
)
24+
25+
func TestMain(m *testing.M) {
26+
testutil.M(m)
27+
}

0 commit comments

Comments
 (0)