restic/cmd/restic/main.go

33 lines
671 B
Go
Raw Normal View History

2014-04-28 00:00:15 +02:00
package main
import (
"os"
2014-11-16 22:50:20 +01:00
"runtime"
2014-09-23 22:39:12 +02:00
2014-04-28 00:00:15 +02:00
"github.com/jessevdk/go-flags"
2015-01-14 22:08:48 +01:00
"github.com/restic/restic/debug"
2014-04-28 00:00:15 +02:00
)
func init() {
2014-11-16 22:50:20 +01:00
// set GOMAXPROCS to number of CPUs
runtime.GOMAXPROCS(runtime.NumCPU())
2014-04-28 00:00:15 +02:00
}
func main() {
// defer profile.Start(profile.MemProfileRate(100000), profile.ProfilePath(".")).Stop()
2015-02-22 00:09:57 +01:00
// defer profile.Start(profile.CPUProfile, profile.ProfilePath(".")).Stop()
globalOpts.Repo = os.Getenv("RESTIC_REPOSITORY")
globalOpts.password = os.Getenv("RESTIC_PASSWORD")
2014-04-28 00:00:15 +02:00
2015-01-14 22:08:48 +01:00
debug.Log("restic", "main %#v", os.Args)
2014-12-07 16:30:52 +01:00
_, err := parser.Parse()
2014-04-28 00:00:15 +02:00
if e, ok := err.(*flags.Error); ok && e.Type == flags.ErrHelp {
os.Exit(0)
}
2014-09-23 22:39:12 +02:00
if err != nil {
2014-12-07 16:30:52 +01:00
os.Exit(1)
2014-04-28 00:00:15 +02:00
}
}