Skip to Content
marmot
Commands

Read Go declarations, statements and expressions and run them as you type, on the incremental build. Expressions print their value; imports of the standard library are added when you use a package. Tab or the right arrow accepts the completion shown in grey. Commands: :type EXPR, :doc NAME, :time, :imports, :reset, :quit.

Usage
marmot repl [flags]

Examples

marmot repl
echo 'strings.Repeat("ab", 3)' | marmot repl

marmot repl reads Go one entry at a time. An expression prints its value, a statement runs, a func or type declaration is kept for later entries. Packages of the standard library are imported when you use them (strings.ToUpper("a") just works); import "example.com/x" adds others. History is kept in ~/.marmot_history.

CommandWhat it does
:type EXPRPrint the type of an expression.
:doc NAMEPrint the documentation of a name.
:timeTime each entry.
:importsList the imports in effect.
:resetForget every entry.
:quitLeave.

Each entry is compiled and run as a whole program with the entries before it, and only the new output is shown. Earlier statements run again each time, so their side effects repeat. An entry that does not compile or panics is not kept.

Flags

Flags take one dash or two: -release and --release are the same.

FlagMeaning
-timeprint how long each entry took to build and run

Full help

marmot repl --help
Read Go declarations, statements and expressions and run them as you type, on the incremental build. Expressions print their value; imports of the standard library are added when you use a package. Tab or the right arrow accepts the completion shown in grey. Commands: :type EXPR, :doc NAME, :time, :imports, :reset, :quit.

Usage:
  marmot repl [flags]

Examples:
marmot repl
echo 'strings.Repeat("ab", 3)' | marmot repl

Flags:
  -h, --help   help for repl
      --time   print how long each entry took to build and run

On this page

Was this page helpful?

Report an issueOpen issues