Skip to content

Commit

Permalink
area command docu + aliases (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
mandelsoft authored Jul 28, 2023
1 parent 75c7971 commit 24a49ae
Show file tree
Hide file tree
Showing 49 changed files with 504 additions and 25 deletions.
12 changes: 6 additions & 6 deletions cmds/ocm/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strings"
"unicode"

"github.com/open-component-model/ocm/cmds/ocm/commands/toicmds"
_ "github.com/open-component-model/ocm/pkg/contexts/clictx/config"
_ "github.com/open-component-model/ocm/pkg/contexts/ocm/attrs"

Expand Down Expand Up @@ -237,12 +238,11 @@ func newCliCommand(opts *CLIOptions, mod ...func(clictx.Context, *cobra.Command)
cmd.AddCommand(cmdutils.HideCommand(plugins.NewCommand(opts.Context)))
cmd.AddCommand(cmdutils.HideCommand(action.NewCommand(opts.Context)))

cmd.AddCommand(cmdutils.HideCommand(cachecmds.NewCommand(opts.Context)))
cmd.AddCommand(cmdutils.HideCommand(ocicmds.NewCommand(opts.Context)))
cmd.AddCommand(cmdutils.HideCommand(ocmcmds.NewCommand(opts.Context)))
// cmd.AddCommand(cmdutils.HideCommand(toicmds.NewCommand(opts.Context)))

cmd.AddCommand(cmdutils.HideCommand(creds.NewCommand(opts.Context)))
cmd.AddCommand(cmdutils.OverviewCommand(cachecmds.NewCommand(opts.Context)))
cmd.AddCommand(cmdutils.OverviewCommand(ocicmds.NewCommand(opts.Context)))
cmd.AddCommand(cmdutils.OverviewCommand(ocmcmds.NewCommand(opts.Context)))
cmd.AddCommand(cmdutils.OverviewCommand(toicmds.NewCommand(opts.Context)))
cmd.AddCommand(cmdutils.OverviewCommand(creds.NewCommand(opts.Context)))

opts.AddFlags(cmd.Flags())
cmd.InitDefaultHelpCmd()
Expand Down
4 changes: 2 additions & 2 deletions cmds/ocm/commands/cachecmds/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/spf13/cobra"

"github.com/open-component-model/ocm/cmds/ocm/commands/cachecmds/clean"
"github.com/open-component-model/ocm/cmds/ocm/commands/cachecmds/info"
"github.com/open-component-model/ocm/cmds/ocm/commands/cachecmds/describe"
"github.com/open-component-model/ocm/cmds/ocm/pkg/utils"
"github.com/open-component-model/ocm/pkg/contexts/clictx"
)
Expand All @@ -19,6 +19,6 @@ func NewCommand(ctx clictx.Context) *cobra.Command {
Short: "Cache related commands",
}, "cache")
cmd.AddCommand(clean.NewCommand(ctx, clean.Verb))
cmd.AddCommand(info.NewCommand(ctx, info.Verb))
cmd.AddCommand(describe.NewCommand(ctx, describe.Verb))
return cmd
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0

package info
package describe

