From e1d7d61e19bc3471de4d48ab78a26d46b2433f45 Mon Sep 17 00:00:00 2001 From: Hideo Hattori Date: Thu, 7 Apr 2016 19:36:38 +0900 Subject: [PATCH] support cmake --- language.go | 11 ++++++++++- main.go | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/language.go b/language.go index 5ce1b93..50c4069 100644 --- a/language.go +++ b/language.go @@ -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", @@ -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 } diff --git a/main.go b/main.go index 73cf463..7bd4222 100644 --- a/main.go +++ b/main.go @@ -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", "//", "/*", "*/") @@ -134,6 +135,7 @@ func main() { "coffee": coffee_script, "cfm": cold_fusion, "cfc": cf_script, + "cmake": cmake, "cpp": cpp, "css": css, "d": d,