This repository has been archived by the owner on Feb 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 452
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makes this a real command, listed in the help output.
- Loading branch information
Edward Muller
committed
Nov 9, 2015
1 parent
1acc759
commit e9ac6d7
Showing
3 changed files
with
25 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# v28 2015/11/09 | ||
|
||
* Make `version` an actual command. | ||
|
||
# v27 2015/11/06 | ||
|
||
* run command once during restore -v | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
package main | ||
|
||
const version = 27 | ||
import ( | ||
"fmt" | ||
"runtime" | ||
) | ||
|
||
const version = 28 | ||
|
||
var cmdVersion = &Command{ | ||
Usage: "version", | ||
Short: "show version info", | ||
Long: ` | ||
Displays the version of godep as well as the target OS, architecture and go runtime version. | ||
`, | ||
Run: runVersion, | ||
} | ||
|
||
func runVersion(cmd *Command, args []string) { | ||
fmt.Printf("godep v%d (%s/%s/%s)\n", version, runtime.GOOS, runtime.GOARCH, runtime.Version()) | ||
} |
e9ac6d7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice improvement!
Is it easy and desirable to make it so that running
godep -version
is also supported, in addition togodep version
? If it's not too hard, I think that'd be nice.It's pretty standard with command line tools, and also consistent with help command. Both of these work successfully:
godep help
godep -help
e9ac6d7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the argument for having several ways to get help ('godep help', 'godep -help', 'godep -h', 'godep') because that's how you bootstrap your knowledge of the tool. If you can't find the help message, you're stuck!
As for all the other commands, none of them also act like a flag. I don't see why version should be special. Once you've read the help text, you know how to run all the commands, including version.
Also, if we're looking for an example to follow:
e9ac6d7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kr I'm convinced, the current behavior is good. Thanks for providing rationale.
The answer to my question then is "no, it is not desirable."