Skip to content

#44 Display build information #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 3, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
#44 move out print from cli.go
  • Loading branch information
kislenko-artem committed Mar 3, 2019
commit 13a7387ba3081e20d4b5715548e7cdc87c9cbd0e
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package main
import (
"flag"
"fmt"
"runtime"
"runtime/pprof"

_ "github.com/go-python/gpython/builtin"
Expand Down Expand Up @@ -63,7 +64,13 @@ func main() {
args := flag.Args()
py.MustGetModule("sys").Globals["argv"] = pysys.MakeArgv(args)
if len(args) == 0 {
cli.RunREPL(version, commit, date)

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())

cli.RunREPL()
return
}
prog := args[0]
Expand Down
14 changes: 4 additions & 10 deletions repl/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ package cli

import (
"fmt"
"github.com/go-python/gpython/py"
"github.com/go-python/gpython/repl"
"github.com/peterh/liner"
"io"
"os"
"os/user"
"path/filepath"
"runtime"

"github.com/go-python/gpython/py"
"github.com/go-python/gpython/repl"
"github.com/peterh/liner"
)

const HistoryFileName = ".gpyhistory"
Expand Down Expand Up @@ -120,7 +118,7 @@ func (rl *readline) Print(out string) {
}

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

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy