Skip to content

Commit

Permalink
feat(cli): add version command for displaying FTL version
Browse files Browse the repository at this point in the history
  • Loading branch information
yarlson committed Jan 12, 2025
1 parent e300a1e commit f8dcafd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ builds:
- amd64
- arm64
ldflags:
- -s -w -X main.version={{.Version}}
- -s -w -X github.com/yarlson/ftl/cmd.version={{.Version}}

archives:
- id: release_archive
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ sudo mv ftl /usr/local/bin/
go install github.com/yarlson/ftl@latest
```

### Verify Installation

After installing FTL, verify it's working correctly by checking the version:

```bash
ftl version
```

## Configuration

Create an `ftl.yaml` file in your project root:
Expand Down
23 changes: 23 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"fmt"

"github.com/spf13/cobra"
)

// version is set during build time
var version = "dev"

var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of FTL",
Long: `Print the version number of FTL deployment tool`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("FTL version %s\n", version)
},
}

func init() {
rootCmd.AddCommand(versionCmd)
}

0 comments on commit f8dcafd

Please sign in to comment.