import (
"github.com/spf13/cobra"
Expand All @@ -19,7 +19,7 @@ import (

var (
Names = names.Cache
Verb = verbs.Info
Verb = verbs.Describe
)

type Command struct {
Expand All @@ -29,7 +29,7 @@ type Command struct {

// NewCommand creates a new artifact command.
func NewCommand(ctx clictx.Context, names ...string) *cobra.Command {
return utils.SetupCommand(&Command{BaseCommand: utils.NewBaseCommand(ctx)}, names...)
return utils.SetupCommand(&Command{BaseCommand: utils.NewBaseCommand(ctx)}, utils.Names(Names, names...)...)
}

func (o *Command) ForName(name string) *cobra.Command {
Expand Down
2 changes: 2 additions & 0 deletions cmds/ocm/commands/verbs/describe/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package describe
import (
"github.com/spf13/cobra"

cache "github.com/open-component-model/ocm/cmds/ocm/commands/cachecmds/describe"
resources "github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds/artifacts/describe"
plugins "github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/plugins/describe"
_package "github.com/open-component-model/ocm/cmds/ocm/commands/toicmds/package/describe"
Expand All @@ -22,6 +23,7 @@ func NewCommand(ctx clictx.Context) *cobra.Command {
}, verbs.Describe)
cmd.AddCommand(resources.NewCommand(ctx))
cmd.AddCommand(plugins.NewCommand(ctx))
cmd.AddCommand(cache.NewCommand(ctx))
cmd.AddCommand(_package.NewCommand(ctx))
return cmd
}
1 change: 0 additions & 1 deletion cmds/ocm/commands/verbs/verbs.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const (
Sign = "sign"
Verify = "verify"
Clean = "clean"
Info = "info"
Install = "install"
Execute = "execute"
)
8 changes: 8 additions & 0 deletions cmds/ocm/pkg/utils/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ func HideCommand(cmd *cobra.Command) *cobra.Command {
return cmd
}

func OverviewCommand(cmd *cobra.Command) *cobra.Command {
if cmd.Annotations == nil {
cmd.Annotations = map[string]string{}
}
cmd.Annotations["overview"] = ""
return cmd
}

func MassageCommand(cmd *cobra.Command, names ...string) *cobra.Command {
cmd.Use = addCommand(names, cmd.Use)
if len(names) > 1 {
Expand Down
9 changes: 9 additions & 0 deletions docs/reference/ocm.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ Often a tagged value can also be substituted from a file with the syntax



##### Area Overview

* [ocm <b>cache</b>](ocm_cache.md) &mdash; Cache related commands
* [ocm <b>credentials</b>](ocm_credentials.md) &mdash; Commands acting on credentials
* [ocm <b>oci</b>](ocm_oci.md) &mdash; Dedicated command flavors for the OCI layer
* [ocm <b>ocm</b>](ocm_ocm.md) &mdash; Dedicated command flavors for the Open Component Model
* [ocm <b>toi</b>](ocm_toi.md) &mdash; Dedicated command flavors for the TOI layer


##### Additional Help Topics

* [ocm <b>attributes</b>](ocm_attributes.md) &mdash; configuration attributes used to control the behaviour
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/ocm_add_componentversions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ocm add componentversions [<options>] [--version <version>] [<ctf archive>] {<components.yaml>}
```

##### Aliases

```
componentversions, componentversion, cv, components, component, comps, comp, c
```

### Options

```
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/ocm_add_references.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ocm add references [<options>] [<target>] {<referencefile> | <var>=<value>}
```

##### Aliases

```
references, reference, refs
```

### Options

```
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/ocm_add_resource-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ocm add resource-configuration [<options>] <target> {<configfile> | <var>=<value>}
```

##### Aliases

```
resource-configuration, resourceconfig, rsccfg, rcfg
```

### Options

```
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/ocm_add_resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ocm add resources [<options>] [<target>] {<resourcefile> | <var>=<value>}
```

##### Aliases

```
resources, resource, res, r
```

### Options

```
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/ocm_add_source-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ocm add source-configuration [<options>] <target> {<configfile> | <var>=<value>}
```

##### Aliases

```
source-configuration, sourceconfig, srccfg, scfg
```

### Options

```
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/ocm_add_sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ocm add sources [<options>] [<target>] {<resourcefile> | <var>=<value>}
```

##### Aliases

```
sources, source, src, s
```

### Options

```
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/ocm_bootstrap_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ocm bootstrap configuration [<options>] {<component-reference>} {<resource id field>}
```

##### Aliases

```
configuration, config, cfg
```

### Options

```
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/ocm_bootstrap_package.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ocm bootstrap package [<options>] <action> {<component-reference>} {<resource id field>}
```

##### Aliases

```
package, pkg, componentversion, cv, component, comp, c
```

### Options

```
Expand Down
26 changes: 26 additions & 0 deletions docs/reference/ocm_cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
## ocm cache &mdash; Cache Related Commands

### Synopsis

```
ocm cache [<options>] <sub command> ...
```

### Options

```
-h, --help help for cache
```

### SEE ALSO

##### Parents

* [ocm](ocm.md) &mdash; Open Component Model command line client


##### Sub Commands

* ocm cache <b>clean</b> &mdash; cleanup oci blob cache
* ocm cache <b>describe</b> &mdash; show OCI blob cache information

6 changes: 6 additions & 0 deletions docs/reference/ocm_create_componentarchive.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ocm create componentarchive [<options>] <component> <version> --provider <provider-name> {--provider <label>=<value>} {<label>=<value>}
```

##### Aliases

```
componentarchive, comparch, ca
```

### Options

```
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/ocm_create_rsakeypair.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ocm create rsakeypair [<private key file> [<public key file>]] {<subject-attribute>=<value>}
```

##### Aliases

```
rsakeypair, rsa
```

### Options

```
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/ocm_create_transportarchive.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ocm create transportarchive [<options>] <path>
```

##### Aliases

```
transportarchive, ctf
```

### Options

```
Expand Down
31 changes: 31 additions & 0 deletions docs/reference/ocm_credentials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## ocm credentials &mdash; Commands Acting On Credentials

### Synopsis

```
ocm credentials [<options>] <sub command> ...
```

##### Aliases

```
credentials, creds, cred
```

### Options

```
-h, --help help for credentials
```

### SEE ALSO

##### Parents

* [ocm](ocm.md) &mdash; Open Component Model command line client


##### Sub Commands

* ocm credentials <b>get</b> &mdash; Get credentials for a dedicated consumer spec

1 change: 1 addition & 0 deletions docs/reference/ocm_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ocm describe [<options>] <sub command> ...
##### Sub Commands

* [ocm describe <b>artifacts</b>](ocm_describe_artifacts.md) &mdash; describe artifact version
* [ocm describe <b>cache</b>](ocm_describe_cache.md) &mdash; show OCI blob cache information
* [ocm describe <b>package</b>](ocm_describe_package.md) &mdash; describe TOI package
* [ocm describe <b>plugins</b>](ocm_describe_plugins.md) &mdash; get plugins

6 changes: 6 additions & 0 deletions docs/reference/ocm_describe_artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ocm describe artifacts [<options>] {<artifact-reference>}
```

##### Aliases

```
artifacts, artifact, art, a
```

### Options

```
Expand Down
33 changes: 33 additions & 0 deletions docs/reference/ocm_describe_cache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## ocm describe cache &mdash; Show OCI Blob Cache Information

### Synopsis

```
ocm describe cache [<options>]
```

### Options

```
-h, --help help for cache
```

### Description


Show details about the OCI blob cache (if given).


### Examples

```
$ ocm cache info
```

### SEE ALSO

##### Parents

* [ocm describe](ocm_describe.md) &mdash; Describe various elements by using appropriate sub commands.
* [ocm](ocm.md) &mdash; Open Component Model command line client

6 changes: 6 additions & 0 deletions docs/reference/ocm_describe_package.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
ocm describe package [<options>] {<component-reference>} {<resource id field>}
```

##### Aliases

```
package, pkg, componentversion, cv, component, comp, c
```

### Options

```
Expand Down
Loading

0 comments on commit 24a49ae

Please sign in to comment.