cmd

package
v0.0.0-...-f567d1f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "filetest",
	Short: "Runs tests against files/file system",

	Run: func(cmd *cobra.Command, args []string) {
		err := Run(configPath)
		if err != nil {
			color.Red(err.Error())
			os.Exit(-1)
		}
		if len(errs) > 0 {
			color.Red("There were %d test failures:\n", len(errs))
			for _, e := range errs {
				color.Red("\t%s\n", e.Error())
			}
			os.Exit(-1)
		}
		color.Green("All of your tests have passed with flying colors!")
	},
}

RootCmd represents the base command when called without any subcommands

Functions

func Add

func Add(err error) error

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func Run

func Run(path string) error

func RunDir

func RunDir(path string) error

func RunFile

func RunFile(path string) error

Types

type File

type File struct {
	Path        string   `json:"path"`
	Contains    []string `json:"contains"`
	NotContains []string `json:"!contains"`
	EqualsPath  string   `json:"equals_path"`
	Absent      bool     `json:"absent"`
	Count       int      `json:"count"`
}

File represents a file inside the test json.

func (File) Test

func (f File) Test() error

type Files

type Files []File

Files represents a slice of File

func (Files) Test

func (ff Files) Test() error

Test calls Test for each of the Files in the File slice.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL