mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-18 21:52:28 +03:00
29 lines
439 B
Go
29 lines
439 B
Go
// Package main contains sq's main function.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"os/signal"
|
|
|
|
"github.com/neilotoole/sq/cli"
|
|
)
|
|
|
|
func main() {
|
|
ctx, cancelFn := context.WithCancel(context.Background())
|
|
defer cancelFn()
|
|
|
|
go func() {
|
|
stop := make(chan os.Signal, 1)
|
|
signal.Notify(stop, os.Interrupt)
|
|
|
|
<-stop
|
|
cancelFn()
|
|
}()
|
|
|
|
err := cli.Execute(ctx, os.Stdin, os.Stdout, os.Stderr, os.Args)
|
|
if err != nil {
|
|
os.Exit(1)
|
|
}
|
|
}
|