Beispiel #1
0
func main() {
	args, _ := docopt.Parse(Usage, nil, true, Version, false)
	log.Println(args)

	entryFiles := args["<entry_file>"].([]string)
	tree := args["--tree"].(bool)

	outputFile, ok := args["--output"].(string)
	if !ok {
		outputFile = ""
	}

	writer := os.Stdout
	if len(outputFile) > 0 {
		fp, err := os.Create(outputFile)
		if err != nil {
			log.Fatalln(err)
		}
		defer fp.Close()
		writer = fp
	}

	bundle := gobundle.Bundle(entryFiles)

	if tree {
		gobundle.WriteDependencyGraph(writer, bundle)
	} else {
		gobundle.WriteBundle(writer, bundle)
	}
}
Beispiel #2
0
func main() {
	args, _ := docopt.Parse(Usage, nil, true, Version, false)
	log.Println(args)

	entryFiles := args["<entry_file>"].([]string)
	tree := args["--tree"].(bool)

	outputFile, ok := args["--output"].(string)
	if !ok {
		outputFile = ""
	}

	writer := os.Stdout
	if len(outputFile) > 0 {
		fp, err := os.Create(outputFile)
		if err != nil {
			log.Fatalln(err)
		}
		defer fp.Close()
		writer = fp
	}

	for _, entryFile := range entryFiles {
		baseDir := filepath.Dir(entryFile)
		fileName := filepath.Base(entryFile)
		ref, err := getLocalModuleRef(baseDir, fileName)
		if err != nil {
			log.Fatalln(err)
			continue
		}
		err = scanModule(ref)
		if err != nil {
			log.Println(err)
			continue
		}
		entryIds = append(entryIds, ref.ID)
	}

	if tree {
		writeDependencyGraph(writer)
	} else {
		writeBundle(writer)
	}
}
Beispiel #3
0
func main() {
	args, _ := docopt.Parse(Usage, nil, true, Version, false)

	entryFile := args["<entry_file>"].(string)

	outputFile, ok := args["--output"].(string)
	if !ok {
		outputFile = ""
	}

	writer := os.Stdout
	if len(outputFile) > 0 {
		fp, err := os.Create(outputFile)
		if err != nil {
			log.Fatalln(err)
		}
		defer fp.Close()
		writer = fp
	}

	bundle := gobundle.Bundle(entryFile)
	gobundle.WriteBundle(writer, bundle)
}