diff --git a/.leaf.yml b/_examples/sample.leaf.yml similarity index 97% rename from .leaf.yml rename to _examples/sample.leaf.yml index 9da73a2..a950026 100644 --- a/.leaf.yml +++ b/_examples/sample.leaf.yml @@ -27,7 +27,6 @@ filters: # Commands to be executed. # These are run in the provided order. exec: - - ["make", "format"] - ["make", "build"] # Delay after which commands are executed. diff --git a/cmd/main.go b/cmd/main.go index fe11fdc..6215620 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -1,11 +1,14 @@ package main import ( + "fmt" + "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/vrongmeal/leaf/pkg/engine" "github.com/vrongmeal/leaf/pkg/utils" + "github.com/vrongmeal/leaf/version" prefixed "github.com/x-cray/logrus-prefixed-formatter" ) @@ -41,6 +44,18 @@ order so you don't have to yourself`, } }, } + + versionCmd = &cobra.Command{ + Use: "version", + Short: "Leaf version", + Long: `Leaf version details`, + + Run: func(*cobra.Command, []string) { + fmt.Printf(`%s: %s +Version [%s] +`, version.AppName, rootCmd.Short, version.Version) + }, + } ) func init() { @@ -48,6 +63,8 @@ func init() { logrus.SetFormatter(new(prefixed.TextFormatter)) rootCmd.PersistentFlags().StringVarP(&confPath, "config", "c", utils.DefaultConfPath, "Config path for leaf configuration file") + + rootCmd.AddCommand(versionCmd) } func main() { diff --git a/scripts/build.sh b/scripts/build.sh index 6af0c48..13238c7 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -12,7 +12,7 @@ app_name="leaf" repo_path="github.com/vrongmeal/leaf" # Get branch revision and version -version="0.1.0" +version="1.0.0" revision=$(git rev-parse --short HEAD 2> /dev/null || echo 'unknown') branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null || echo 'unknown') diff --git a/scripts/lint.sh b/scripts/lint.sh index e8c31e2..03292b6 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + pkgs=$(go list ./... | grep -v vendor) echo "* Linting code for errors" @@ -7,14 +9,6 @@ echo "* Linting code for errors" # Vet first since golangci-lint returns unclear errors if packages don't build go vet ${pkgs} -# Exit if vet throws an error -vet_status="$?" - -if [ "$vet_status" -ne 0 ] -then - exit "$vet_status" -fi - golangci-lint run echo "+ Your code is beautiful!"