Skip to content

Commit 7e7f1ba

Browse files
authored
feat: Add version flag (#127)
Fixes #121. Setting the `Version` on the root command enables the `--version` flag at the top level (e.g. `./test --version -> plugin version development`) ---
1 parent 4e370c8 commit 7e7f1ba

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

serve/destination.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func newCmdDestinationServe(destination *destinationServe) *cobra.Command {
103103
Dsn: destination.sentryDSN,
104104
Debug: false,
105105
AttachStacktrace: true,
106-
Release: destination.plugin.Version(),
106+
Release: version,
107107
// https://docs.sentry.io/platforms/go/configuration/options/#removing-default-integrations
108108
Integrations: func(integrations []sentry.Integration) []sentry.Integration {
109109
var filteredIntegrations []sentry.Integration
@@ -143,5 +143,6 @@ func newCmdDestinationRoot(destination *destinationServe) *cobra.Command {
143143
}
144144
cmd.AddCommand(newCmdDestinationServe(destination))
145145
cmd.CompletionOptions.DisableDefaultCmd = true
146+
cmd.Version = destination.plugin.Version()
146147
return cmd
147148
}

serve/source.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func newCmdSourceServe(source *sourceServe) *cobra.Command {
103103
Dsn: source.sentryDSN,
104104
Debug: false,
105105
AttachStacktrace: true,
106-
Release: source.plugin.Version(),
106+
Release: version,
107107
// https://docs.sentry.io/platforms/go/configuration/options/#removing-default-integrations
108108
Integrations: func(integrations []sentry.Integration) []sentry.Integration {
109109
var filteredIntegrations []sentry.Integration
@@ -160,5 +160,6 @@ func newCmdSourceRoot(source *sourceServe) *cobra.Command {
160160
cmd.AddCommand(newCmdSourceServe(source))
161161
cmd.AddCommand(newCmdSourceDoc(source))
162162
cmd.CompletionOptions.DisableDefaultCmd = true
163+
cmd.Version = source.plugin.Version()
163164
return cmd
164165
}

0 commit comments

Comments
 (0)