Skip to content

Commit 863457d

Browse files
authored
Merge pull request containerd#3383 from apostasie/refactor-cmd-2
Refactor cmd/nerdctl, part 2
2 parents f2bfc60 + 4e89ddf commit 863457d

File tree

145 files changed

+661
-532
lines changed

Some content is hidden

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

145 files changed

+661
-532
lines changed

cmd/nerdctl/compose.go renamed to cmd/nerdctl/compose/compose.go

Lines changed: 4 additions & 4 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 compose
1818

1919
import (
2020
"github.com/spf13/cobra"
@@ -23,7 +23,7 @@ import (
2323
"github.com/containerd/nerdctl/v2/pkg/composer"
2424
)
2525

26-
func newComposeCommand() *cobra.Command {
26+
func NewComposeCommand() *cobra.Command {
2727
var composeCommand = &cobra.Command{
2828
Use: "compose [flags] COMMAND",
2929
Short: "Compose",
@@ -33,7 +33,7 @@ func newComposeCommand() *cobra.Command {
3333
TraverseChildren: true, // required for global short hands like -f
3434
}
3535
// `-f` is a nonPersistentAlias, as it conflicts with `nerdctl compose logs --follow`
36-
AddPersistentStringArrayFlag(composeCommand, "file", nil, []string{"f"}, nil, "", "Specify an alternate compose file")
36+
helpers.AddPersistentStringArrayFlag(composeCommand, "file", nil, []string{"f"}, nil, "", "Specify an alternate compose file")
3737
composeCommand.PersistentFlags().String("project-directory", "", "Specify an alternate working directory")
3838
composeCommand.PersistentFlags().StringP("project-name", "p", "", "Specify an alternate project name")
3939
composeCommand.PersistentFlags().String("env-file", "", "Specify an alternate environment file")
@@ -70,7 +70,7 @@ func newComposeCommand() *cobra.Command {
7070
}
7171

7272
func getComposeOptions(cmd *cobra.Command, debugFull, experimental bool) (composer.Options, error) {
73-
nerdctlCmd, nerdctlArgs := globalFlags(cmd)
73+
nerdctlCmd, nerdctlArgs := helpers.GlobalFlags(cmd)
7474
projectDirectory, err := cmd.Flags().GetString("project-directory")
7575
if err != nil {
7676
return composer.Options{}, err

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

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

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

1919
import (
2020
"fmt"

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

1919
import (
2020
"fmt"

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

1919
import (
2020
"fmt"

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

1919
import (
2020
"errors"

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

1919
import (
2020
"fmt"

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

1919
import (
2020
"errors"

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

1919
import (
2020
"fmt"

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

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

0 commit comments

Comments
 (0)