gore

command module
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2016 License: MIT Imports: 30 Imported by: 0

README

= gore image:https://travis-ci.org/motemen/gore.svg?branch=master["Build Status", link="https://travis-ci.org/motemen/gore"]

Yet another Go REPL that works nicely. Featured with line editing, code completion, and more.

image::doc/screencast.gif[Screencast]

_(Screencast taken with https://github.com/cho45/KeyCast[cho45/KeyCast])_

== Usage

    gore

After a prompt is shown, enter any Go expressions/statements or commands described below.

To quit the session, type `Ctrl-D`.

== Features

* Line editing with history
* Multiline inputs
* Package importing with completion
* Evaluates any expressions or statements
* No "evaluated but not used"
* Code completion (requires https://github.com/nsf/gocode[gocode])
* Pretty printing (https://github.com/k0kubun/pp[pp] or https://github.com/davecgh/go-spew[spew] recommended)
* Showing documents (requires https://golang.org/x/tools/cmd/godoc[godoc])
* Auto-importing

== REPL Commands

Some functionalities are provided as colon-commands:

    :import <package path>  Import package
    :print                  Show current source
    :write [<filename>]     Write out current source to file
    :doc <expr or pkg>      Show document (requires godoc)
    :help                   List commands
    :quit                   Quit the session

== Installation

gore uses Go toolchains, so I don't provide binaries.

    go get -u github.com/motemen/gore

Make sure `$GOPATH/bin` is in your `$PATH`.

Also recommended:

    go get -u github.com/nsf/gocode
    go get -u github.com/k0kubun/pp # or github.com/davecgh/go-spew
    go get -u golang.org/x/tools/cmd/godoc

== FAQ/Caveats

* If you see `too many arguments in call to mainScope.LookupParent` while installing gore,
  run `go get -u golang.org/x/tools/go/types`.
* gore runs code using `go run` for each input. If you have entered time-consuming code,
  gore will run it for each input and take some time.

== TODO

* Undoing input
* Configuration
* :write completion
* Direct editing of code
* Using external sources
* API

== License

link:./LICENSE[The MIT License].

== Author

motemen <motemen@gmail.com>

Documentation

Overview

Yet another Go REPL that works nicely. Featured with line editing, code completion and more.

Usage

When started, a prompt is shown waiting for input. Enter any statement or expression to proceed. If an expression is given or any variables are assigned or defined, their data will be pretty-printed.

Some special functionalities are provided as commands, which starts with colons:

:import <package path>  Imports a package
:print                  Prints current source code
:write [<filename>]     Writes out current code
:doc <target>           Shows documentation for an expression or package name given
:help                   Lists commands
:quit                   Quit the session

Directories

Path Synopsis
Package gocode is an interface to github.com/nsf/gocode.
Package gocode is an interface to github.com/nsf/gocode.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL