Skip to content

Commit

Permalink
Bumps version and adds version command
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Saunders committed Sep 4, 2015
1 parent dacd378 commit 77dd77f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cmd/theme/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var permittedZeroArgCommands = map[string]bool{
"download": true,
"replace": true,
"watch": true,
"version": true,
}

var commandDescriptionPrefix = []string{
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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()
Expand Down
13 changes: 13 additions & 0 deletions commands/version.go
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package themekit

const ThemeKitVersion string = "v0.2.6"
const ThemeKitVersion string = "v0.2.7"

func LibraryInfo() []string {
return []string{
Expand Down

0 comments on commit 77dd77f

Please sign in to comment.