Skip to content

Commit

Permalink
- Made serve a subcommand of internal.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristoffer Ahl committed Oct 15, 2020
1 parent 8780fa2 commit 1fa652b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
12 changes: 10 additions & 2 deletions cmd/centry/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/urfave/cli/v2"
)

func registerBuiltinCommands(runtime *Runtime) {
func registerInternalCommands(runtime *Runtime) {
context := runtime.context

if context.executor == CLI {
Expand All @@ -22,7 +22,15 @@ func registerBuiltinCommands(runtime *Runtime) {
"command": "serve",
}),
}
runtime.cli.Commands = append(runtime.cli.Commands, serveCmd.ToCLICommand())
internalCmd := &cli.Command{
Name: "internal",
Usage: "Internal centry commands",
UsageText: "",
Subcommands: []*cli.Command{
serveCmd.ToCLICommand(),
},
}
runtime.cli.Commands = append(runtime.cli.Commands, internalCmd)
}
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/centry/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func NewRuntime(inputArgs []string, context *Context) (*Runtime, error) {
},
}

// Register builtin commands
registerBuiltinCommands(runtime)
// Register internal commands
registerInternalCommands(runtime)

// Register manifest commands
registerManifestCommands(runtime, options)
Expand Down
1 change: 1 addition & 0 deletions cmd/centry/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ func TestMain(t *testing.T) {
expected := `COMMANDS:
commandtest Command tests
helptest Help tests
internal Internal centry commands
optiontest Option tests
scripttest Script tests`

Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/config/schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1fa652b

Please sign in to comment.