sq/main.go
Neil O'Toole 98e91bae51
Bunch of linting issues (#96)
* linting

* linting

* linting

* linting

* linting

* cleaned up readme trailing newlines
2021-09-12 16:14:30 -06:00

32 lines
482 B
Go

// Package main contains sq's main function.
package main
import (
"context"
"os"
"os/signal"
"github.com/neilotoole/sq/cli"
)
func main() {
var err error
ctx, cancelFn := context.WithCancel(context.Background())
defer func() {
cancelFn()
if err != nil {
os.Exit(1)
}
}()
go func() {
stopCh := make(chan os.Signal, 1)
signal.Notify(stopCh, os.Interrupt)
<-stopCh
cancelFn()
}()
err = cli.Execute(ctx, os.Stdin, os.Stdout, os.Stderr, os.Args[1:])
}