diff --git a/cmd/theme/main.go b/cmd/theme/main.go index 29b513f4..12d9de3f 100644 --- a/cmd/theme/main.go +++ b/cmd/theme/main.go @@ -22,6 +22,7 @@ var permittedZeroArgCommands = map[string]bool{ "download": true, "replace": true, "watch": true, + "version": true, } var commandDescriptionPrefix = []string{ @@ -37,6 +38,7 @@ var permittedCommands = map[string]string{ "watch": "Watch directory for changes and update remote theme", "configure": "Create a configuration file", "bootstrap": "Bootstrap a new theme using Shopify Timber", + "version": "Display themekit version", } type CommandParser func(string, []string) (map[string]interface{}, *flag.FlagSet) @@ -49,6 +51,7 @@ var parserMapping = map[string]CommandParser{ "watch": WatchCommandParser, "configure": ConfigurationCommandParser, "bootstrap": BootstrapParser, + "version": NoOpParser, } type Command func(map[string]interface{}) chan bool @@ -61,6 +64,7 @@ var commandMapping = map[string]Command{ "watch": commands.WatchCommand, "configure": commands.ConfigureCommand, "bootstrap": commands.BootstrapCommand, + "version": commands.VersionCommand, } func CommandDescription(defaultCommand string) string { @@ -125,6 +129,10 @@ func main() { output.Flush() } +func NoOpParser(cmd string, args []string) (result map[string]interface{}, set *flag.FlagSet) { + return make(map[string]interface{}), nil +} + func FileManipulationCommandParser(cmd string, args []string) (result map[string]interface{}, set *flag.FlagSet) { result = make(map[string]interface{}) currentDir, _ := os.Getwd() diff --git a/commands/version.go b/commands/version.go new file mode 100644 index 00000000..8c741826 --- /dev/null +++ b/commands/version.go @@ -0,0 +1,13 @@ +package commands + +import ( + "fmt" + "github.com/Shopify/themekit" +) + +func VersionCommand(args map[string]interface{}) chan bool { + fmt.Println("Theme Kit", themekit.ThemeKitVersion) + res := make(chan bool) + close(res) + return res +} diff --git a/version.go b/version.go index 757dc780..78b03815 100644 --- a/version.go +++ b/version.go @@ -1,6 +1,6 @@ package themekit -const ThemeKitVersion string = "v0.2.6" +const ThemeKitVersion string = "v0.2.7" func LibraryInfo() []string { return []string{