<commit_before>package main

import (
	"fmt"
	"net/url"
	"os"
	"strings"
	"time"

	"github.com/bgentry/heroku-go"
	"github.com/bgentry/speakeasy"
	"github.com/heroku/hk/hkclient"
	"github.com/heroku/hk/term"
)

var cmdAuthorize = &Command{
	Run:      runAuthorize,
	Usage:    "authorize",
	Category: "hk",
	Short:    "procure a temporary privileged token" + extra,
	Long: `
Have heroku-agent procure and store a temporary privileged token
that will bypass any requirement for a second authentication factor.

Example:

    $ hk authorize
    Enter email: <EMAIL>
	Enter two-factor auth code: 
    Authorization successful.
`,
}

func runAuthorize(cmd *Command, args []string) {
	if len(args) != 0 {
		cmd.PrintUsage()
		os.Exit(2)
	}

	if os.Getenv("HEROKU_AGENT_SOCK") == "" {
		printFatal("Authorize must be used with heroku-agent; please set " +
			"HEROKU_AGENT_SOCK")
	}

	var twoFactorCode string
	fmt.Printf("Enter two-factor auth code: ")
	if _, err := fmt.Scanln(&twoFactorCode); err != nil {
		printFatal("reading two-factor auth code: " + err.Error())
	}

	client.AdditionalHeaders.Set("Heroku-Two-Factor-Code", twoFactorCode)

	// no-op: GET /apps with max=0
	_, err := client.AppList(&heroku.ListRange{Field: "name", Max: 0})
	must(err)

	fmt.Println("Authorization successful.")
}

var cmdCreds = &Command{
	Run:      runCreds,
	Usage:    "creds",
	Category: "hk",
	Short:    "show credentials" + extra,
	Long:     `Creds shows credentials that will be used for API calls.`,
}

func runCreds(cmd *Command, args []string) {
	var err error
<commit_msg>Flex out the explanatory comment on this no-op<commit_after>package main

import (
	"fmt"
	"net/url"
	"os"
	"strings"
	"time"

	"github.com/bgentry/heroku-go"
	"github.com/bgentry/speakeasy"
	"github.com/heroku/hk/hkclient"
	"github.com/heroku/hk/term"
)

var cmdAuthorize = &Command{
	Run:      runAuthorize,
	Usage:    "authorize",
	Category: "hk",
	Short:    "procure a temporary privileged token" + extra,
	Long: `
Have heroku-agent procure and store a temporary privileged token
that will bypass any requirement for a second authentication factor.

Example:

    $ hk authorize
    Enter email: <EMAIL>
	Enter two-factor auth code: 
    Authorization successful.
`,
}

func runAuthorize(cmd *Command, args []string) {
	if len(args) != 0 {
		cmd.PrintUsage()
		os.Exit(2)
	}

	if os.Getenv("HEROKU_AGENT_SOCK") == "" {
		printFatal("Authorize must be used with heroku-agent; please set " +
			"HEROKU_AGENT_SOCK")
	}

	var twoFactorCode string
	fmt.Printf("Enter two-factor auth code: ")
	if _, err := fmt.Scanln(&twoFactorCode); err != nil {
		printFatal("reading two-factor auth code: " + err.Error())
	}

	client.AdditionalHeaders.Set("Heroku-Two-Factor-Code", twoFactorCode)

	// No-op: GET /apps with max=0. heroku-agent will detect that a two-factor
	// code was included and attempt to procure a temporary token. This token
	// will then be re-used automatically on subsequent requests.
	_, err := client.AppList(&heroku.ListRange{Field: "name", Max: 0})
	must(err)

	fmt.Println("Authorization successful.")
}

var cmdCreds = &Command{
	Run:      runCreds,
	Usage:    "creds",
	Category: "hk",
	Short:    "show credentials" + extra,
	Long:     `Creds shows credentials that will be used for API calls.`,
}

func runCreds(cmd *Command, args []string) {
	var err error

{'fraction_non_alphanumeric': 0.1295243793000299, 'fraction_numerical': 0.0023930601256356566, 'mean_word_length': 3.8675400291120816, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2661061', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1157, 'n_words': 323}