cmd

package
v0.0.0-...-3c3bf55 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "ghi",
	Short: fmt.Sprintf("Offline GitHub Issues Client (v%s)", Version),
	Long:  `GHI let's you download issues from a GitHub repo to be made available offline.`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		config = LoadConfig()
		if config.Repo == "" {
			if len(args) == 0 {
				fmt.Println(`It looks like you haven't initialized GHI yet!

The first time you run GHI you should run "ghi fetch owner/repo".

This will fetch all of your issues for that repository. Future calls
to "fetch" won't require the "owner/repo" since we'll store a little
meta-data file in this repo to track that.`)
				os.Exit(-1)
			} else {
				config.SetFromArgs(args)
			}
		}

		s, err := store.New(config.Owner, config.Repo)
		if err != nil {
			fmt.Println(err)
			os.Exit(-1)
		}
		db = s
	},
}
View Source
var Version = "0.1.0"

Functions

func Execute

func Execute()

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

Types

type Config

type Config struct {
	Owner       string    `yaml:"owner"`
	Repo        string    `yaml:"repo"`
	LastUpdated time.Time `yaml:"last_updated"`
}

func LoadConfig

func LoadConfig() *Config

func (*Config) Save

func (c *Config) Save()

func (*Config) SetFromArgs

func (c *Config) SetFromArgs(args []string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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