Browse Source

make detect a package.

Lucas Stadler 11 years ago
parent
commit
bffe573bb3
2 changed files with 1 additions and 16 deletions
  1. 0 1
      go/.gitignore
  2. 1 15
      go/detect.go

+ 0 - 1
go/.gitignore

1
.go
1
.go
2
2
3
detect
4
qst
3
qst
5
4
6
examples/hello
5
examples/hello

+ 1 - 15
go/detect.go

1
package main
1
package detect
2
2
3
import (
3
import (
4
	"fmt"
4
	"fmt"
40
	Project{"ruby/default", Commands{"run": "ruby {file}"}, rubyDefault},
40
	Project{"ruby/default", Commands{"run": "ruby {file}"}, rubyDefault},
41
}
41
}
42
42
43
func main() {
44
	if len(os.Args) < 2 {
45
		fmt.Printf("Usage: %s <file>\n", os.Args[0])
46
		os.Exit(1)
47
	}
48
49
	file := os.Args[1]
50
51
	for _, project := range ProjectTypes {
52
		runCmd := project.Commands["run"]
53
		fmt.Printf("%v (%v): %v\n", project.Id, runCmd, project.Detect(file))
54
	}
55
}
56
57
func matchingFileOrDir(file string, pattern string) bool {
43
func matchingFileOrDir(file string, pattern string) bool {
58
	if fileutil.IsFile(file) {
44
	if fileutil.IsFile(file) {
59
		_, f := path.Split(file)
45
		_, f := path.Split(file)