Skip to content

Commit f8dcafd

Browse files
committed
feat(cli): add version command for displaying FTL version
1 parent e300a1e commit f8dcafd

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ builds:
1515
- amd64
1616
- arm64
1717
ldflags:
18-
- -s -w -X main.version={{.Version}}
18+
- -s -w -X github.com/yarlson/ftl/cmd.version={{.Version}}
1919

2020
archives:
2121
- id: release_archive

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ sudo mv ftl /usr/local/bin/
4444
go install github.com/yarlson/ftl@latest
4545
```
4646

47+
### Verify Installation
48+
49+
After installing FTL, verify it's working correctly by checking the version:
50+
51+
```bash
52+
ftl version
53+
```
54+
4755
## Configuration
4856

4957
Create an `ftl.yaml` file in your project root:

cmd/version.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package cmd
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
7+
)
8+
9+
// version is set during build time
10+
var version = "dev"
11+
12+
var versionCmd = &cobra.Command{
13+
Use: "version",
14+
Short: "Print the version number of FTL",
15+
Long: `Print the version number of FTL deployment tool`,
16+
Run: func(cmd *cobra.Command, args []string) {
17+
fmt.Printf("FTL version %s\n", version)
18+
},
19+
}
20+
21+
func init() {
22+
rootCmd.AddCommand(versionCmd)
23+
}

0 commit comments

Comments
 (0)