Skip to content
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

[cli] Fix generate registry command #445

Merged
merged 3 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ the pack to their cluster.

* **Vendoring Dependencies** - With `nomad-pack deps vendor`, you can
automatically download all the dependencies listed in the `metadata.hcl` file
into a `deps/` subdirectory.
into a `deps/` subdirectory.

BUG FIXES:
* cli: `generate registry` command creates registry in properly named folder [[GH-445](https://github.com/hashicorp/nomad-pack/pull/445)]

IMPROVEMENTS:

Expand Down
5 changes: 2 additions & 3 deletions internal/cli/generate_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ func (c *GenerateRegistryCommand) Run(args []string) int {
return 1
}

c.cfg.PackName = c.args[0]
c.cfg.RegistryName = c.args[0]

// Generate our UI error context.
errorContext := errors.NewUIErrorContext()

errorContext.Add(errors.UIContextPrefixRegistryName, c.cfg.PackName)
errorContext.Add(errors.UIContextPrefixRegistryName, c.cfg.RegistryName)
errorContext.Add(errors.UIContextPrefixOutputPath, c.cfg.OutPath)

err := creator.CreateRegistry(c.cfg)
Expand Down Expand Up @@ -89,7 +89,6 @@ func (c *GenerateRegistryCommand) Help() string {
c.Example = `
# Create a new registry named "my-new-registry" in the current directory.
nomad-pack generate registry my-new-registry

`
return formatHelp(`
Usage: nomad-pack generate registry <name>
Expand Down
4 changes: 2 additions & 2 deletions internal/creator/pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ type packCreator struct {
func CreatePack(c config.PackConfig) error {
ui := c.GetUI()

var outPath string
outPath := c.OutPath
var err error
if c.OutPath == "" {
if outPath == "" {
outPath, err = os.Getwd()
if err != nil {
newCreatePackError(err)
Expand Down