<commit_before>package cmd

import (
	"github.com/aws/aws-sdk-go/aws"
	"github.com/pkg/errors"
	"github.com/spf13/cobra"
	"github.com/spf13/viper"

	"github.com/minamijoyo/myaws/myaws"
)

func init() {
	RootCmd.AddCommand(newECRCmd())
}

func newECRCmd() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "ecr",
		Short: "Manage ECR resources",
		Run: func(cmd *cobra.Command, args []string) {
			cmd.Help()
		},
	}

	cmd.AddCommand(
		newECRGetLoginCmd(),
	)

	return cmd
}

func newECRGetLoginCmd() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "get-login",
		Short: "Get docker login command for ECR",
		RunE:  runECRGetLoginCmd,
	}

	flags := cmd.Flags()
	flags.StringSliceP("registry-ids", "r", []string{}, "A list of AWS account IDs")

	viper.BindPFlag("ecr.parameter.get-login.registry-ids", flags.Lookup("registry-ids"))

	return cmd
}

func runECRGetLoginCmd(cmd *cobra.Command, args []string) error {
	client, err := newClient()
	if err != nil {
		return errors.Wrap(err, "newClient failed:")
	}

	registryIds := aws.StringSlice(viper.GetStringSlice("ecr.parameter.get-login.registry-ids"))
	options := myaws.ECRGetLoginOptions{
		RegistryIds: registryIds,
	}

	return client.ECRGetLogin(options)
}
<commit_msg>Fix wrong viper parameter for ecs.get-login<commit_after>package cmd

import (
	"github.com/aws/aws-sdk-go/aws"
	"github.com/pkg/errors"
	"github.com/spf13/cobra"
	"github.com/spf13/viper"

	"github.com/minamijoyo/myaws/myaws"
)

func init() {
	RootCmd.AddCommand(newECRCmd())
}

func newECRCmd() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "ecr",
		Short: "Manage ECR resources",
		Run: func(cmd *cobra.Command, args []string) {
			cmd.Help()
		},
	}

	cmd.AddCommand(
		newECRGetLoginCmd(),
	)

	return cmd
}

func newECRGetLoginCmd() *cobra.Command {
	cmd := &cobra.Command{
		Use:   "get-login",
		Short: "Get docker login command for ECR",
		RunE:  runECRGetLoginCmd,
	}

	flags := cmd.Flags()
	flags.StringSliceP("registry-ids", "r", []string{}, "A list of AWS account IDs")

	viper.BindPFlag("ecr.get-login.registry-ids", flags.Lookup("registry-ids"))

	return cmd
}

func runECRGetLoginCmd(cmd *cobra.Command, args []string) error {
	client, err := newClient()
	if err != nil {
		return errors.Wrap(err, "newClient failed:")
	}

	registryIds := aws.StringSlice(viper.GetStringSlice("ecr.get-login.registry-ids"))
	options := myaws.ECRGetLoginOptions{
		RegistryIds: registryIds,
	}

	return client.ECRGetLogin(options)
}

{'fraction_non_alphanumeric': 0.15853658536585366, 'fraction_numerical': 0.0032520325203252032, 'mean_word_length': 4.35, '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': '3977137', 'n_tokens_mistral': 1012, 'n_tokens_neox': 963, 'n_words': 179}