-
Notifications
You must be signed in to change notification settings - Fork 772
Refactor the package structure in cmd/nerdctl #1639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5588f70
e9f1417
206e0c8
1116612
09cdb02
4e03e4a
c0566a4
478ad56
9bfbfa2
a1d9fa8
b00b5fe
3b81f31
4284097
3d2c7fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,3 +7,4 @@ build | |
|
|
||
| # vagrant | ||
| /.vagrant | ||
| !cmd/nerdctl/build | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this? is it because go recognize this as a build cache for |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ | |
| limitations under the License. | ||
| */ | ||
|
|
||
| package main | ||
| package apparmor | ||
|
|
||
| import ( | ||
| "fmt" | ||
|
|
@@ -29,14 +29,14 @@ func newApparmorInspectCommand() *cobra.Command { | |
| Use: "inspect", | ||
| Short: fmt.Sprintf("Display the default AppArmor profile %q. Other profiles cannot be displayed with this command.", defaults.AppArmorProfileName), | ||
| Args: cobra.NoArgs, | ||
| RunE: apparmorInspectAction, | ||
| RunE: InspectAction, | ||
| SilenceUsage: true, | ||
| SilenceErrors: true, | ||
| } | ||
| return cmd | ||
| } | ||
|
|
||
| func apparmorInspectAction(cmd *cobra.Command, args []string) error { | ||
| func InspectAction(cmd *cobra.Command, args []string) error { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why exported func ? |
||
| b, err := apparmor.DumpDefaultProfile(defaults.AppArmorProfileName) | ||
| if err != nil { | ||
| return err | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,18 +14,20 @@ | |
| limitations under the License. | ||
| */ | ||
|
|
||
| package main | ||
| package apparmor | ||
|
|
||
| import ( | ||
| "github.com/containerd/nerdctl/cmd/nerdctl/completion" | ||
| "github.com/containerd/nerdctl/cmd/nerdctl/utils/common" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| func newApparmorCommand() *cobra.Command { | ||
| func NewApparmorCommand() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Annotations: map[string]string{Category: Management}, | ||
| Annotations: map[string]string{common.Category: common.Management}, | ||
| Use: "apparmor", | ||
| Short: "Manage AppArmor profiles", | ||
| RunE: unknownSubcommandAction, | ||
| RunE: completion.UnknownSubcommandAction, | ||
| SilenceUsage: true, | ||
| SilenceErrors: true, | ||
| } | ||
|
|
@@ -37,3 +39,7 @@ func newApparmorCommand() *cobra.Command { | |
| ) | ||
| return cmd | ||
| } | ||
|
|
||
| func AddApparmorCommand(rootCmd *cobra.Command) { | ||
| rootCmd.AddCommand(NewApparmorCommand()) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that the logic of adding new Command(s) the |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /* | ||
| Copyright The containerd Authors. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| package apparmor | ||
|
|
||
| import "github.com/spf13/cobra" | ||
|
|
||
| func AddApparmorCommand(rootCmd *cobra.Command) { | ||
| // NOP | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "Test suite" section in
README.mdhas to be updated toohttps://github.com/containerd/nerdctl/tree/v1.1.0#test-suite