You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
/*
|
|
|
|
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
|
|
|
|
|
|
|
|
*/
|
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
var cfgFile string
|
|
|
|
|
|
|
|
// rootCmd represents the base command when called without any subcommands
|
|
|
|
var rootCmd = &cobra.Command{
|
|
|
|
Use: "diary",
|
|
|
|
Short: "A software engineer's log",
|
|
|
|
Long: `Use diary to keep track of your day.
|
|
|
|
Example:
|
|
|
|
|
|
|
|
$ diary add "Security meeting minutes"
|
|
|
|
33
|
|
|
|
$ diary add note 33 # opens in your $EDITOR
|
|
|
|
$ diary list today # Show all the entries added today
|
|
|
|
`,
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
func Execute() {
|
|
|
|
err := rootCmd.Execute()
|
|
|
|
if err != nil {
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
cobra.OnInitialize(InitApp)
|
|
|
|
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.diary.toml)")
|
|
|
|
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
|
|
|
}
|