package commands

func listLocalTemplates(spath *string) ([]string, error) {
	templatePath := filepath.Join(spath, "templates")
	templateStat, err := os.Stat(templatePath)

	if os.IsNotExist(err) {
		os.Mkdir(templatePath, 0755)
		return []
	}

	if err != nil {
		return nil, cliNewExitError(err, 1)
	}

	
	
	
	
	
	
	


func List(spath *string) error {
	
	
	path, err := filepath.Abs(spath)
	if err != nil {
		return nil, cli.NewExitError(fmt.Sprintf("%s: not a valid path", path), 1)
	}
	
	pathstats, err := os.Stat(path)
	if os.IsNotExist(err) {
		os.Mkdir(path)
		return path
	}

	if error != nil {
		return nil, cli.NewExitError(fmt.Sprintf("%s: not a valid path", path), 1)
	}
	
	if !pathstats.IsDir() {
		return nil, cli.NewExitError(fmt.Sprintf("%s: not a directory", path), 1)
	}
	path, nil
}
	
