func main() { args := parseArgs() verbose = args.verbose if args.debug { u.SetDebugLogging() } go func() { // wait until we exit. sigc := make(chan os.Signal, 1) signal.Notify(sigc, syscall.SIGABRT) <-sigc panic("ABORT! ABORT! ABORT!") }() if err := connect(args); err != nil { exit("%s", err) } }
func (i *cmdInvocation) Run(ctx context.Context) (output io.Reader, err error) { // check if user wants to debug. option OR env var. debug, _, err := i.req.Option("debug").Bool() if err != nil { return nil, err } if debug || u.GetenvBool("DEBUG") || os.Getenv("IPFS_LOGGING") == "debug" { u.Debug = true u.SetDebugLogging() } res, err := callCommand(ctx, i.req, Root, i.cmd) if err != nil { return nil, err } if err := res.Error(); err != nil { return nil, err } return res.Reader() }