2019-02-05 21:54:14 +00:00
|
|
|
/*
|
2023-02-16 16:46:23 +00:00
|
|
|
Package enry identifies programming languages.
|
2019-02-05 21:54:14 +00:00
|
|
|
|
2023-02-16 16:46:23 +00:00
|
|
|
Identification is based on file name and content using a series
|
|
|
|
of strategies to narrow down possible options.
|
|
|
|
Each strategy is available as a separate API call, as well as though the main enty point:
|
2019-02-05 21:54:14 +00:00
|
|
|
|
2023-02-16 16:46:23 +00:00
|
|
|
GetLanguage(filename string, content []byte) (language string)
|
2019-02-05 21:54:14 +00:00
|
|
|
|
2023-02-16 16:46:23 +00:00
|
|
|
It is a port of the https://github.com/github/linguist from Ruby.
|
|
|
|
Upstream Linguist YAML files are used to generate datastructures for data
|
|
|
|
package.
|
2019-02-05 21:54:14 +00:00
|
|
|
*/
|
2020-03-19 16:31:29 +00:00
|
|
|
package enry // import "github.com/go-enry/go-enry/v2"
|
2018-04-28 11:12:25 +00:00
|
|
|
|
|
|
|
//go:generate make code-generate
|
2022-11-23 17:46:10 +00:00
|
|
|
|
|
|
|
import "github.com/go-enry/go-enry/v2/data"
|
|
|
|
|
|
|
|
// Type represent language's type. Either data, programming, markup, prose, or unknown.
|
|
|
|
type Type int
|
|
|
|
|
|
|
|
// Type's values.
|
|
|
|
const (
|
|
|
|
Unknown Type = Type(data.TypeUnknown)
|
|
|
|
Data = Type(data.TypeData)
|
|
|
|
Programming = Type(data.TypeProgramming)
|
|
|
|
Markup = Type(data.TypeMarkup)
|
|
|
|
Prose = Type(data.TypeProse)
|
|
|
|
)
|