mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 05:53:39 +00:00
Add tinygo version subcommand (#172)
* cmd: add tinygo version subcommand to display current software version. Also displayed when usage is displayed
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
@@ -455,6 +456,8 @@ func Run(pkgName, target string, config *BuildConfig) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func usage() {
|
func usage() {
|
||||||
|
fmt.Fprintln(os.Stderr, "TinyGo is a Go compiler for small places.")
|
||||||
|
fmt.Fprintln(os.Stderr, "version:", version)
|
||||||
fmt.Fprintf(os.Stderr, "usage: %s command [-printir] [-target=<target>] -o <output> <input>\n", os.Args[0])
|
fmt.Fprintf(os.Stderr, "usage: %s command [-printir] [-target=<target>] -o <output> <input>\n", os.Args[0])
|
||||||
fmt.Fprintln(os.Stderr, "\ncommands:")
|
fmt.Fprintln(os.Stderr, "\ncommands:")
|
||||||
fmt.Fprintln(os.Stderr, " build: compile packages and dependencies")
|
fmt.Fprintln(os.Stderr, " build: compile packages and dependencies")
|
||||||
@@ -601,6 +604,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
case "help":
|
case "help":
|
||||||
usage()
|
usage()
|
||||||
|
case "version":
|
||||||
|
fmt.Printf("tinygo version %s %s/%s\n", version, runtime.GOOS, runtime.GOARCH)
|
||||||
default:
|
default:
|
||||||
fmt.Fprintln(os.Stderr, "Unknown command:", command)
|
fmt.Fprintln(os.Stderr, "Unknown command:", command)
|
||||||
usage()
|
usage()
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
// version of this package.
|
||||||
|
// Update this value before release of new version of software.
|
||||||
|
const version = "0.1.0"
|
||||||
Reference in New Issue
Block a user