<commit_before>// Copyright 2014 tsuru authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"errors"
	"github.com/tsuru/tsuru/cmd"
	"launchpad.net/gnuflag"
	"net/http"
    "fmt"
    "strings"
)

type platformAdd struct {
	name       string
	dockerfile string
	fs         *gnuflag.FlagSet
}

func (p *platformAdd) Info() *cmd.Info {
	return &cmd.Info{
		Name:    "platform-add",
		Usage:   "platform-add [platform name] [--dockerfile/-d Dockerfile]",
		Desc:    "Add new platform to tsuru.",
		MinArgs: 2,
	}
}

func (p *platformAdd) Run(context *cmd.Context, client *cmd.Client) error {
	name := context.Args[0]
	if name == "" {
		return errors.New("The platform's name required.")
	}

	if p.dockerfile == "" {
		return errors.New("The Dockerfile doens't exists.")
	}

    body := fmt.Sprintf("name=%s&dockerfile=%s", name, p.dockerfile)

	request, err := http.NewRequest("PUT", "/platform/add", strings.NewReader(body))
	if err != nil {
		return err
	}

	_, err = client.Do(request)
	if err != nil {
		return err
	}

	return nil
}

func (p *platformAdd) Flags() *gnuflag.FlagSet {
    message := "The dockerfile url to create a platform"
	if p.fs == nil {
		p.fs = gnuflag.NewFlagSet("platform-add", gnuflag.ExitOnError)
		p.fs.StringVar(&p.dockerfile, "dockerfile", "", message)
		p.fs.StringVar(&p.dockerfile, "d", "", message)
	}

	return p.fs
}
<commit_msg>add success message to stdout in platform-add command<commit_after>// Copyright 2014 tsuru authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"errors"
	"github.com/tsuru/tsuru/cmd"
	"launchpad.net/gnuflag"
	"net/http"
    "fmt"
    "strings"
)

type platformAdd struct {
	name       string
	dockerfile string
	fs         *gnuflag.FlagSet
}

func (p *platformAdd) Info() *cmd.Info {
	return &cmd.Info{
		Name:    "platform-add",
		Usage:   "platform-add [platform name] [--dockerfile/-d Dockerfile]",
		Desc:    "Add new platform to tsuru.",
		MinArgs: 2,
	}
}

func (p *platformAdd) Run(context *cmd.Context, client *cmd.Client) error {
	name := context.Args[0]
	if name == "" {
		return errors.New("The platform's name required.")
	}

	if p.dockerfile == "" {
		return errors.New("The Dockerfile doens't exists.")
	}

    body := fmt.Sprintf("name=%s&dockerfile=%s", name, p.dockerfile)
	request, err := http.NewRequest("PUT", "/platform/add", strings.NewReader(body))
	if err != nil {
		return err
	}

	_, err = client.Do(request)
	if err != nil {
		return err
	}

	fmt.Fprintf(context.Stdout, "Platform successfully added!\n")
	return nil
}

func (p *platformAdd) Flags() *gnuflag.FlagSet {
    message := "The dockerfile url to create a platform"
	if p.fs == nil {
		p.fs = gnuflag.NewFlagSet("platform-add", gnuflag.ExitOnError)
		p.fs.StringVar(&p.dockerfile, "dockerfile", "", message)
		p.fs.StringVar(&p.dockerfile, "d", "", message)
	}

	return p.fs
}

{'fraction_non_alphanumeric': 0.14812376563528637, 'fraction_numerical': 0.003949967083607637, 'mean_word_length': 3.4691176470588236, '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': '5192999', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1059, 'n_words': 295}