Skip to content

Commit 3b8a098

Browse files
committed
Move login/logout to subpackage
Signed-off-by: apostasie <[email protected]>
1 parent 9c75f29 commit 3b8a098

File tree

5 files changed

+35
-7
lines changed

5 files changed

+35
-7
lines changed

cmd/nerdctl/login.go renamed to cmd/nerdctl/login/login.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 login
1818

1919
import (
2020
"errors"
@@ -30,7 +30,7 @@ import (
3030
"github.com/containerd/nerdctl/v2/pkg/cmd/login"
3131
)
3232

33-
func newLoginCommand() *cobra.Command {
33+
func NewLoginCommand() *cobra.Command {
3434
var loginCommand = &cobra.Command{
3535
Use: "login [flags] [SERVER]",
3636
Args: cobra.MaximumNArgs(1),

cmd/nerdctl/login_linux_test.go renamed to cmd/nerdctl/login/login_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 login
1818

1919
import (
2020
"crypto/rand"

cmd/nerdctl/login/login_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 login
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+
}

cmd/nerdctl/logout.go renamed to cmd/nerdctl/login/logout.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 login
1818

1919
import (
2020
"fmt"
@@ -25,7 +25,7 @@ import (
2525
"github.com/containerd/nerdctl/v2/pkg/imgutil/dockerconfigresolver"
2626
)
2727

28-
func newLogoutCommand() *cobra.Command {
28+
func NewLogoutCommand() *cobra.Command {
2929
var logoutCommand = &cobra.Command{
3030
Use: "logout [flags] [SERVER]",
3131
Args: cobra.MaximumNArgs(1),

cmd/nerdctl/main.go

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

3535
"github.com/containerd/nerdctl/v2/cmd/nerdctl/completion"
3636
"github.com/containerd/nerdctl/v2/cmd/nerdctl/helpers"
37+
"github.com/containerd/nerdctl/v2/cmd/nerdctl/login"
3738
"github.com/containerd/nerdctl/v2/cmd/nerdctl/namespace"
3839
"github.com/containerd/nerdctl/v2/cmd/nerdctl/network"
3940
"github.com/containerd/nerdctl/v2/cmd/nerdctl/volume"
@@ -305,10 +306,10 @@ Config file ($NERDCTL_TOML): %s
305306
newInternalCommand(),
306307

307308
// login
308-
newLoginCommand(),
309+
login.NewLoginCommand(),
309310

310311
// Logout
311-
newLogoutCommand(),
312+
login.NewLogoutCommand(),
312313

313314
// Compose
314315
newComposeCommand(),

0 commit comments

Comments
 (0)