Skip to content

Commit

Permalink
[cli] Fix generate registry command (#445)
Browse files Browse the repository at this point in the history
* Fix incorrect argument use
* Put sample pack inside `packs` folder
* Add CHANGELOG
  • Loading branch information
angrycub authored Oct 24, 2023
1 parent b4804d4 commit db9f7f8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
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

0 comments on commit db9f7f8

Please sign in to comment.