-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add pack extension --help #1601
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package commands | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/buildpacks/pack/internal/config" | ||
"github.com/buildpacks/pack/pkg/logging" | ||
) | ||
|
||
func NewExtensionCommand(logger logging.Logger, cfg config.Config, client PackClient, packageConfigReader PackageConfigReader) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "extension", | ||
Aliases: []string{"extensions"}, | ||
Short: "Interact with extensions", | ||
RunE: nil, | ||
} | ||
|
||
cmd.AddCommand(ExtensionInspect(logger, cfg, client)) | ||
// client and packageConfigReader to be passed later on | ||
cmd.AddCommand(ExtensionPackage(logger, cfg)) | ||
// client to be passed later on | ||
cmd.AddCommand(ExtensionNew(logger)) | ||
cmd.AddCommand(ExtensionPull(logger, cfg, client)) | ||
cmd.AddCommand(ExtensionRegister(logger, cfg, client)) | ||
cmd.AddCommand(ExtensionYank(logger, cfg, client)) | ||
|
||
AddHelpFlag(cmd, "extension") | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package commands | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/buildpacks/pack/internal/config" | ||
"github.com/buildpacks/pack/pkg/logging" | ||
) | ||
|
||
type ExtensionInspectFlags struct { | ||
Depth int | ||
Registry string | ||
Verbose bool | ||
} | ||
|
||
func ExtensionInspect(logger logging.Logger, cfg config.Config, client PackClient) *cobra.Command { | ||
var flags ExtensionInspectFlags | ||
cmd := &cobra.Command{ | ||
Use: "inspect <extension-name>", | ||
Args: cobra.ExactArgs(1), | ||
Short: "Show information about an extension", | ||
Example: "pack extension inspect <example-extension>", | ||
RunE: logError(logger, func(cmd *cobra.Command, args []string) error { | ||
extensionName := args[0] | ||
registry := flags.Registry | ||
if registry == "" { | ||
// fix registry for extension | ||
} | ||
|
||
return extensionInspect(logger, extensionName, registry, flags, cfg, client) | ||
}), | ||
} | ||
// flags will be added here | ||
AddHelpFlag(cmd, "inspect") | ||
return cmd | ||
} | ||
|
||
func extensionInspect(logger logging.Logger, extensionName, registry string, flags ExtensionInspectFlags, cfg config.Config, client PackClient) error { | ||
// logic to inspect extension | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package commands | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/buildpacks/pack/pkg/logging" | ||
) | ||
|
||
// ExtensionNewFlags define flags provided to the ExtensionNew command | ||
type ExtensionNewFlags struct { | ||
API string | ||
Path string | ||
Stacks []string | ||
Version string | ||
} | ||
|
||
// extensioncreator type to be added here and argument also to be added in the function | ||
|
||
// ExtensionNew generates the scaffolding of an extension | ||
func ExtensionNew(logger logging.Logger) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "new <id>", | ||
Short: "Creates basic scaffolding of an extension.", | ||
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), | ||
Example: "pack extension new <example-extension>", | ||
RunE: logError(logger, func(cmd *cobra.Command, args []string) error { | ||
// logic will go here | ||
return nil | ||
}), | ||
} | ||
|
||
// flags will go here | ||
|
||
AddHelpFlag(cmd, "new") | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package commands | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/buildpacks/pack/internal/config" | ||
"github.com/buildpacks/pack/pkg/logging" | ||
) | ||
|
||
// ExtensionPackageFlags define flags provided to the ExtensionPackage command | ||
type ExtensionPackageFlags struct { | ||
PackageTomlPath string | ||
Format string | ||
Publish bool | ||
Policy string | ||
ExtensionRegistry string | ||
Path string | ||
} | ||
|
||
// Packager and PackageConfigReader to be added here and argument also to be added in the function | ||
|
||
// ExtensionPackage packages (a) extension(s) into OCI format, based on a package config | ||
func ExtensionPackage(logger logging.Logger, cfg config.Config) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "package <name> --config <config-path>", | ||
Short: "Package an extension in OCI format.", | ||
Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), | ||
RunE: logError(logger, func(cmd *cobra.Command, args []string) error { | ||
// logic will be added here | ||
return nil | ||
}), | ||
} | ||
|
||
// flags will be added here | ||
|
||
AddHelpFlag(cmd, "package") | ||
return cmd | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this line should be move inside the statement
if cfg.Experimental
on line 100. I believe the extensions is actually an experimental feature.