-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: setting version dynamically (#83)
- Loading branch information
Sunny Guduru
authored
Mar 28, 2024
1 parent
7002866
commit 7e4e794
Showing
4 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package cmd | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
|
||
"ldcli/internal/flags" | ||
) | ||
|
||
func TestCreate(t *testing.T) { | ||
t.Run("with valid flags prints version", func(t *testing.T) { | ||
client := flags.MockClient{} | ||
args := []string{ | ||
"--version", | ||
} | ||
|
||
output, err := CallCmd(t, &client, nil, nil, args) | ||
|
||
require.NoError(t, err) | ||
assert.Contains(t, string(output), `ldcli version test`) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,10 @@ package main | |
|
||
import "ldcli/cmd" | ||
|
||
var ( | ||
version = "dev" | ||
) | ||
|
||
func main() { | ||
cmd.Execute() | ||
cmd.Execute(version) | ||
} |