Skip to content
Open
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
6 changes: 5 additions & 1 deletion nodeadm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ else
GOBIN=$(shell go env GOBIN)
endif

# Version from git tags
VERSION ?= 0.0.0
LDFLAGS ?= -X 'main.version=$(VERSION)'

# Setting SHELL to bash allows bash commands to be executed by recipes.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
SHELL = /usr/bin/env bash -o pipefail
Expand Down Expand Up @@ -78,7 +82,7 @@ test-e2e: build ## Run e2e tests.

.PHONY: build
build: ## Build binary.
GOOS=$(GOOS) go build -o $(LOCALBIN)/ ./cmd/...
GOOS=$(GOOS) go build -ldflags="$(LDFLAGS)" -o $(LOCALBIN)/ ./cmd/...

.PHONY: run
run: build ## Run binary.
Expand Down
5 changes: 5 additions & 0 deletions nodeadm/cmd/nodeadm-internal/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ import (
"github.com/awslabs/amazon-eks-ami/nodeadm/internal/cli"
)

var (
version = "0.0.0"
)

func main() {
m := cli.Main{
Name: "nodeadm-internal",
Description: "Supporting tools for systems using nodeadm",
AdditionalHelp: "WARNING: There is no command-line stability guarantee!",
Version: version,
Commands: []cli.Command{
boothook.NewBootHookCommand(),
},
Expand Down
5 changes: 5 additions & 0 deletions nodeadm/cmd/nodeadm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ import (
"github.com/awslabs/amazon-eks-ami/nodeadm/internal/cli"
)

var (
version = "0.0.0"
)

func main() {
flaggy.SetName("nodeadm")
flaggy.SetDescription("From zero to Node faster than you can say Elastic Kubernetes Service")
flaggy.SetVersion(version)
flaggy.DefaultParser.AdditionalHelpPrepend = "\nhttp://github.com/awslabs/amazon-eks-ami/nodeadm"
flaggy.DefaultParser.ShowHelpOnUnexpected = true

Expand Down
2 changes: 2 additions & 0 deletions nodeadm/internal/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ type Main struct {
Name string
Description string
AdditionalHelp string
Version string
Commands []Command
}

func (m *Main) Run() {
flaggy.SetName(m.Name)
flaggy.SetDescription(m.Description)
flaggy.SetVersion(m.Version)
if m.AdditionalHelp != "" {
flaggy.DefaultParser.AdditionalHelpPrepend = "\n" + m.AdditionalHelp
}
Expand Down
Loading