Skip to content

Commit

Permalink
fix: add version/latest constraint.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jan 19, 2019
1 parent edfa09d commit 3fb13d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions motoko.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func main() {

updateCommand := flag.NewFlagSet("update", flag.ExitOnError)
libPtr := updateCommand.String("lib", "", "Lib to update. (Required)")
versionPtr := updateCommand.String("version", "", "Version to set. (Required)")
versionPtr := updateCommand.String("version", "", "Version to set.")
latestPtr := updateCommand.Bool("latest", false, "Update to the latest available version.")
filenamePtr := updateCommand.Bool("filenames", false, "Only display file names.")

Expand Down Expand Up @@ -68,6 +68,10 @@ func updateCmd(latest, filename bool, lib, version string) {
log.Fatal("--version or --latest are required")
}

if len(version) > 0 && latest {
log.Fatal("--version and --latest cannot be used at the same time.")
}

dir, err := os.Getwd()
if err != nil {
log.Fatal(err)
Expand All @@ -78,8 +82,6 @@ func updateCmd(latest, filename bool, lib, version string) {
log.Fatal("Unable to find 'go.mod':", dir)
}

fmt.Println(dir)

v := getNewVersion(latest, lib, version)

if err := update(dir, lib, v, filename); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Usage of update:
-lib string
Lib to update. (Required)
-version string
Version to set. (Required)
Version to set.
```

### Examples
Expand Down

0 comments on commit 3fb13d3

Please sign in to comment.