-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added `version` sub-command. This reports "unreleased" when built from the git-repository, but will report the tag/release information when autogenerated releases are built via the github-action. This closes #37. * Document the 'version' subcommand
- Loading branch information
Showing
4 changed files
with
49 additions
and
1 deletion.
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,42 @@ | ||
package main | ||
|
||
//go:generate echo Hello, Go Generate! | ||
import ( | ||
"fmt" | ||
|
||
"github.com/skx/subcommands" | ||
) | ||
|
||
var ( | ||
versionString = "unreleased" | ||
) | ||
|
||
// Structure for our options and state. | ||
type versionCommand struct { | ||
|
||
// We embed the NoFlags option, because we accept no command-line flags. | ||
subcommands.NoFlags | ||
} | ||
|
||
// Info returns the name of this subcommand. | ||
func (t *versionCommand) Info() (string, string) { | ||
return "version", `Show the version of the binary. | ||
Details: | ||
This reports upon the version of the sysbox application. | ||
Usage: | ||
$ sysbox version | ||
` | ||
} | ||
|
||
// Execute is invoked if the user specifies `version` as the subcommand. | ||
func (t *versionCommand) Execute(args []string) int { | ||
|
||
fmt.Printf("%s\n", versionString) | ||
|
||
return 0 | ||
} |
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