Skip to content

Commit

Permalink
support cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Hideo Hattori committed Apr 7, 2016
1 parent 1d77f0e commit e1d7d61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion language.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ var Exts map[string]string = map[string]string{
"coffee": "coffee",
"cfm": "cfm",
"cfc": "cfc",
"cmake": "cmake",
"cc": "cpp",
"cpp": "cpp",
"cxx": "cpp",
Expand Down Expand Up @@ -195,7 +196,15 @@ func getFileTypeByShebang(path string) (shebangLang string, ok bool) {

func getFileType(path string) (ext string, ok bool) {
ext = filepath.Ext(path)
if strings.ToLower(filepath.Base(path)) == "makefile" {
base := filepath.Base(path)

switch base {
case "CMakeLists.txt":
return "cmake", true
}

switch strings.ToLower(base) {
case "makefile":
return "makefile", true
}

Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func main() {
coffee_script := NewLanguage("CoffeeScript", "#", "###", "###")
cold_fusion := NewLanguage("ColdFusion", "", "<!---", "--->")
cf_script := NewLanguage("ColdFusion CFScript", "//", "/*", "*/")
cmake := NewLanguage("CMake", "#", "", "")
cpp := NewLanguage("C++", "//", "/*", "*/")
cpp_header := NewLanguage("C++ Header", "//", "/*", "*/")
css := NewLanguage("CSS", "//", "/*", "*/")
Expand Down Expand Up @@ -134,6 +135,7 @@ func main() {
"coffee": coffee_script,
"cfm": cold_fusion,
"cfc": cf_script,
"cmake": cmake,
"cpp": cpp,
"css": css,
"d": d,
Expand Down

0 comments on commit e1d7d61

Please sign in to comment.