diff options
| author | Shulhan <ms@kilabit.info> | 2024-04-10 23:45:11 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-04-10 23:45:11 +0700 |
| commit | f9b75247b24c1e4a33449065ee35aef50ccfa115 (patch) | |
| tree | 308fb78691a83fd0daa34bdf6e5670a944e62640 | |
| parent | 949be8394e52c188dc57b2dea5128d23df398245 (diff) | |
| download | ciigo-f9b75247b24c1e4a33449065ee35aef50ccfa115.tar.xz | |
cmd/ciigo: instantiate variable on switch cases
Instead of creating variables on top of switch, only declare them when
needed.
| -rw-r--r-- | cmd/ciigo/main.go | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/cmd/ciigo/main.go b/cmd/ciigo/main.go index c1c005f..53c35f0 100644 --- a/cmd/ciigo/main.go +++ b/cmd/ciigo/main.go @@ -73,10 +73,7 @@ func main() { HTMLTemplate: *htmlTemplate, Exclude: *exclude, } - - embedOpts ciigo.EmbedOptions - serveOpts ciigo.ServeOptions - err error + err error ) if len(command) == 0 { @@ -92,6 +89,8 @@ func main() { err = ciigo.Convert(&convertOpts) case cmdEmbed: + var embedOpts ciigo.EmbedOptions + embedOpts.ConvertOptions = convertOpts embedOpts.EmbedOptions.GoFileName = *outputFile @@ -101,9 +100,12 @@ func main() { usage() case cmdServe: - serveOpts.ConvertOptions = convertOpts - serveOpts.Address = *address - serveOpts.IsDevelopment = true + var serveOpts = ciigo.ServeOptions{ + ConvertOptions: convertOpts, + Address: *address, + EnableIndexHTML: true, + IsDevelopment: true, + } err = ciigo.Serve(&serveOpts) case cmdVersion: |
