Skip to content

Commit

Permalink
Rework some aspects of CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
errordeveloper committed Sep 15, 2023
1 parent 8c87d5c commit ac736f6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
22 changes: 12 additions & 10 deletions tape/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ type TapeCommand struct {
ctx context.Context
}

type CommonOptions struct {
ManifestDir string `short:"D" long:"manifest-dir" description:"Directory containing manifests" required:"true"`
type InputManifestDirOptions struct {
ManifestDir string `short:"D" long:"manifest-dir" description:"Intput directory to read manifests from" required:"true"`
}

tape *TapeCommand
type OutputManifestDirOptions struct {
ManifestDir string `short:"D" long:"manifest-dir" description:"Output directory to exact manifests" required:"true"`
}

func Run() int {
Expand All @@ -54,23 +56,23 @@ func Run() int {
name: "images",
short: "List app image",
long: []string{
"This command can be used to obeseve app images referenced",
"in the given set of manifests, inspect metadata and digests",
"This command load manifests from the given dir and prints info about",
"all app images referenced in these manifests",
},
options: &TapeImagesCommand{
CommonOptions: CommonOptions{tape: tape},
tape: tape,
InputManifestDirOptions: InputManifestDirOptions{},
},
},
{
name: "package",
short: "Create a package",
long: []string{
"This command can be used to package app images and configuration",
"as a single self-contained artefact",
"This command process manifests from the given dir and packages them as an artefact",
},
options: &TapePackageCommand{
CommonOptions: CommonOptions{tape: tape},
},
tape: tape,
InputManifestDirOptions: InputManifestDirOptions{}},
},
}

Expand Down
3 changes: 2 additions & 1 deletion tape/app/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import (
)

type TapeImagesCommand struct {
CommonOptions
tape *TapeCommand
InputManifestDirOptions
}

type imageManifest struct {
Expand Down
9 changes: 5 additions & 4 deletions tape/app/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ import (
)

type TapePackageCommand struct {
CommonOptions
tape *TapeCommand
InputManifestDirOptions

WithImages map[string]string `short:"I" long:"with-images" required:"false" description:"Names of new images to use instead of what specified in the manifests"`
OutputImage string `short:"O" long:"output-image" required:"true" description:"Name of the taped image to push"`
// WithImages map[string]string `short:"I" long:"with-images" required:"false" description:"Names of new images to use instead of what specified in the manifests"`
OutputImage string `short:"O" long:"output-image" required:"true" description:"Name of the image to push"`

// TODO: implement
Push bool `short:"P" long:"push" description:"Push the resulting image to the registry"`
// Push bool `short:"P" long:"push" description:"Push the resulting image to the registry"`
}

func (c *TapePackageCommand) ValidateFlags() error {
Expand Down

0 comments on commit ac736f6

Please sign in to comment.