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:
1func initConfig() { 2 if cfgFile != "" { 3 // Use config file from the flag. 4 viper.SetConfigFile(cfgFile) 5 } else { 6 // Find home directory. 7 home, err := homedir.Dir() 8 if err != nil { 9 fmt.Println(err) 10 os.Exit(1) 11 } 12 13 // Search config in home directory with name ".zwc" (without extension). 14 viper.AddConfigPath(home) 15 viper.SetConfigName(".zwc") 16 } 17 18 viper.AutomaticEnv() // read in environment variables that match 19 20 // If a config file is found, read it in. 21 if err := viper.ReadInConfig(); err != nil { 22 log.Fatal(err) 23 } 24 25 fmt.Println("Using config file:", viper.ConfigFileUsed()) 26}
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:
1$ cobra init 2 3$ tree -L 2 4. 5├── LICENSE 6├── cmd 7│ └── root.go 8├── main.go
Create event
command:
1$ cobra add event 2$ cobra add insert -p 'eventCmd' 3 4$ tree -L 2 5. 6├── LICENSE 7├── cmd 8│ ├── event.go 9│ ├── event_insert.go 10│ └── root.go 11├── main.go