<commit_before>package cmd

import (
	"log"
	"strings"

	"github.com/codegangsta/cli"
	"github.com/crackcomm/ovh"
	"golang.org/x/net/context"
)

var cmdDomainsSet = cli.Command{
	Name:      "set",
	Usage:     "sets domain name server option",
	ArgsUsage: "[--all] [<domain> [<domain> ...]]",
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "all",
			Usage: "applies settings to all domains on account",
		},
		cli.StringFlag{
			Name:  "name_server_type",
			Usage: "changes domain name server type (external or hosted)",
		},
		cli.StringFlag{
			Name:  "transfer_lock_status",
			Usage: "changes domain transfer lock status (locked or unlocked)",
		},
	},
	Action: func(c *cli.Context) {
		if len(c.Args()) == 0 && !c.Bool("all") {
			log.Fatal("You have to use --all or provide list of domains in arguments.")
		} else if len(c.Args()) > 0 && c.Bool("all") {
			log.Fatal("Cannot use --all with list of domains")
		}

		client := client(c)
		ctx := context.Background()
		patch := &ovh.DomainPatch{
			NameServerType:     c.String("name_server_type"),
			TransferLockStatus: c.String("transfer_lock_status"),
		}

		if v := patch.NameServerType; v != "" {
			log.Printf("Changing name server type to %q", v)
		}
		if v := patch.TransferLockStatus; v != "" {
			log.Printf("Changing transfer lock status to %q", v)
		}

		for _, domain := range domainsFromCtx(c) {
			log.Printf("Updating %s", domain)<commit_msg>cmd: fix domains set command flags style<commit_after>package cmd

import (
	"log"
	"strings"

	"github.com/codegangsta/cli"
	"github.com/crackcomm/ovh"
	"golang.org/x/net/context"
)

var cmdDomainsSet = cli.Command{
	Name:      "set",
	Usage:     "sets domain name server option",
	ArgsUsage: "[--all] [<domain> [<domain> ...]]",
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "all",
			Usage: "applies settings to all domains on account",
		},
		cli.StringFlag{
			Name:  "name-server-type",
			Usage: "changes domain name server type (external or hosted)",
		},
		cli.StringFlag{
			Name:  "transfer-lock-status",
			Usage: "changes domain transfer lock status (locked or unlocked)",
		},
	},
	Action: func(c *cli.Context) {
		if len(c.Args()) == 0 && !c.Bool("all") {
			log.Fatal("You have to use --all or provide list of domains in arguments.")
		} else if len(c.Args()) > 0 && c.Bool("all") {
			log.Fatal("Cannot use --all with list of domains")
		}

		client := client(c)
		ctx := context.Background()
		patch := &ovh.DomainPatch{
			NameServerType:     c.String("name-server-type"),
			TransferLockStatus: c.String("transfer-lock-status"),
		}

		if v := patch.NameServerType; v != "" {
			log.Printf("Changing name server type to %q", v)
		}
		if v := patch.TransferLockStatus; v != "" {
			log.Printf("Changing transfer lock status to %q", v)
		}

		for _, domain := range domainsFromCtx(c) {
			log.Printf("Updating %s", domain)
{'fraction_non_alphanumeric': 0.1650893796004206, 'fraction_numerical': 0.0014020329477742728, 'mean_word_length': 3.4663536776212833, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '7527144', 'n_tokens_mistral': 1096, 'n_tokens_neox': 988, 'n_words': 265}