Skip to content

Commit 41d22ec

Browse files
authored
Merge pull request #2 from infracost/chore/support-version-flag
2 parents 4acee1d + 790560f commit 41d22ec

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package main
22

33
import (
44
"context"
5+
"flag"
6+
"fmt"
57
"log"
68
"log/slog"
79
"os"
@@ -15,9 +17,18 @@ import (
1517
"github.com/infracost/lsp/internal/plugins/parser"
1618
"github.com/infracost/lsp/internal/plugins/providers"
1719
"github.com/infracost/lsp/internal/scanner"
20+
"github.com/infracost/lsp/version"
1821
)
1922

2023
func main() {
24+
showVersion := flag.Bool("version", false, "print the version and exit")
25+
flag.Parse()
26+
27+
if *showVersion {
28+
fmt.Println(version.Version)
29+
os.Exit(0)
30+
}
31+
2132
cfg := config.Load(context.Background())
2233

2334
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{

0 commit comments

Comments
 (0)