Save draft mail in Zimbra web client using ChromeDP
2020-07-03
As an engineer, I want to automate everything as much as possible. This CLI tool is created to save a draft mail in Zimbra web client.
Read config file:
func initConfig() {
if cfgFile != "" {
// Use config file from the flag.
viper.SetConfigFile(cfgFile)
} else {
// Find home directory.
home, err := homedir.Dir()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
// Search config in home directory with name ".zwc" (without extension).
viper.AddConfigPath(home)
viper.SetConfigName(".zwc")
}
viper.AutomaticEnv() // read in environment variables that match
// If a config file is found, read it in.
if err := viper.ReadInConfig(); err != nil {
log.Fatal(err)
}
fmt.Println("Using config file:", viper.ConfigFileUsed())
}
Google Calendar CLI
2020-04-13
Our company allows us to work from home some days a week. To do that, we have to create an event in Google Calendar.
I created this tool to run it from CLI.
First, take a look at this quickstart.
Create initical code by running:
$ cobra init
$ tree -L 2
.
├── LICENSE
├── cmd
│ └── root.go
├── main.go
Create event command:
$ cobra add event
$ cobra add insert -p 'eventCmd'
$ tree -L 2
.
├── LICENSE
├── cmd
│ ├── event.go
│ ├── event_insert.go
│ └── root.go
├── main.go
Quan Tong