Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func main() {
args := flag.Args()
py.MustGetModule("sys").Globals["argv"] = pysys.MakeArgv(args)
if len(args) == 0 {
cli.RunREPL()
cli.RunREPL(version, commit, date)
return
}
prog := args[0]
Expand Down
9 changes: 6 additions & 3 deletions repl/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os"
"os/user"
"path/filepath"
"runtime"

"github.com/go-python/gpython/py"
"github.com/go-python/gpython/repl"
Expand Down Expand Up @@ -119,7 +120,7 @@ func (rl *readline) Print(out string) {
}

// RunREPL starts the REPL loop
func RunREPL() {
func RunREPL(version, commit, date string) {
repl := repl.New()
rl := newReadline(repl)
repl.SetUI(rl)
Expand All @@ -129,8 +130,10 @@ func RunREPL() {
fmt.Printf("Failed to open history: %v\n", err)
}

fmt.Printf("Gpython 3.4.0\n")

fmt.Printf("Python 3.4.0 (%s, %s)\n", commit, date)
fmt.Printf("[Gpython %s]\n", version)
fmt.Printf("- os/arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
fmt.Printf("- go version: %s\n", runtime.Version())
for {
line, err := rl.Prompt(rl.prompt)
if err != nil {
Expand Down
7 changes: 7 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

var (
version = "dev"
commit = "none"
date = "unknown"
)