move ext map language to config

This commit is contained in:
Minghe Huang
2017-11-21 18:16:03 +08:00
parent 748fb3e318
commit b03a57f4cc
2 changed files with 11 additions and 10 deletions

View File

@@ -8,17 +8,9 @@ import (
"github.com/gorilla/websocket"
"github.com/metrue/fx/commands/common"
"github.com/metrue/fx/config"
)
var langs = map[string]string{
".js": "node",
".go": "go",
".rb": "ruby",
".py": "python",
".php": "php",
".jl": "julia",
}
// Up starts the functions specified in flags
func Up() {
option := "up"
@@ -50,7 +42,7 @@ func Up() {
numFail++
continue
}
lang := langs[filepath.Ext(function)]
lang := config.ExtLangMap[filepath.Ext(function)]
worker := NewWorker(function, lang, conn, channel)
go worker.Work()
}

View File

@@ -16,3 +16,12 @@ var Client = map[string]string{
"cache_dir": path.Join(os.Getenv("HOME"), ".fx/"),
"remote_images_url": "https://raw.githubusercontent.com/metrue/fx/master/images.zip",
}
var ExtLangMap = map[string]string {
".js": "node",
".go": "go",
".rb": "ruby",
".py": "python",
".php": "php",
".jl": "julia",
}