mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-18 05:31:38 +03:00
98e91bae51
* linting * linting * linting * linting * linting * cleaned up readme trailing newlines
32 lines
482 B
Go
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:])
|
|
}
|