mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-05-23 00:20:09 -03:00
Now generates mime file
This commit is contained in:
parent
5df52d50a6
commit
125c802582
@ -162,12 +162,12 @@ func printFile(file string, buff *bytes.Buffer) {
|
||||
}
|
||||
totalLines, sloc := getLines(file, content)
|
||||
fileType := getFileType(file, content)
|
||||
//mime type left
|
||||
language := enry.GetLanguage(file, content)
|
||||
mimeType := enry.GetMimeType(language)
|
||||
|
||||
buff.WriteString(fmt.Sprintf("%s: %d lines (%d sloc)\n", filepath.Base(file), totalLines, sloc))
|
||||
buff.WriteString(fmt.Sprintf(" type: %s\n", fileType))
|
||||
buff.WriteString(fmt.Sprint(" mime type: \n"))
|
||||
buff.WriteString(fmt.Sprintf(" mime type: %s\n", mimeType))
|
||||
buff.WriteString(fmt.Sprintf(" language: %s\n", language))
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ type languageInfo struct {
|
||||
Extensions []string `yaml:"extensions,omitempty,flow"`
|
||||
Interpreters []string `yaml:"interpreters,omitempty,flow"`
|
||||
Filenames []string `yaml:"filenames,omitempty,flow"`
|
||||
MimeType string `yaml:"codemirror_mime_type,omitempty,flow"`
|
||||
}
|
||||
|
||||
func getAlphabeticalOrderedKeys(languages map[string]*languageInfo) []string {
|
||||
|
@ -67,6 +67,11 @@ const (
|
||||
commitTmplPath = "internal/code-generator/assets/commit.go.tmpl"
|
||||
commitTmpl = "commit.go.tmpl"
|
||||
|
||||
// mime.go generation
|
||||
mimeFile = "data/mime.go"
|
||||
mimeTmplPath = "internal/code-generator/assets/mime.go.tmpl"
|
||||
mimeTmpl = "mime.go.tmpl"
|
||||
|
||||
commitPath = ".linguist/.git/HEAD"
|
||||
)
|
||||
|
||||
@ -97,6 +102,7 @@ func main() {
|
||||
&generatorFiles{generator.Aliases, languagesYAML, "", aliasesFile, aliasesTmplPath, aliasesTmpl, commit},
|
||||
&generatorFiles{generator.Frequencies, "", samplesDir, frequenciesFile, frequenciesTmplPath, frequenciesTmpl, commit},
|
||||
&generatorFiles{generator.Commit, "", "", commitFile, commitTmplPath, commitTmpl, commit},
|
||||
&generatorFiles{generator.Mime, languagesYAML, "", mimeFile, mimeTmplPath, mimeTmpl, commit},
|
||||
}
|
||||
|
||||
for _, file := range fileList {
|
||||
|
Loading…
x
Reference in New Issue
Block a user