You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
366 B
26 lines
366 B
4 years ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"os"
|
||
|
"os/signal"
|
||
|
|
||
|
"gitoa.ru/go-4devs/console"
|
||
|
"gitoa.ru/go-4devs/console/example/pkg/command"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
ctx, cancel := context.WithCancel(context.Background())
|
||
|
|
||
|
ch := make(chan os.Signal, 1)
|
||
|
defer close(ch)
|
||
|
|
||
|
signal.Notify(ch, os.Interrupt)
|
||
|
|
||
|
go func() {
|
||
|
<-ch
|
||
|
cancel()
|
||
|
}()
|
||
|
console.Execute(ctx, command.Long())
|
||
|
}
|