goldwarden/cmd/autofill.go

28 lines
561 B
Go
Raw Normal View History

2023-12-23 09:18:30 +03:00
//go:build linux
2023-07-17 04:23:26 +03:00
package cmd
import (
"os"
2023-12-23 09:18:30 +03:00
"github.com/quexten/goldwarden/autotype"
2023-07-17 04:23:26 +03:00
"github.com/spf13/cobra"
)
var autofillCmd = &cobra.Command{
2023-12-23 09:18:30 +03:00
Use: "autotype",
Short: "Autotype credentials",
Long: `Autotype credentials`,
2023-07-17 04:23:26 +03:00
Run: func(cmd *cobra.Command, args []string) {
2023-12-23 09:18:30 +03:00
username, _ := cmd.Flags().GetString("username")
// get pasword from env
password := os.Getenv("PASSWORD")
2023-12-23 09:18:30 +03:00
autotype.TypeString(username + "\t" + password)
2023-07-17 04:23:26 +03:00
},
}
func init() {
rootCmd.AddCommand(autofillCmd)
2023-12-23 09:18:30 +03:00
autofillCmd.PersistentFlags().String("username", "", "")
2023-07-17 04:23:26 +03:00
}