Example #1
0
func main() {
	var opts ShieldAgentOpts
	opts.Log = "Info"
	if err := goptions.Parse(&opts); err != nil {
		fmt.Printf("%s\n", err)
		goptions.PrintHelp()
		return
	}
	if opts.Help {
		goptions.PrintHelp()
		os.Exit(0)
	}
	if opts.Version {
		if Version == "" {
			fmt.Printf("shield-agent (development)%s\n", Version)
		} else {
			fmt.Printf("shield-agent v%s\n", Version)
		}
		os.Exit(0)
	}
	if opts.ConfigFile == "" {
		fmt.Fprintf(os.Stderr, "You must specify a configuration file via `--config`\n")
		os.Exit(1)
	}

	log.SetupLogging(log.LogConfig{Type: "console", Level: opts.Log})
	log.Infof("starting agent")

	ag := agent.NewAgent()
	if err := ag.ReadConfig(opts.ConfigFile); err != nil {
		log.Errorf("configuration failed: %s", err)
		return
	}
	ag.Run()
}
Example #2
0
func main() {
	log.Infof("starting schema...")

	options := struct {
		Help    bool   `goptions:"-h, --help, description='Show the help screen'"`
		Driver  string `goptions:"-t, --type, description='Type of database backend (postgres or mysql)'"`
		DSN     string `goptions:"-d,--database, description='DSN of the database backend'"`
		Version bool   `goptions:"-v, --version, description='Display the SHIELD version'"`
	}{
	// No defaults
	}
	if err := goptions.Parse(&options); err != nil {
		fmt.Printf("%s\n", err)
		goptions.PrintHelp()
		return
	}
	if options.Help {
		goptions.PrintHelp()
		os.Exit(0)
	}
	if options.Version {
		if Version == "" {
			fmt.Printf("shield-schema (development)%s\n", Version)
		} else {
			fmt.Printf("shield-schema v%s\n", Version)
		}
		os.Exit(0)
	}
	if options.Driver == "" {
		fmt.Fprintf(os.Stderr, "You must indicate which type of database you wish to manage, via the `--type` option.\n")
		os.Exit(1)
	}
	if options.DSN == "" {
		fmt.Fprintf(os.Stderr, "You must specify the DSN of your database, via the `--database` option.\n")
		os.Exit(1)
	}

	database := &db.DB{
		Driver: options.Driver,
		DSN:    options.DSN,
	}

	log.Debugf("connecting to %s database at %s", database.Driver, database.DSN)
	if err := database.Connect(); err != nil {
		log.Errorf("failed to connect to %s database at %s: %s",
			database.Driver, database.DSN, err)
	}

	if err := database.Setup(); err != nil {
		log.Errorf("failed to set up schema in %s database at %s: %s",
			database.Driver, database.DSN, err)
		return
	}

	log.Infof("deployed schema version %d", db.CurrentSchema)
}
Example #3
0
func main() {
	opts := &Options{}
	goptions.ParseAndFail(opts)

	// Print version number and exit if the version flag is set
	if opts.Version {
		fmt.Printf("gandi-contact v%s\n", shared.VersionNumber)
		return
	}

	// Get gandi client
	client := shared.NewGandiClient(opts.ConfigPath, opts.Testing)

	// Create api and cli instances
	api := api.New(client)
	contact := cli.New(api)

	switch opts.Verbs {
	case "balance":
		contact.Balance()

	case "info":
		contact.Info(opts.Info.Contact)

	case "create":
		contact.Create(opts.Create)

	case "delete":
		contact.Delete(opts.Delete.Contact)

	default:
		goptions.PrintHelp()
	}
}
Example #4
0
func main() {
	opts := &Options{}
	goptions.ParseAndFail(opts)

	// Print version number and exit if the version flag is set
	if opts.Version {
		fmt.Printf("gandi-operation v%s\n", shared.VersionNumber)
		return
	}

	// Get gandi client
	client := shared.NewGandiClient(opts.ConfigPath, opts.Testing)

	// Create api and operation instances
	api := api.New(client)
	operation := cli.New(api)

	switch opts.Verbs {
	case "count":
		operation.Count()

	case "list":
		operation.List()

	case "info":
		operation.Info(opts.Info.Operation)

	case "cancel":
		operation.Cancel(opts.Cancel.Operation)

	default:
		goptions.PrintHelp()
	}
}
func main() {
	options := Options{}

	goptions.ParseAndFail(&options)

	if options.Version {
		fmt.Printf("github-release v%s\n", VERSION)
		return
	}

	if len(options.Verbs) == 0 {
		goptions.PrintHelp()
		return
	}

	VERBOSITY = len(options.Verbosity)

	if cmd, found := commands[options.Verbs]; found {
		err := cmd(options)
		if err != nil {
			if !options.Quiet {
				fmt.Fprintln(os.Stderr, "error:", err)
			}
			os.Exit(1)
		}
	}
}
func main() {
	opts := &Options{}
	goptions.ParseAndFail(opts)

	// Print version number and exit if the version flag is set
	if opts.Version {
		fmt.Printf("gandi-domain-zone-record v%s\n", shared.VersionNumber)
		return
	}

	// Get gandi client
	client := shared.NewGandiClient(opts.ConfigPath, opts.Testing)

	// Create api and zone instances
	api := api.New(client)
	record := cli.New(api)

	switch opts.Verbs {
	case "count":
		record.Count(opts.Count.Zone, opts.Count.Version)

	case "list":
		record.List(opts.List.Zone, opts.List.Version)

	case "add":
		record.Add(opts.Add)

	case "delete":
		args := opts.Delete
		record.Delete(args.Zone, args.Version, args.Record)

	default:
		goptions.PrintHelp()
	}
}
Example #7
0
func main() {
	supervisor.Version = Version
	var opts ShielddOpts
	opts.Log = "Info"
	if err := goptions.Parse(&opts); err != nil {
		fmt.Printf("%s\n", err)
		goptions.PrintHelp()
		return
	}

	if opts.Help {
		goptions.PrintHelp()
		os.Exit(0)
	}
	if opts.Version {
		if Version == "" {
			fmt.Printf("shieldd (development)\n")
		} else {
			fmt.Printf("shieldd v%s\n", Version)
		}
		os.Exit(0)
	}

	if opts.ConfigFile == "" {
		fmt.Fprintf(os.Stderr, "No config specified. Please try again using the -c/--config argument\n")
		os.Exit(1)
	}

	log.SetupLogging(log.LogConfig{Type: "console", Level: opts.Log})
	log.Infof("starting shield daemon")

	s := supervisor.NewSupervisor()
	if err := s.ReadConfig(opts.ConfigFile); err != nil {
		log.Errorf("Failed to load config: %s", err)
		return
	}

	s.SpawnAPI()
	s.SpawnWorkers()

	if err := s.Run(); err != nil {
		log.Errorf("shield daemon failed: %s", err)
	}
	log.Infof("stopping daemon")
}
Example #8
0
File: s3put.go Project: niilo/s3put
func init() {
	err := goptions.Parse(&options)
	if err != nil || len(options.Remainder) <= 0 || len(options.Verbs) <= 0 {
		if err != goptions.ErrHelpRequest && err != nil {
			log.Printf("Error: %s", err)
		}
		goptions.PrintHelp()
		os.Exit(1)
	}
}
func main() {
	config, err := parseConfig()
	if err != nil {
		log.Fatalf("Could not parse config: %s", err)
	}

	switch options.Verbs {
	case "list":
		fmt.Println("Worlds:")
		for _, worldpath := range config.Worlds() {
			world := config.World(worldpath)
			fmt.Printf("\t%s (Depth: %d)\n", worldpath, world.ZoomLevels())
		}
	case "remove":
		for _, worldname := range options.Remove.Worlds {
			world := config.World(worldname)
			newzoom := world.ZoomLevels() - options.Remove.Num
			filepath.Walk(world.Path(), func(path string, fi os.FileInfo, err error) error {
				if fi.IsDir() {
					return nil
				}
				pe := strings.Split(path, "/")
				zoomLevel := len(pe)
				if zoomLevel > newzoom {
					log.Printf("Removing %s...", path)
					err := os.Remove(path)
					if err != nil {
						log.Printf("Could not delete %s: %s", path, err)
					}
				}
				return nil
			})
			world.SetZoomLevels(newzoom)
		}
		f, err := os.Create(CONFIG_FILE)
		if err != nil {
			log.Fatalf("Could not open config file %s for writing: %s", CONFIG_FILE, err)
		}
		defer f.Close()
		io.WriteString(f, "var overviewerConfig = ")
		enc := json.NewEncoder(f)
		enc.Encode(config)
	default:
		goptions.PrintHelp()
		return
	}
}
Example #10
0
func main() {
	err := goptions.Parse(&options)
	if err != nil || (len(options.FormatFile) <= 0 && len(options.FormatString) <= 0) {
		if err == nil {
			err = fmt.Errorf("One of --format-file and --format-string must be specified")
		}
		fmt.Printf("Error: %s\n", err)
		goptions.PrintHelp()
		fmt.Println("Formatters:")
		for name, format := range Formats {
			fmt.Printf("\t\"%s\": %s\n", name, format.Description)
		}
		fmt.Printf("Version %s\n", VERSION)
		return
	}

	format, ok := Formats[options.Format]
	if !ok {
		log.Fatalf("Unknown format %s", options.Format)
	}

	f, err := format.Compiler(formatString())
	if err != nil {
		log.Fatalf("Template invalid: %s", err)
	}

	dec := json.NewDecoder(os.Stdin)
	logFn := NewLogFn(options.Continue)
	for {
		var input interface{}
		err := dec.Decode(&input)
		if err == io.EOF {
			break
		}
		if err != nil {
			log.Fatalf("Could not decode input: %s", err)
			continue
		}
		err = f.Execute(os.Stdout, input)
		if err != nil {
			logFn("Could not apply input to template: %s", err)
			continue
		}
		io.WriteString(os.Stdout, "\n")
	}
}
Example #11
0
func main() {
	var opts ShieldAgentOpts
	opts.Log = "Info"
	if err := goptions.Parse(&opts); err != nil {
		fmt.Printf("%s\n", err)
		goptions.PrintHelp()
		return
	}

	log.SetupLogging(log.LogConfig{Type: "console", Level: opts.Log})
	log.Infof("starting agent")

	ag := agent.NewAgent()
	if err := ag.ReadConfig(opts.ConfigFile); err != nil {
		log.Errorf("configuration failed: %s", err)
		return
	}
	ag.Run()
}
Example #12
0
func main() {
	goptions.ParseAndFail(&options)
	//fmt.Printf("] %#v\r\n", options)

	if len(options.Verbs) == 0 {
		fmt.Printf("%s%s \n      built on %s\n\n", progname, progdesc, buildTime)
		goptions.PrintHelp()
		os.Exit(2)
	}

	VERBOSITY = len(options.Verbosity)

	configGet(os.Args[0])

	if cmd, found := commands[options.Verbs]; found {
		err := cmd(options)
		check(err)
	}
}
Example #13
0
func main() {
	goptions.ParseAndFail(&options)

	if len(options.Verbs) == 0 {
		goptions.PrintHelp()
		os.Exit(2)
	}

	VERBOSITY = len(options.Verbosity)

	if cmd, found := commands[options.Verbs]; found {
		err := cmd(options)
		if err != nil {
			if !options.Quiet {
				fmt.Println("error:", err)
			}
			os.Exit(1)
		}
	}
}
Example #14
0
func main() {
	log.SetFlags(log.Ltime | log.Lshortfile)

	goptions.ParseAndFail(&options)
	//fmt.Printf("] %#v\r\n", options)

	if len(options.Verbs) == 0 {
		goptions.PrintHelp()
		os.Exit(2)
	}

	VERBOSITY = len(options.Verbosity)

	messageIds = make(map[string]bool)
	messageFetchMode = options.Verbs == "fetch"
	if cmd, found := commands[options.Verbs]; found {
		err := cmd(options)
		check(err)
	}

}
Example #15
0
func main() {
	opts := &Options{}
	goptions.ParseAndFail(opts)

	// Print version number and exit if the version flag is set
	if opts.Version {
		fmt.Printf("gandi-domain-zone v%s\n", shared.VersionNumber)
		return
	}

	// Get gandi client
	client := shared.NewGandiClient(opts.ConfigPath, opts.Testing)

	// Create api and zone instances
	api := api.New(client)
	zone := cli.New(api)

	switch opts.Verbs {
	case "count":
		zone.Count()

	case "list":
		zone.List()

	case "info":
		zone.Info(opts.Info.Zone)

	case "create":
		zone.Create(opts.Create.Name)

	case "delete":
		zone.Delete(opts.Delete.Zone)

	case "set":
		zone.Set(opts.Set.Domain, opts.Set.Zone)

	default:
		goptions.PrintHelp()
	}
}
Example #16
0
func main() {
	goptions.ParseAndFail(&options)
	//fmt.Printf("] %#v\r\n", options)

	if len(options.Verbs) == 0 {
		fmt.Printf("%s%s \n      built on %s\n\n", progname, progdesc, buildTime)
		goptions.PrintHelp()
		os.Exit(2)
	}

	VERBOSITY = len(options.Verbosity)

	if cmd, found := commands[options.Verbs]; found {
		err := cmd()
		if err != nil {
			if !options.Quiet {
				fmt.Printf("%s error: %v", progname, err)
			}
			os.Exit(1)
		}
	}
}
Example #17
0
func main() {
	opts := &Options{}
	goptions.ParseAndFail(opts)

	// Print version number and exit if the version flag is set
	if opts.Version {
		fmt.Printf("gandi-domain v%s\n", shared.VersionNumber)
		return
	}

	// Get gandi client
	client := shared.NewGandiClient(opts.ConfigPath, opts.Testing)

	// Create api and cli instances
	api := api.New(client)
	domain := cli.New(api)

	switch opts.Verbs {
	case "count":
		domain.Count()

	case "list":
		domain.List()

	case "info":
		domain.Info(opts.Info.Domain)

	case "available":
		domain.Available(opts.Available.Domain)

	case "create":
		args := opts.Create
		domain.Create(args.Domain, args.Contact, args.Years)

	default:
		goptions.PrintHelp()
	}
}
func main() {
	opts := &Options{}
	goptions.ParseAndFail(opts)

	// Print version number and exit if the version flag is set
	if opts.Version {
		fmt.Printf("gandi-domain-zone-version v%s\n", shared.VersionNumber)
		return
	}

	// Get gandi client
	client := shared.NewGandiClient(opts.ConfigPath, opts.Testing)

	// Create api and zone instances
	api := api.New(client)
	version := cli.New(api)

	switch opts.Verbs {
	case "count":
		version.Count(opts.Count.Zone)

	case "list":
		version.List(opts.List.Zone)

	case "new":
		version.New(opts.New.Zone, opts.New.Version)

	case "delete":
		version.Delete(opts.Delete.Zone, opts.Delete.Version)

	case "set":
		version.Set(opts.Set.Zone, opts.Set.Version)

	default:
		goptions.PrintHelp()
	}
}
Example #19
0
		content := fmt.Sprintf(format, args...)
		lines := strings.Split(content, "\n")
		for i, line := range lines {
			lines[i] = "DEBUG> " + line
		}
		content = strings.Join(lines, "\n")
		fmt.Fprintf(stderr, "%s\n", content)
	}
}

