Skip to content

Commit

Permalink
Move main.go to repo root folder (elastic#29)
Browse files Browse the repository at this point in the history
* Move `main.go` to repo root folder

This change simplifies go getting this package by moving `main.go` to
the root folder.

The new command to download this tool will be:

```
go get github.com/elastic/elastic-package
```

This should be the only thing needed by a user that doesn't want to
implement changes to this tool
  • Loading branch information
Carlos Pérez-Aradros Herce authored Jul 30, 2020
1 parent 814d8e1 commit 9e6eefa
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


build:
go get github.com/elastic/elastic-package/cmd/elastic-package
go get github.com/elastic/elastic-package

format:
gofmt -s -w .
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TODO
Download and build the `elastic-package` binary:

```bash
go get github.com/elastic/elastic-package/cmd/elastic-package
go get github.com/elastic/elastic-package
```

Change directory to the integration under development
Expand Down
2 changes: 1 addition & 1 deletion cmd/elastic-package/build.go → cmd/build.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package cmd

import (
"github.com/pkg/errors"
Expand Down
2 changes: 1 addition & 1 deletion cmd/elastic-package/cluster.go → cmd/cluster.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package cmd

import (
"github.com/pkg/errors"
Expand Down
19 changes: 19 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package cmd

import (
"github.com/spf13/cobra"
)

// RootCmd creates and returns root cmd for elastic-package
func RootCmd() *cobra.Command {
rootCmd := &cobra.Command{
Use: "elastic-package",
Short: "elastic-package - Command line tool for developing Elastic Integrations",
}
rootCmd.AddCommand(
setupClusterCommand(),
setupBuildCommand(),
setupTestCommand())

return rootCmd
}
2 changes: 1 addition & 1 deletion cmd/elastic-package/testrunner.go → cmd/testrunner.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package cmd

import "github.com/spf13/cobra"

Expand Down
12 changes: 2 additions & 10 deletions cmd/elastic-package/main.go → main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,13 @@ import (
"os"

"github.com/pkg/errors"
"github.com/spf13/cobra"

"github.com/elastic/elastic-package/cmd"
"github.com/elastic/elastic-package/internal/install"
)

func main() {
rootCmd := &cobra.Command{
Use: "elastic-package",
Short: "elastic-package - Command line tool for developing Elastic Integrations",
SilenceUsage: true,
}
rootCmd.AddCommand(
setupBuildCommand(),
setupClusterCommand(),
setupTestCommand())
rootCmd := cmd.RootCmd()

err := install.EnsureInstalled()
if err != nil {
Expand Down

0 comments on commit 9e6eefa

Please sign in to comment.