Skip to content
This repository was archived by the owner on Sep 6, 2025. It is now read-only.

Commit 537da3f

Browse files
committed
Using context
1 parent 3e418ee commit 537da3f

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

cmd/version.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
package cmd
22

33
import (
4-
log "github.com/sirupsen/logrus"
4+
"context"
5+
6+
"github.com/hellofresh/github-cli/pkg/log"
57
"github.com/spf13/cobra"
68
)
79

810
var version = "0.0.0-dev"
911

1012
// NewVersionCmd creates a new version command
11-
func NewVersionCmd() *cobra.Command {
13+
func NewVersionCmd(ctx context.Context) *cobra.Command {
1214
return &cobra.Command{
1315
Use: "version",
1416
Short: "Print the version information",
1517
Aliases: []string{"v"},
1618
Run: func(cmd *cobra.Command, args []string) {
17-
RunVersion()
19+
logger := log.WithContext(ctx)
20+
logger.Infof("github-cli %s", version)
1821
},
1922
}
2023
}
21-
22-
// RunVersion runs the command to print the current version
23-
func RunVersion() {
24-
log.Infof("github-cli %s", version)
25-
}

0 commit comments

Comments
 (0)