Esempio n. 1
0
func main() {

	query := flag.String("q", "", "The Query to search")
	pathString := flag.String("p", ".", "The (optional) path to run gitql")
	version := flag.Bool("v", false, "The version of gitql")
	flag.Parse()

	if *version {
		// @todo refactor to dynamic value
		fmt.Println("Gitql 1.0.0")
		return
	}

	path, errFile := filepath.Abs(*pathString)

	if errFile != nil {
		panic(errFile)
	}

	parser.New(*query)
	ast, errGit := parser.AST()
	if errGit != nil {
		panic(errGit)
	}
	ast.Path = &path
	errGit = semantical.Analysis(ast)
	if errGit != nil {
		panic(errGit)
	}

	runtime.Run(ast)
}
Esempio n. 2
0
File: itql.go Progetto: lianz/gitql
func main() {
	folder, errFile := filepath.Abs(*path)

	if errFile != nil {
		log.Fatalln(errFile)
	}

	parser.New(query)
	ast, errGit := parser.AST()
	if errGit != nil {
		log.Fatalln(errGit)
	}
	ast.Path = &folder
	errGit = semantical.Analysis(ast)
	if errGit != nil {
		log.Fatalln(errGit)
	}

	runtime.Run(ast)
}