Skip to content

Commit

Permalink
Add alpha command group
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmaly committed Feb 22, 2022
1 parent 6e783a8 commit 67eea0b
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 11 deletions.
45 changes: 45 additions & 0 deletions commands/alphacmd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2022 Google LLC
//
// 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 commands

import (
"context"

"github.com/GoogleContainerTools/kpt/internal/docs/generated/alphadocs"
"github.com/spf13/cobra"
)

func GetAlphaCommand(ctx context.Context, name string) *cobra.Command {
alpha := &cobra.Command{
Use: "alpha",
Short: alphadocs.AlphaShort,
Long: alphadocs.AlphaLong,
RunE: func(cmd *cobra.Command, args []string) error {
h, err := cmd.Flags().GetBool("help")
if err != nil {
return err
}
if h {
return cmd.Help()
}
return cmd.Usage()
},
Hidden: true,
}

// TODO: add individual commands

return alpha
}
3 changes: 2 additions & 1 deletion commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ func GetKptCommands(ctx context.Context, name, version string) []*cobra.Command
fnCmd := GetFnCommand(ctx, name)
pkgCmd := GetPkgCommand(ctx, name)
liveCmd := GetLiveCommand(ctx, name, version)
alphaCmd := GetAlphaCommand(ctx, name)

c = append(c, pkgCmd, fnCmd, liveCmd)
c = append(c, pkgCmd, fnCmd, liveCmd, alphaCmd)

// apply cross-cutting issues to commands
NormalizeCommand(c...)
Expand Down
7 changes: 7 additions & 0 deletions internal/docs/generated/alphadocs/docs.go

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

11 changes: 6 additions & 5 deletions internal/docs/generated/overview/docs.go

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

1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//go:generate $GOBIN/mdtogo site/reference/cli/live internal/docs/generated/livedocs --license=none --recursive=true --strategy=cmdDocs
//go:generate $GOBIN/mdtogo site/reference/cli/pkg internal/docs/generated/pkgdocs --license=none --recursive=true --strategy=cmdDocs
//go:generate $GOBIN/mdtogo site/reference/cli/fn internal/docs/generated/fndocs --license=none --recursive=true --strategy=cmdDocs
//go:generate $GOBIN/mdtogo site/reference/cli/alpha internal/docs/generated/alphadocs --license=none --recursive=true --strategy=cmdDocs
//go:generate $GOBIN/mdtogo site/reference/cli/README.md internal/docs/generated/overview --license=none --strategy=cmdDocs
package main

Expand Down
12 changes: 7 additions & 5 deletions site/reference/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ kpt <group> <command> <positional args> [PKG_PATH] [flags]

kpt functionality is divided into three command groups:

| Group | Description |
| ------ | --------------------------------------------------------------------- |
| [pkg] | get, update, and describe packages with resources. |
| [fn] | generate, transform, validate packages using containerized functions. |
| [live] | deploy local configuration packages to a cluster. |
| Group | Description |
| ------- | --------------------------------------------------------------------- |
| [pkg] | get, update, and describe packages with resources. |
| [fn] | generate, transform, validate packages using containerized functions. |
| [live] | deploy local configuration packages to a cluster. |
| [alpha] | commands currently in alpha and might change without notice. |

<!--mdtogo-->

[pkg]: /reference/cli/pkg/
[fn]: /reference/cli/fn/
[live]: /reference/cli/live/
[alpha]: /reference/cli/alpha/
16 changes: 16 additions & 0 deletions site/reference/cli/alpha/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: "`alpha`"
linkTitle: "alpha"
type: docs
weight: 4
description: >
This command is currently in alpha and might change without notice.
---

<!--mdtogo:Short
This command is currently in alpha and might change without notice.
-->

<!--mdtogo:Long-->
The `alpha` command group contains subcommands which are in alpha and might change without notice.
<!--mdtogo-->

0 comments on commit 67eea0b

Please sign in to comment.