mirror of
https://github.com/jimeh/mje.git
synced 2026-02-19 01:46:40 +00:00
wip: initial commit
Extremely unfinished and work in progress.
This commit is contained in:
36
main.go
Normal file
36
main.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/jimeh/mj2n/commands"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cmd, err := commands.NewMJ2N()
|
||||
if err != nil {
|
||||
fatal(err)
|
||||
}
|
||||
|
||||
ctx, cancel := signal.NotifyContext(
|
||||
context.Background(),
|
||||
syscall.SIGINT, syscall.SIGTERM,
|
||||
)
|
||||
defer cancel()
|
||||
|
||||
err = cmd.ExecuteContext(ctx)
|
||||
if err != nil {
|
||||
defer os.Exit(1)
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func fatal(err error) {
|
||||
fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
Reference in New Issue
Block a user