diff options
| author | Shulhan <ms@kilabit.info> | 2022-05-19 17:40:34 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-05-19 17:40:34 +0700 |
| commit | 38cef79652548736a339ec1d838cf66b6a9d9a61 (patch) | |
| tree | 44e37fc43f6813026e863db463d3d8bcd26707f0 | |
| parent | 1e520d2258d655b856026d7a53d4d4e2320533ff (diff) | |
| download | ciigo-38cef79652548736a339ec1d838cf66b6a9d9a61.tar.xz | |
cmd/ciigo: add command to print to current version
| -rw-r--r-- | cmd/ciigo/main.go | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/cmd/ciigo/main.go b/cmd/ciigo/main.go index 0f19f55..e8bec17 100644 --- a/cmd/ciigo/main.go +++ b/cmd/ciigo/main.go @@ -39,6 +39,15 @@ import ( "github.com/shuLhan/share/lib/memfs" ) +const ( + cmdConvert = "convert" + cmdEmbed = "embed" + cmdServe = "serve" + cmdVersion = "version" + + version = "0.8.1" +) + func main() { flag.Usage = usage isHelp := flag.Bool("help", false, "print help") @@ -73,7 +82,7 @@ func main() { command = strings.ToLower(command) switch command { - case "convert": + case cmdConvert: opts := ciigo.ConvertOptions{ Root: dir, HtmlTemplate: *htmlTemplate, @@ -81,7 +90,7 @@ func main() { } err = ciigo.Convert(&opts) - case "embed": + case cmdEmbed: genOpts := ciigo.EmbedOptions{ ConvertOptions: ciigo.ConvertOptions{ Root: dir, @@ -94,7 +103,7 @@ func main() { } err = ciigo.GoEmbed(&genOpts) - case "serve": + case cmdServe: opts := ciigo.ServeOptions{ ConvertOptions: ciigo.ConvertOptions{ Root: dir, @@ -106,6 +115,9 @@ func main() { } err = ciigo.Serve(&opts) + case cmdVersion: + fmt.Println(version) + default: usage() os.Exit(1) @@ -141,5 +153,9 @@ ciigo [-template <file>] [-exclude <regex>] [-address <ip:port>] serve <dir> Serve all files inside directory "dir" using HTTP server, watch changes on markup files and convert them to HTML files automatically. - If the address is not set, its default to ":8080".`) + If the address is not set, its default to ":8080". + +ciigo version + + Print the current ciigo version.`) } |
