strategies

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Copyright 2025 The Hulo Authors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Copyright 2025 The Hulo Authors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Copyright 2025 The Hulo Authors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Index

Constants

View Source
const (
	PriorityCompile int = iota
	PriorityVersion
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CompileStrategy

type CompileStrategy struct{}

func (*CompileStrategy) CanHandle

func (c *CompileStrategy) CanHandle(params *Parameters) bool

func (*CompileStrategy) Execute

func (c *CompileStrategy) Execute(params *Parameters, args []string) error

func (*CompileStrategy) Priority

func (c *CompileStrategy) Priority() int

type Parameters

type Parameters struct {
	// Langs is the language to compile.
	// if not set, all languages will be compiled
	Langs []string
	// Verbose is the Verbose mode
	Verbose bool
	// Version is the Version of the compiler
	Version bool
	// OutDir is the directory to write the output
	OutDir string

	// Args is the arguments for the strategy
	Args []string
}

Parameters is the parameters for the hulo command

type Strategy

type Strategy interface {
	// CanHandle checks if the strategy can handle the given parameters
	CanHandle(params *Parameters) bool
	// Execute executes the strategy with the given parameters and arguments
	Execute(params *Parameters, args []string) error
	// Priority returns the priority of the strategy and the higher the number, the higher the priority
	Priority() int
}

Strategy is the interface for the strategies

type StrategyRegistry

type StrategyRegistry struct {
	// contains filtered or unexported fields
}

StrategyRegistry is the registry for the strategies

func NewStrategyRegistry

func NewStrategyRegistry() *StrategyRegistry

func (*StrategyRegistry) FindStrategy

func (r *StrategyRegistry) FindStrategy(params *Parameters) Strategy

func (*StrategyRegistry) Register

func (r *StrategyRegistry) Register(s Strategy)

type VersionStrategy

type VersionStrategy struct{}

func (*VersionStrategy) CanHandle

func (v *VersionStrategy) CanHandle(params *Parameters) bool

func (*VersionStrategy) Execute

func (v *VersionStrategy) Execute(params *Parameters, args []string) error

func (*VersionStrategy) Priority

func (v *VersionStrategy) Priority() int

Jump to

Keyboard shortcuts

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