Skip to content

Commit

Permalink
Print current version
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Lechowski committed May 31, 2020
1 parent db4a5e9 commit cd6e956
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ import (
"os"
)

const ScipioVersion = "0.1"

func main() {
params := readParameters()

if params.Version {
fmt.Printf("Scipio v%s\n", ScipioVersion)
os.Exit(0)
}

if params.ProjectName == "" {
fmt.Println("--project must not be empty")
os.Exit(1)
Expand Down
3 changes: 3 additions & 0 deletions parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type Parameters struct {
BuildProject bool
CleanBuild bool
Serve bool
Version bool
}

func readParameters() *Parameters {
Expand All @@ -19,6 +20,7 @@ func readParameters() *Parameters {
buildProject := flag.Bool("build", false, "build project and quit")
cleanBuild := flag.Bool("clean", false, "set to clean built project")
serve := flag.Bool("serve", false, "build and run server")
version := flag.Bool("version", false, "show version info")

flag.Parse()

Expand All @@ -28,5 +30,6 @@ func readParameters() *Parameters {
BuildProject: *buildProject,
CleanBuild: *cleanBuild,
Serve: *serve,
Version: *version,
}
}

0 comments on commit cd6e956

Please sign in to comment.