command

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultProjectName       = "MyProject"
	DefaultProjectNamespace  = "my_namespace"
	DefaultProjectEntrypoint = "src/main.mcb"
)

Variables

View Source
var BuildCommand = &cli.Command{
	Name:  "build",
	Usage: "Compile the project into a datapack",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:  "config",
			Value: "project.toml",
			Usage: "Path to the project config file",
		},
		&cli.StringFlag{
			Name:  "output",
			Value: "build",
			Usage: "Output directory. The resulting datapack will be inside this directory as <output>/<project_name>",
		},
		&cli.BoolFlag{
			Name:  "enable-traces",
			Value: false,
			Usage: "Enable traces",
		},
	},
	Action: func(ctx context.Context, cmd *cli.Command) error {
		data := ctx.Value("data").(*Data)
		return Build(cmd, data.Stdlib, data.Embedded)
	},
}
View Source
var InitCommand = &cli.Command{
	Name:  "init",
	Usage: "Initialize a new project",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:  "project-name",
			Value: DefaultProjectName,
			Usage: "Name of the project",
		},
		&cli.StringFlag{
			Name:  "namespace",
			Value: DefaultProjectNamespace,
			Usage: "Namespace of the project",
		},
		&cli.StringFlag{
			Name:  "entrypoint",
			Value: DefaultProjectEntrypoint,
			Usage: "Entrypoint of the project. The compiler will look for this file to start compiling",
		},
		&cli.BoolFlag{
			Name:  "force",
			Value: false,
			Usage: "Force overwrite existing files",
		},
		&gitInitFlag,
	},
	Action: func(ctx context.Context, cmd *cli.Command) error {
		return Init(cmd)
	},
}

Functions

func Build

func Build(cmd *cli.Command, builtinHeaders, libs embed.FS) error

func DebugFlagHandler added in v0.0.6

func DebugFlagHandler(cmd *cli.Command)

func Init

func Init(cmd *cli.Command) error

Types

type Data added in v0.0.6

type Data struct {
	Stdlib   embed.FS
	Embedded embed.FS
}

Jump to

Keyboard shortcuts

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