var stdout = os.Stdout
var stderr = os.Stderr

var usage = func(err error) {
	fmt.Fprintf(stderr, "%s\n", err.Error())
	goptions.PrintHelp()
}
var exit = func(code int) {
	os.Exit(code)
}

func Run(p Plugin) {
	var code int
	var action string

	opts, err := getPluginOptions()
	if err != nil {
		usage(err)
		code = USAGE
	} else {
		action = string(opts.Action)
Example #20
0
File: osc.go Project: angst/roscoe
// Display the usage message and exit
func Usage() {
	goptions.PrintHelp()
	os.Exit(1)
}
Example #21
0
// Main defines the primary handler for transforming an application into a Sparta package.  The
// serviceName is used to uniquely identify your service within a region and will
// be used for subsequent updates.  For provisioning, ensure that you've
// properly configured AWS credentials for the golang SDK.
// See http://docs.aws.amazon.com/sdk-for-go/api/aws/defaults.html#DefaultChainCredentials-constant
// for more information.
func Main(serviceName string, serviceDescription string, lambdaAWSInfos []*LambdaAWSInfo, api *API) error {

	// We need to be able to provision an IAM role that has capabilities to
	// manage the other sources.  That'll give us the role arn to use in the custom
	// resource execution.
	options := struct {
		Noop     bool          `goptions:"-n, --noop, description='Dry-run behavior only (do not provision stack)'"`
		LogLevel string        `goptions:"-l, --level, description='Log level [panic, fatal, error, warn, info, debug]'"`
		Help     goptions.Help `goptions:"-h, --help, description='Show this help'"`

		Verb      goptions.Verbs
		Provision struct {
			S3Bucket string `goptions:"-b,--s3Bucket, description='S3 Bucket to use for Lambda source', obligatory"`
		} `goptions:"provision"`
		Delete struct {
		} `goptions:"delete"`
		Execute struct {
			Port            int `goptions:"-p,--port, description='Alternative port for HTTP binding (default=9999)'"`
			SignalParentPID int `goptions:"-s,--signal, description='Process ID to signal with SIGUSR2 once ready'"`
		} `goptions:"execute"`
		Describe struct {
			OutputFile string `goptions:"-o,--out, description='Output file for HTML description', obligatory"`
		} `goptions:"describe"`
		Explore struct {
			Port int `goptions:"-p,--port, description='Alternative port for HTTP binding (default=9999)'"`
		} `goptions:"explore"`
	}{ // Default values goes here
		LogLevel: "info",
	}
	goptions.ParseAndFail(&options)
	logger, err := NewLogger(options.LogLevel)
	if err != nil {
		goptions.PrintHelp()
		os.Exit(1)
	}
	logger.WithFields(logrus.Fields{
		"Option":  options.Verb,
		"Version": SpartaVersion,
	}).Info("Welcome to Sparta")

	switch options.Verb {
	case "provision":
		logger.Formatter = new(logrus.TextFormatter)
		err = Provision(options.Noop, serviceName, serviceDescription, lambdaAWSInfos, api, options.Provision.S3Bucket, nil, logger)
	case "execute":
		logger.Formatter = new(logrus.JSONFormatter)
		err = Execute(lambdaAWSInfos, options.Execute.Port, options.Execute.SignalParentPID, logger)
	case "delete":
		logger.Formatter = new(logrus.TextFormatter)
		err = Delete(serviceName, logger)
	case "explore":
		logger.Formatter = new(logrus.TextFormatter)
		err = Explore(lambdaAWSInfos, options.Explore.Port, logger)
	case "describe":
		logger.Formatter = new(logrus.TextFormatter)
		fileWriter, err := os.Create(options.Describe.OutputFile)
		if err != nil {
			return fmt.Errorf("Failed to open %s output. Error: %s", options.Describe.OutputFile, err)
		}
		defer fileWriter.Close()
		err = Describe(serviceName, serviceDescription, lambdaAWSInfos, api, fileWriter, logger)
	default:
		goptions.PrintHelp()
		err = fmt.Errorf("Unsupported subcommand: %s", string(options.Verb))
	}
	if nil != err {
		logger.Error(err)
	}
	return err
}
Example #22
0
func main() {
	opts := &Options{}
	goptions.ParseAndFail(opts)

	// Print version number and exit if the version flag is set
	if opts.Version {
		fmt.Printf("gdrive v%s\n", VersionNumber)
		return
	}

	// Get authorized drive client
	drive, err := gdrive.New(opts.AppPath, opts.Advanced, true)
	if err != nil {
		writeError("An error occurred creating Drive client: %v\n", err)
	}

	switch opts.Verbs {
	case "list":
		args := opts.List
		err = cli.List(drive, args.Query, args.TitleFilter, args.MaxResults, args.SharedStatus, args.NoHeader, args.IncludeDocs, args.SizeInBytes)

	case "info":
		err = cli.Info(drive, opts.Info.FileId, opts.Info.SizeInBytes)

	case "folder":
		args := opts.Folder
		err = cli.Folder(drive, args.Title, args.ParentId, args.Share)

	case "upload":
		args := opts.Upload

		// Set custom chunksize if given
		if args.ChunkSize >= (1 << 18) {
			googleapi.SetChunkSize(args.ChunkSize)
		}

		if args.Stdin {
			err = cli.UploadStdin(drive, os.Stdin, args.Title, args.ParentId, args.Share, args.MimeType, args.Convert)
		} else {
			err = cli.Upload(drive, args.File, args.Title, args.ParentId, args.Share, args.MimeType, args.Convert)
		}

	case "download":
		args := opts.Download
		if args.Pop {
			err = cli.DownloadLatest(drive, args.Stdout, args.Format, args.Force)
		} else {
			err = cli.Download(drive, args.FileId, args.Stdout, false, args.Format, args.Force)
		}

	case "delete":
		err = cli.Delete(drive, opts.Delete.FileId)

	case "share":
		err = cli.Share(drive, opts.Share.FileId)

	case "unshare":
		err = cli.Unshare(drive, opts.Unshare.FileId)

	case "url":
		if opts.Url.Download {
			fmt.Println(util.DownloadUrl(opts.Url.FileId))
		} else {
			fmt.Println(util.PreviewUrl(opts.Url.FileId))
		}

	case "quota":
		err = cli.Quota(drive, opts.Quota.SizeInBytes)

	default:
		goptions.PrintHelp()
	}

	if err != nil {
		writeError("%s", err)
	}
}
Example #23
0
func main() {
	opts := &Options{}
	goptions.ParseAndFail(opts)

	// Print version number and exit if the version flag is set
	if opts.Version {
		fmt.Printf("gdrive v%s\n", VersionNumber)
		return
	}

	// Get authorized drive client
	drive, err := gdrive.New(opts.AppPath, opts.Advanced)
	if err != nil {
		fmt.Printf("An error occurred creating Drive client: %v\n", err)
		os.Exit(1)
	}

	switch opts.Verbs {
	case "list":
		args := opts.List
		cli.List(drive, args.Query, args.TitleFilter, args.MaxResults, args.SharedStatus, args.NoHeader)

	case "info":
		cli.Info(drive, opts.Info.FileId)

	case "folder":
		args := opts.Folder
		cli.Folder(drive, args.Title, args.ParentId, args.Share)

	case "upload":
		args := opts.Upload
		if args.Stdin {
			cli.Upload(drive, os.Stdin, args.Title, args.ParentId, args.Share)
		} else {
			cli.Upload(drive, args.File, args.Title, args.ParentId, args.Share)
		}

	case "download":
		args := opts.Download
		if args.Pop {
			cli.DownloadLatest(drive, args.Stdout)
		} else {
			cli.Download(drive, args.FileId, args.Stdout, false)
		}

	case "delete":
		cli.Delete(drive, opts.Delete.FileId)

	case "share":
		cli.Share(drive, opts.Share.FileId)

	case "unshare":
		cli.Unshare(drive, opts.Unshare.FileId)

	case "url":
		if opts.Url.Download {
			fmt.Println(util.DownloadUrl(opts.Url.FileId))
		} else {
			fmt.Println(util.PreviewUrl(opts.Url.FileId))
		}

	default:
		goptions.PrintHelp()
	}
}
Example #24
0
func main() {
	options := struct {
		InputFile     string `goptions:"-i, --input, description='File to read', obligatory"`
		TimeLimit     int    `goptions:"-t, --time, description='Maximum number of timesteps (default: 10)'"`
		Targetset     string `goptions:"-z, --targetset, description='Comma-separated list of metabolite indices'"`
		Verbosity     []bool `goptions:"-v, --verbose, description='Increase verbosity'"`
		SAT           bool   `goptions:"-s, --output-sat, description='Output in SAT format instead of human-readable CNF'"`
		goptions.Help `goptions:"-h, --help, description='Show this help'"`
	}{
		TimeLimit: 10,
	}

	err := goptions.Parse(&options)
	if err != nil {
		log.Printf("Error: %s", err)
		goptions.PrintHelp()
		return
	}

	z := []string{}
	if len(options.Targetset) > 0 {
		z = strings.Split(options.Targetset, ",")
		for i, elem := range z {
			z[i] = strings.TrimSpace(elem)
		}
	}

	matrix, irreversible, err := stoichio.ReadFile(options.InputFile)
	if err != nil {
		log.Fatalf("Could not read file: %s", err)
	}

	t_in, t_out := make([]int, 0), make([]int, 0)
	sourceset := make([]int, 0)
	for i := 0; i < matrix.NumCols(); i++ {
		col := matrix.Col(i)
		if len(col.Supp()) != 1 {
			continue
		}
		supp := col.Supp()
		if col[supp[0]] > 0 || (col[supp[0]] < 0 && !irreversible[i]) {
			t_in = append(t_in, i)
			sourceset = append(sourceset, supp[0])
		}
		if col[supp[0]] < 0 || (col[supp[0]] > 0 && !irreversible[i]) {
			t_out = append(t_out, i)
		}
	}
	if len(options.Verbosity) >= 2 {
		log.Printf("t_in: %#v", t_in)
		log.Printf("t_out: %#v", t_out)
		log.Printf("sourceset: %#v", sourceset)
		log.Printf("z: %#v", z)
	}

	a1 := logic.NewOperation(logic.AND)
	for i := 0; i < matrix.NumRows(); i++ {
		if contains(sourceset, i) {
			a1.PushOperands(logic.NewLeaf(fmt.Sprintf(METABOL, i, 0)))
		} else {
			a1.PushOperands(logic.NewOperation(logic.NOT, logic.NewLeaf(fmt.Sprintf(METABOL, i, 0))))
		}
	}

	a2 := logic.NewOperation(logic.AND)
	a3 := logic.NewOperation(logic.AND)
	a4 := logic.NewOperation(logic.AND)
	a5 := logic.NewOperation(logic.AND)
	a6 := logic.NewOperation(logic.AND)
	a7 := logic.NewOperation(logic.AND)
	a5.PushOperands(generateA5(0, matrix))
	a6.PushOperands(generateA6(0, matrix))
	for t := 1; t < options.TimeLimit; t++ {
		a2.PushOperands(generateA2(t, matrix, irreversible))
		a3.PushOperands(generateA3(t, matrix, irreversible))
		a4.PushOperands(generateA4(t, matrix, irreversible, sourceset))
		a5.PushOperands(generateA5(t, matrix))
		a6.PushOperands(generateA6(t, matrix))
	}
	a2.PushOperands(generateA2(options.TimeLimit, matrix, irreversible))
	a3.PushOperands(generateA3(options.TimeLimit, matrix, irreversible))
	a4.PushOperands(generateA4(options.TimeLimit, matrix, irreversible, sourceset))
	a7.PushOperands(generateA7(options.TimeLimit, z)...)
	a := logic.NewOperation(logic.AND, a1, a2, a3, a4, a5, a6)
	if len(z) > 0 {
		a.PushOperands(a7)
	}

	if options.SAT {
		sat, table := logic.FormatSAT(a)
		list := sortTable(table)
		fmt.Println("Table:")
		tw := tabwriter.NewWriter(os.Stdout, 4, 4, 1, ' ', tabwriter.AlignRight)
		for _, v := range list {
			fmt.Fprintf(tw, "\t%d\t=>\t%s\t\n", v.Id, v.Name)
		}
		tw.Flush()
		fmt.Println("")
		fmt.Println("SAT:")
		fmt.Println(sat)
	} else {
		if len(options.Verbosity) >= 1 {
			log.Printf("A1:\n%s", a1)
			log.Printf("A2:\n%s", a2)
			log.Printf("A3:\n%s", a3)
			log.Printf("A4:\n%s", a4)
			log.Printf("A5:\n%s", a5)
			log.Printf("A6:\n%s", a6)
			log.Printf("A7:\n%s", a7)
			log.Printf("A:\n%s", a)
		}
		log.Printf("CNF(A):\n%s", logic.CNF(a))
	}

}