Skip to content

Commit

Permalink
feat: add "aqua policy set" command
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke committed Mar 26, 2023
1 parent 4f5f368 commit 5704075
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/cli/init_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ import (
func (runner *Runner) newInitPolicyCommand() *cli.Command {
return &cli.Command{
Name: "init-policy",
Usage: "Create a policy file if it doesn't exist",
Usage: "[Deprecated] Create a policy file if it doesn't exist",
ArgsUsage: `[<created file path. The default value is "aqua-policy.yaml">]`,
Description: `Create a policy file if it doesn't exist
Description: `[Deprecated] Create a policy file if it doesn't exist
Please use "aqua policy set" command instead.
e.g.
$ aqua init-policy # create "aqua-policy.yaml"
$ aqua init-policy foo.yaml # create foo.yaml`,
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ func (runner *Runner) newPolicyCommand() *cli.Command {
Subcommands: []*cli.Command{
runner.newAllowPolicyCommand(),
runner.newDenyPolicyCommand(),
runner.newSetPolicyCommand(),
},
}
}
18 changes: 18 additions & 0 deletions pkg/cli/set_policy.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cli

import (
"github.com/urfave/cli/v2"
)

func (runner *Runner) newSetPolicyCommand() *cli.Command {
return &cli.Command{
Name: "set",
Usage: "Create a policy file if it doesn't exist",
ArgsUsage: `[<created file path. The default value is "aqua-policy.yaml">]`,
Description: `Create a policy file if it doesn't exist
e.g.
$ aqua policy set # create "aqua-policy.yaml"
$ aqua policy set foo.yaml # create foo.yaml`,
Action: runner.initPolicyAction,
}
}

0 comments on commit 5704075

Please sign in to comment.