blob: 7cc371623d529215bb2a3b1419162d41c58bd8c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/*
The gomplate command
*/
package main
import (
"context"
"os"
"github.com/hairyhenderson/gomplate/v4/internal/cmd"
)
func main() {
exitCode := 0
// defer the exit first, so it executes last, to let the deferred cancel run
defer func() { os.Exit(exitCode) }()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// need to strip os.Args[0] so we only pass the actual flags
err := cmd.Main(ctx, os.Args[1:], os.Stdin, os.Stdout, os.Stderr)
if err != nil {
exitCode = 1
}
}
|