package
module
Version:
v1.0.4
Opens a new window with list of versions in this module.
Published: Apr 12, 2022
License: MIT
Opens a new window with license information.
Imports: 13
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
README
¶
cobra-update
Provides a cobra command to allow your apps to self-update themselves by downloading the latest GitHub release.
Setup
-
Add the command to your Cobra app, passing in the owner/repo where new releases will be downloaded from:
import update "github.com/Shamus03/cobra-update"
func init() {
rootCmd.AddCommand(update.Command("Shamus03", "munn"))
}
-
(optional) Make sure your root *cobra.Command
has its Version
field set. This is the most simple example:
var rootCmd = &cobra.Command {
Use: "your-command",
// other fields
Version: "1.2.3",
}
- Skipping this step will cause the update command to always download the latest release, even if the executable is already up to date.
- For a more complex example of setting the version through an automated workflow at build time, see munn's version file and semantic-release configuration.
Documentation
¶
type Option interface {
}
func SetGithubTokenEnvironmentVariableName(name string) Option
Source Files
¶
Click to show internal directories.
Click to hide internal directories.