<commit_before>package cli

import (
	"crypto/sha256"
	"encoding/hex"
	"encoding/json"
	"fmt"
	"os"
	"strings"
	"time"

	"github.com/pgpst/pgpst/internal/github.com/asaskevich/govalidator"
	"github.com/pgpst/pgpst/internal/github.com/codegangsta/cli"
	r "github.com/pgpst/pgpst/internal/github.com/dancannon/gorethink"
	"github.com/pgpst/pgpst/internal/github.com/dchest/uniuri"
	"github.com/pgpst/pgpst/internal/github.com/pzduniak/termtables"

	"github.com/pgpst/pgpst/pkg/models"
	"github.com/pgpst/pgpst/pkg/utils"
)

func accountsAdd(c *cli.Context) {
	// Connect to RethinkDB
	_, session, connected := connectToRethinkDB(c)
	if !connected {
		return
	}

	// Input struct
	var input struct {
		MainAddress  string `json:"main_address"`
		Password     string `json:"password"`
		Subscription string `json:"subscription"`
		AltEmail     string `json:"alt_email"`
		Status       string `json:"status"`
	}

	// Read JSON from stdin
	if c.Bool("json") {
		if err := json.NewDecoder(os.Stdin).Decode(&input); err != nil {
			writeError(err)
			return
		}
	} else {
		// Acquire from interactive input
		fmt.Print("Main address: ")
		if _, err := fmt.Scanln(&input.MainAddress); err != nil {
			writeError(err)
			return
		}

		password, err := utils.AskPassword("Password: ")
		if err != nil {
			writeError(err)
			return
		}
		input.Password = password

		fmt.Print("Subscription [beta/admin]: ")
		if _, err := fmt.Scanln(&input.Subscription); err != nil {
			writeError(err)
			return
		}
<commit_msg>Completely moved to own fork of speakeasy<commit_after>package cli

import (
	"crypto/sha256"
	"encoding/hex"
	"encoding/json"
	"fmt"
	"os"
	"strings"
	"time"

	"github.com/pgpst/pgpst/internal/github.com/asaskevich/govalidator"
	"github.com/pgpst/pgpst/internal/github.com/codegangsta/cli"
	r "github.com/pgpst/pgpst/internal/github.com/dancannon/gorethink"
	"github.com/pgpst/pgpst/internal/github.com/dchest/uniuri"
	"github.com/pgpst/pgpst/internal/github.com/pzduniak/termtables"
	"github.com/pzduniak/speakeasy"

	"github.com/pgpst/pgpst/pkg/models"
	"github.com/pgpst/pgpst/pkg/utils"
)

func accountsAdd(c *cli.Context) {
	// Connect to RethinkDB
	_, session, connected := connectToRethinkDB(c)
	if !connected {
		return
	}

	// Input struct
	var input struct {
		MainAddress  string `json:"main_address"`
		Password     string `json:"password"`
		Subscription string `json:"subscription"`
		AltEmail     string `json:"alt_email"`
		Status       string `json:"status"`
	}

	// Read JSON from stdin
	if c.Bool("json") {
		if err := json.NewDecoder(os.Stdin).Decode(&input); err != nil {
			writeError(err)
			return
		}
	} else {
		// Acquire from interactive input
		fmt.Print("Main address: ")
		if _, err := fmt.Scanln(&input.MainAddress); err != nil {
			writeError(err)
			return
		}

		password, err := speakeasy.Ask("Password: ")
		if err != nil {
			writeError(err)
			return
		}
		input.Password = password

		fmt.Print("Subscription [beta/admin]: ")
		if _, err := fmt.Scanln(&input.Subscription); err != nil {
			writeError(err)
			return
		}

{'fraction_non_alphanumeric': 0.1464926590538336, 'fraction_numerical': 0.001957585644371941, 'mean_word_length': 3.7314814814814814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4469628', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1154, 'n_words': 199}