Skip to content

Commit

Permalink
Add version and compile time information (now support the --version f…
Browse files Browse the repository at this point in the history
…lag)(#61)

* Added version and compiled attributes to the app (now support using the --version flag)
  • Loading branch information
spitzzz authored May 16, 2022
1 parent b017e9f commit d55ef36
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package main
import (
"log"
"os"
"time"
"fmt"

"github.com/urfave/cli/v2"

Expand All @@ -12,11 +14,18 @@ import (
)

var version = "dev"
var date = "2006-01-02T15:04:05Z"

func main() {
compileTime, err := time.Parse(time.RFC3339, date)
if err != nil {
log.Fatal(fmt.Sprintf("Could not parse compilation date: %v", err))
}
app := &cli.App{
Name: "spacectl",
Usage: "Programmatic access to Spacelift GraphQL API",
Name: "spacectl",
Version: version,
Compiled: compileTime,
Usage: "Programmatic access to Spacelift GraphQL API.",
Commands: []*cli.Command{
profile.Command(),
stack.Command(),
Expand Down

0 comments on commit d55ef36

Please sign in to comment.