Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ All notable changes to `src-cli` are documented in this file.

### Added

- A `-client-only` flag has been added to `src version`. When set, only the local src-cli's version will be printed and no attempt is made to fetch the recommended version from the configured Sourcegraph server.

### Changed

### Fixed
Expand Down
8 changes: 7 additions & 1 deletion cmd/src/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ Examples:

flagSet := flag.NewFlagSet("version", flag.ExitOnError)

var apiFlags = api.NewFlags(flagSet)
var (
clientOnly = flagSet.Bool("client-only", false, "If true, only the client version will be printed.")
apiFlags = api.NewFlags(flagSet)
)

handler := func(args []string) error {
fmt.Printf("Current version: %s\n", version.BuildTag)
if clientOnly != nil && *clientOnly {
return nil
}

client := cfg.apiClient(apiFlags, flagSet.Output())
recommendedVersion, err := getRecommendedVersion(context.Background(), client)
Expand Down