Popularity
1.8
Growing
Activity
0.0
Stable
24
2
2

Programming language: Go
License: MIT License
Tags: Command Line     Standard CLI    
Latest version: v1.3.0

sand alternatives and similar packages

Based on the "Standard CLI" category.
Alternatively, view sand alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of sand or a related project?

Add another 'Standard CLI' Package

README

GoDoc Go Report Card Build Status Code Coverage

sand

sand is for creating interpreters, like the Python interpreter and Haskell interpreter. It can also be used for creating text based games and CLI test environments.

For examples, check out the examples folder.

Design

sand implements a concurrent model. It views an interpreter as two seperate components: the User Interface, sand.UI, and the Command Processor,sand.Engine. The following diagram shows how under the hood sand operates. Every square is a goroutine.

+--------+                            +--------------------------+
|        |              +------------->     Engines Manager      +--------------+
|  Read  <----------+   |             +--------------------------+              |
|        |          |   |                                                       |
+----+---+          |   |                                                       |
     |            +-+---+------+                                        +-------v------+
     |            |            |                                        |              |     +----------+
     +------------>     UI     |                                        |    Engine    |     |  Engine  |
                  |  (usually  +---------------------------------------->    Runner    +---->+   Exec   |
     +------------>    main)   |                                        |              |     |          |
     |            |            |      XXXXXXXXXXXXXXXXXXXXXXXXXXXX      |              |     +----------+
     |            +-+----------+      X   Manager connects UI    X      +--------------+
+----+---+          |                 X   to Engine Runner       X
|        |          |                 XXXXXXXXXXXXXXXXXXXXXXXXXXXX
| Write  <----------+
|        |
+--------+

sand.UI is a struct that is provided for you and is implemented as broad as possible; however there are few features missing, which are commonly found in popular interpreters, namely: Line history and Auto-completion. These features may be added later, but as for now they are not planned for.

sand.Engine is an interface, which must be implemented by the user. Implementations of sand.Engine must have a comparable underlying type, see Go Spec for comparable types in Go.