godot/godot.go
func NewDotterEx(oType OutputType, prog Program, gType GraphType,
	isStrict, writeToFile bool, fname string) (*Dotter, error) {

	dotPath, err := exec.LookPath(string(prog))
	if err != nil {
		panic(err)
	}

	otype := "-T" + string(oType)

	var cmd *exec.Cmd
	if writeToFile {
		ofile := "-O"
		if fname != "" {
			ofile = "-o" + fname
		}
		cmd = exec.Command(dotPath, otype, ofile)
	} else {
		cmd = exec.Command(dotPath, otype)
		stdout, err := cmd.StdoutPipe()
		if err != nil {
			return nil, err
		}
		go io.Copy(os.Stdout, stdout)
	}

	stdin, err := cmd.StdinPipe()
	if err != nil {
		return nil, err
	}

	dotter := &Dotter{}
	dotter.instance = cmd
	dotter.stdin = stdin
	dotter.graphType = gType
	dotter.isFirstCmd = true
	dotter.isStrict = isStrict

	return dotter, cmd.Start()
}
func NewDotterEx(oType OutputType, prog Program, gType GraphType,
	isStrict, writeToFile bool, fname string) (*Dotter, error) {

	dotPath, err := exec.LookPath(string(prog))
	if err != nil {
		panic(err)
	}

	otype := "-T" + string(oType)

	var cmd *exec.Cmd
	if writeToFile {
		ofile := "-O"
		if fname != "" {
			ofile = "-o" + fname
		}
		cmd = exec.Command(dotPath, otype, ofile)
	} else {
		cmd = exec.Command(dotPath, otype)
		stdout, err := cmd.StdoutPipe()
		if err != nil {
			return nil, err
		}
		go io.Copy(os.Stdout, stdout)
	}

	stdin, err := cmd.StdinPipe()
	if err != nil {
		return nil, err
	}

	dotter := &Dotter{}
	dotter.instance = cmd
	dotter.stdin = stdin
	dotter.graphType = gType
	dotter.isFirstCmd = true
	dotter.isStrict = isStrict

	return dotter, cmd.Start()
}
func NewDotterEx ( oType OutputType , prog Program , gType GraphType , isStrict , writeToFile bool , fname string ) ( * Dotter , error ) { dotPath , err := exec . LookPath ( string ( prog ) ) if err != nil { panic ( err ) } otype := " " + string ( oType ) var cmd * exec . Cmd if writeToFile { ofile := " " if fname != " " { ofile = " " + fname } cmd = exec . Command ( dotPath , otype , ofile ) } else { cmd = exec . Command ( dotPath , otype ) stdout , err := cmd . StdoutPipe ( ) if err != nil { return nil , err } go io . Copy ( os . Stdout , stdout ) } stdin , err := cmd . StdinPipe ( ) if err != nil { return nil , err } dotter := & Dotter { } dotter . instance = cmd dotter . stdin = stdin dotter . graphType = gType dotter . isFirstCmd = true dotter . isStrict = isStrict return dotter , cmd . Start ( ) }
// Creates a New Dotter.
//
// Parameters:
//
// - isStrict: if true, multiple edges won't be displayed.
//
// - writeToFile: if true, output will be written to fname. Otherwise to stdout.
//
// - fname: filename. if fname equals "", dot will make up a filename - usally
// noname.dot.*
Creates a New Dotter . Parameters : - isStrict : if true multiple edges won t be displayed . - writeToFile : if true output will be written to fname . Otherwise to stdout . - fname : filename . if fname equals dot will make up a filename - usally noname . dot . *