scafall

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Scafall creates new source projects from project templates. Project templates are stored in git repositories and new source projects are created on your local filesystem.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Scafall)

func WithArguments

func WithArguments(arguments map[string]string) Option

Set values for each variable as key-value pairs.

func WithOutputFolder

func WithOutputFolder(folder string) Option

Set the output folder in which to create scaffold a template.

func WithSubPath

func WithSubPath(subPath string) Option

Use a sub folder within the template repository as the source for a template.

type Scafall

type Scafall struct {
	URL          string
	Arguments    map[string]string
	OutputFolder string
	SubPath      string
	CloneCache   string
}

Scafall allows programmatic control over the default values for variables. Any provided Arguments cause prompts for the same variable name to be skipped.

func NewScafall

func NewScafall(url string, opts ...Option) (Scafall, error)

Create a new Scafall with the given options.

func (Scafall) Scaffold

func (s Scafall) Scaffold() error

Scaffold accepts url containing project templates and creates an output project. The url can either point to a project template or a collection of project templates.

Example

Create a new project from a project template

s, _ := NewScafall("http://github.com/AidanDelaney/scafall-python-eg.git",
	WithOutputFolder("python-pi"))

s.Scaffold()
Output:

Example (Arguments)
arguments := map[string]string{
	"PythonVersion": "python3.10",
}
s, _ := NewScafall("http://github.com/AidanDelaney/scafall-python-eg.git",
	WithArguments(arguments),
	WithOutputFolder("python-pi"))

// User is not prompted for PythonVersion
s.Scaffold()
Output:

func (Scafall) TemplateArguments

func (s Scafall) TemplateArguments() (string, []string, error)

TemplateArguments returns a list of variable names that can be passed to the template

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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