cmd

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const AppName = "ghreleasechecker"

AppName is the CLI application name

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   AppName,
	Short: "A release watcher for Github projects",
	Long: `ghReleaseChecker is a release watcher for Github projects.

It will display projects with a new release since the last time it was run.

The list of repositories to be checked is provided in a YAML configuration
file.  A file (in JSON format) is used to keep state between calls; this
file path must be set in the configuration file.

Note that ghReleaseChecker uses the Github official API, which is rate-limited
(especially for anonymous users).  One can use a Github token to increase the
rate.
`,
	Run: func(cmd *cobra.Command, args []string) {
		if version {
			fmt.Printf("This is %s version %s.\n", AppName, Version)
			os.Exit(0)
		}

		if ghConfig == nil {
			fmt.Fprintln(os.Stderr, "Internal error: no configuration loaded")
			os.Exit(1)
		}

		releases, err := ghConfig.CheckReleases(readOnly)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error:", err)
			os.Exit(1)
		}

		displayReleases(releases)
	},
}

RootCmd represents the base command when called without any subcommands

View Source
var Version = "0.0.3"

Version is the CLI application version

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL