Commit a3ab18e3 authored by Tamer Tas's avatar Tamer Tas
Browse files

Fix documentation errors of linter

parent 93c3bd02
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -13,34 +13,34 @@ import (
)

const (
	// Name of the application
	// AppName of the application
	AppName = "boilr"

	// Version of the application
	Version = "0.1.0"

	// Configuration Directory of the application
	// ConfigDirPath is the configuration directory of the application
	ConfigDirPath = ".config/boilr"

	// Configuration File Name of the application
	// ConfigFileName is the configuration file name of the application
	ConfigFileName = "config.json"

	// Directory that contains the template registry
	// TemplateDir is the directory that contains the template registry
	TemplateDir = "templates"

	// Name of the file that contains the context values for the template
	// ContextFileName is the name of the file that contains the context values for the template
	ContextFileName = "project.json"

	// Name of the directory that contains the template files in a boilr template
	// TemplateDirName is the name of the directory that contains the template files in a boilr template
	TemplateDirName = "template"

	// Name of the file that contains the metadata about the template saved in registry
	// TemplateMetadataName is the name of the file that contains the metadata about the template saved in registry
	TemplateMetadataName = "__metadata.json"

	// Owner of the github repository
	// GithubOwner is the owner of the github repository
	GithubOwner = "tmrts"

	// Name of the github repository
	// GithubRepo is the name of the github repository
	GithubRepo = "boilr"
)

+1 −1
Original line number Diff line number Diff line
@@ -3,6 +3,6 @@ package boilr
import "errors"

var (
	// Indicates that a template is already present in the local registry.
	// ErrTemplateAlreadyExists indicates that a template is already present in the local registry.
	ErrTemplateAlreadyExists = errors.New("boilr: project template already exists")
)
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ import (
)

var (
	// Indicates that the local template registry is not initialized for boilr.
	// ErrUninitializedboilrDir indicates that the local template registry is not initialized for boilr.
	ErrUninitializedboilrDir = errors.New("boilr: .boilr directory is not initialized")
)

+11 −12
Original line number Diff line number Diff line
@@ -19,21 +19,21 @@ import (
	"github.com/tmrts/boilr/pkg/util/validate"
)

type Transport struct {
type transport struct {
	Username string
	Password string
}

func (t Transport) RoundTrip(req *http.Request) (*http.Response, error) {
func (t transport) RoundTrip(req *http.Request) (*http.Response, error) {
	req.SetBasicAuth(t.Username, t.Password)
	return http.DefaultTransport.RoundTrip(req)
}

func (t *Transport) Client() *http.Client {
func (t *transport) Client() *http.Client {
	return &http.Client{Transport: t}
}

func readPassword() (Transport, error) {
func readPassword() (transport, error) {
	var name string
	fmt.Printf("Username for github: ")
	fmt.Scanf("%s", &name)
@@ -41,11 +41,11 @@ func readPassword() (Transport, error) {
	fmt.Printf("Password for %s: ", name)
	pass, err := terminal.ReadPassword(int(os.Stdin.Fd()))
	if err != nil {
		return Transport{}, err
		return transport{}, err
	}
	fmt.Println()

	return Transport{
	return transport{
		Username: name,
		Password: string(pass),
	}, nil
@@ -55,9 +55,8 @@ func getIssue() (*github.IssueRequest, error) {
	dir, err := ioutil.TempDir("", "boilr-report")
	if err != nil {
		return nil, err
	} else {
		defer os.RemoveAll(dir)
	}
	defer os.RemoveAll(dir)

	fname := filepath.Join(dir, "issue.markdown")

@@ -90,9 +89,8 @@ func getIssue() (*github.IssueRequest, error) {
	issueFile, err := os.Open(fname)
	if err != nil {
		return nil, err
	} else {
		defer issueFile.Close()
	}
	defer issueFile.Close()

	buf, err := ioutil.ReadAll(issueFile)
	if err != nil {
@@ -120,7 +118,7 @@ func getIssue() (*github.IssueRequest, error) {
	}, nil
}

func CreateIssue() (string, error) {
func createIssue() (string, error) {
	req, err := getIssue()
	if err != nil {
		return "", err
@@ -140,13 +138,14 @@ func CreateIssue() (string, error) {
	return *issue.HTMLURL, nil
}

// Report contains the cli-command for creating github issues.
var Report = &cli.Command{
	Use:   "report",
	Short: "Creates an issue in the github repository",
	Run: func(c *cli.Command, args []string) {
		MustValidateArgs(args, []validate.Argument{})

		url, err := CreateIssue()
		url, err := createIssue()
		if err != nil {
			exit.Error(fmt.Errorf("Failed to create an issue: %v", err))
		}
+3 −1
Original line number Diff line number Diff line
@@ -9,9 +9,11 @@ var Root = &cli.Command{

// Run executes the cli-command root.
func Run() {
	// TODO add loading bars or progress bars to commands that take time
	// TODO trap c-c to rollback transactions
	// TODO use command factories instead of global command variables
	// TODO add describe command that shows template metadata information
	// TODO add create command that creates a minimal template template
	// TODO rename template-name to template-tag
	Init.PersistentFlags().BoolP("force", "f", false, "Recreate directories if they exist")
	Root.AddCommand(Init)

Loading