file

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InjectPrefix = prefix + "INJECT"
	ModulePrefix = prefix + "HAS_MODULE"

	IgnorePattern       = prefix + "IGNORE" + suffix
	GenerateOncePattern = prefix + "GENERATE_ONCE" + suffix
)
View Source
const (
	HeaderContent = "Content managed by Project Forge, see [projectforge.md] for details."
)

Variables

View Source
var (
	TypeBatch        = Type{Key: "batch", Suffixes: []string{".bat"}, Title: "Windows batch file"}
	TypeCodeowners   = Type{Key: "codeowners", Suffixes: []string{"CODEOWNERS"}, Title: "Code owners source control file"}
	TypeConf         = Type{Key: "conf", Suffixes: []string{".conf"}, Title: "Configuration file"}
	TypeCS           = Type{Key: "cs", Suffixes: []string{util.ExtCS}, Title: "C# source code"}
	TypeCSHTML       = Type{Key: "cshtml", Suffixes: []string{util.ExtCSHTML}, Title: "C# HTML template"}
	TypeCSS          = Type{Key: "css", Suffixes: []string{util.ExtCSS}, Title: "Cascading Stylesheet"}
	TypeDocker       = Type{Key: "docker", Suffixes: dockerfileSuffixes, Title: "Docker build configuration"}
	TypeDockerIgnore = Type{Key: "dockerignore", Suffixes: []string{".dockerignore"}, Title: "Docker ignore configuration"}
	TypeEditorConfig = Type{Key: "editorconfig", Suffixes: []string{".editorconfig"}, Title: "IDE configuration and styling"}
	TypeEntitlements = Type{Key: "entitlements", Suffixes: []string{".entitlements"}, Title: "Apple entitlements file"}
	TypeEnv          = Type{Key: "env", Suffixes: []string{".env"}, Title: "Shell environment files"}
	TypeESLint       = Type{Key: "eslint", Suffixes: []string{".eslintrc"}, Title: "ESLint configuration file"}
	TypeGitIgnore    = Type{Key: "gitignore", Suffixes: []string{".gitignore"}, Title: "Git ignore file"}
	TypeGo           = Type{Key: "go", Suffixes: []string{util.ExtGo}, Title: "Go source"}
	TypeGoMod        = Type{Key: "gomod", Suffixes: []string{util.ExtMod}, Title: "Go module configuration"}
	TypeGradle       = Type{Key: "gradle", Suffixes: []string{".gradle"}, Title: "Gradle build or source file"}
	TypeGraphQL      = Type{Key: "graphql", Suffixes: []string{".graphql", ".graphqls"}, Title: "Query and schema files for GraphQL"}
	TypeHCL          = Type{Key: "hcl", Suffixes: []string{".hcl"}, Title: "HashiCorp Configuration Language"}
	TypeHTML         = Type{Key: "html", Suffixes: []string{util.ExtHTML, ".htm"}, Title: "HTML web page"}
	TypeIgnore       = Type{Key: "dockerignore", Suffixes: []string{".dockerignore"}, Title: "Docker ignore file"}
	TypeIcons        = Type{Key: "icons", Suffixes: []string{".icns"}, Title: "Apple icon collection"}
	TypeJavaScript   = Type{Key: "javascript", Suffixes: []string{util.ExtJS, ".javascript"}, Title: "JavaScript source"}
	TypeJSON         = Type{Key: "json", Suffixes: []string{util.ExtJSON}, Title: "JavaScript Object Notation"}
	TypeKotlin       = Type{Key: "kotlin", Suffixes: []string{".kt"}, Title: "Kotlin source file"}
	TypeMakefile     = Type{Key: "makefile", Suffixes: []string{"Makefile", "makefile"}, Title: "Build file"}
	TypeMarkdown     = Type{Key: "markdown", Suffixes: []string{util.ExtMarkdown, ".markdown"}, Title: "Markdown document"}
	TypePList        = Type{Key: "plist", Suffixes: []string{".plist"}, Title: "Apple configuration plist"}
	TypeProperties   = Type{Key: "properties", Suffixes: []string{".properties"}, Title: "Java properties file"}
	TypeProtobuf     = Type{Key: "protobuf", Suffixes: []string{".proto"}, Title: "Protobuf definition"}
	TypePython       = Type{Key: "python", Suffixes: []string{".py"}, Title: "Python source file"}
	TypeShell        = Type{Key: "shell", Suffixes: []string{".sh"}, Title: "Shell script"}
	TypeSQL          = Type{Key: "sql", Suffixes: []string{util.ExtSQL}, Title: "SQL query file"}
	TypeSVG          = Type{Key: "svg", Suffixes: []string{util.ExtSVG}, Title: "Simple Vector Graphics file"}
	TypeSwift        = Type{Key: "swift", Suffixes: []string{".swift"}, Title: "Swift source file"}
	TypeTypeScript   = Type{Key: "typescript", Suffixes: []string{util.ExtTS}, Title: "TypeScript source"}
	TypeXML          = Type{Key: "xml", Suffixes: []string{".xml"}, Title: "XML document"}
	TypeYAML         = Type{Key: "yaml", Suffixes: []string{".yml", ".yaml"}, Title: "YAML configuration source"}
)

Functions

func ContainsHeader

func ContainsHeader(s string) bool

func Inject

func Inject(fl *File, content map[string]string) error

func ReplaceSections

func ReplaceSections(fl *File, tgt filesystem.FileLoader) error

Types

type File

type File struct {
	Type    Type                `json:"type"`
	Path    []string            `json:"path,omitempty"`
	Name    string              `json:"name"`
	Mode    filesystem.FileMode `json:"mode,omitempty"`
	Content string              `json:"-"`
}

func NewFile

func NewFile(path string, mode filesystem.FileMode, b []byte, addHeader bool, pkg string, logger util.Logger) *File

func (*File) Ext added in v0.4.8

func (f *File) Ext() string

func (*File) FullPath

func (f *File) FullPath() string

type Files

type Files []*File

func (Files) Exists

func (f Files) Exists(path string) bool

func (Files) Get

func (f Files) Get(path string) *File

func (Files) Sort added in v1.2.24

func (f Files) Sort() Files

func (Files) String

func (f Files) String() string

type Type

type Type struct {
	Key      string
	Suffixes []string
	Title    string
}

func TypeFromString

func TypeFromString(s string) Type

func (*Type) MarshalJSON

func (t *Type) MarshalJSON() ([]byte, error)

func (*Type) String

func (t *Type) String() string

func (*Type) UnmarshalJSON

func (t *Type) UnmarshalJSON(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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