Prepare encrypt/decrypt commands (#2)
This commit is contained in:
parent
dc9594c3f8
commit
f3cf37bdb0
|
@ -9,12 +9,14 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
rootCmd := cobra.Command{
|
||||
rootCmd := &cobra.Command{
|
||||
Use: "calanonsync",
|
||||
Short: "Synchronize a calendar from EWS to CalDAV by event time and an anonymized title only.",
|
||||
Run: runSynchronization,
|
||||
}
|
||||
|
||||
rootCmd.AddCommand(InitSettingsCmd())
|
||||
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
|
|
|
@ -2,6 +2,8 @@ package main
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/spf13/cobra"
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
"os"
|
||||
"strings"
|
||||
|
@ -58,3 +60,33 @@ func LoadSettings() Settings {
|
|||
|
||||
return settings
|
||||
}
|
||||
|
||||
func InitSettingsCmd() *cobra.Command {
|
||||
settingsCmd := &cobra.Command{
|
||||
Use: "settings",
|
||||
Short: "Manage settings.",
|
||||
}
|
||||
|
||||
encryptCmd := &cobra.Command{
|
||||
Use: "encrypt",
|
||||
Short: "Encrypt the passwords in the settings file.",
|
||||
Long: `This will encrypt the passwords in the settings file that are
|
||||
not empty. It will generate a new "master" password and store that alongside
|
||||
the settings file. This is NOT secure, it just helps to prevent
|
||||
over-the-shoulder "attacks".`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("Encrypt")
|
||||
},
|
||||
}
|
||||
|
||||
decryptCmd := &cobra.Command{
|
||||
Use: "decrypt",
|
||||
Short: "Decrypt a previously encrypted settings file.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println("Decrypt")
|
||||
},
|
||||
}
|
||||
|
||||
settingsCmd.AddCommand(encryptCmd, decryptCmd)
|
||||
return settingsCmd
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue