You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: command.go
+167Lines changed: 167 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,30 +1,41 @@
1
1
package main
2
2
3
3
import (
4
+
"crypto/tls"
4
5
"fmt"
5
6
"html/template"
6
7
"io"
7
8
"maps"
9
+
"net/http"
10
+
"net/url"
8
11
"os"
9
12
"path"
10
13
"path/filepath"
14
+
"strings"
15
+
"time"
11
16
12
17
"github.com/Masterminds/sprig/v3"
13
18
"github.com/dihedron/rawdata"
14
19
"github.com/dihedron/template/extensions"
20
+
"github.com/jlaffaye/ftp"
15
21
"golang.org/x/exp/slog"
16
22
)
17
23
24
+
// Command is the main command for the application.
18
25
typeCommandstruct {
19
26
Input*Input`short:"i" long:"input" description:"The input data, either as an inline JSON value or as a @file (in JSON or YAML format)." optional:"yes" env:"TEMPLATE_INPUT"`
20
27
Templates []string`short:"t" long:"template" description:"The paths of all the templates and subtemplates on disk; the main template must be the first." required:"yes"`
21
28
Outputstring`short:"o" long:"output" description:"The path to the output file." optional:"yes" env:"TEMPLATE_OUTPUT"`
22
29
}
23
30
31
+
// Input is the input data for the template.
24
32
typeInputstruct {
25
33
Dataany
26
34
}
27
35
36
+
// UnmarshalFlag unmarshals the input data from a string;
37
+
// if the string starts with '@', it is treated as a file path,
38
+
// otherwise it is treated as an inline JSON value.
0 commit comments