Coder Social home page Coder Social logo

interactive's Introduction

lukasmalkmus/interactive

Simple and easy interactive commandline applications. - by Lukas Malkmus

Travis Status Coverage Status Go Report GoDoc Latest Release License


Table of Contents

  1. Introduction
  2. Usage
  3. Contributing
  4. License

Introduction

This package is build on top of the excellent golang.org/x/crypto/ssh/terminal package and tries to simplify the creation of small and simple applications which run in shell mode. It isn't very powerful (yet) but has enough features for basic usage. For example it shuts down gracefully on Ctrl^C and Ctrl^D.

Todo

  • Tests!

Usage

Installation

Please use a dependency manager like glide to make sure you use a tagged release.

Install using go get:

go get -u github.com/lukasmalkmus/interactive

Minimum setup

A more complete example can be found here.

This small application echos the entered text:

s := interactive.New(">")
s.Action = func(c *interactive.Context) error {
    text, _ := c.Scan()
    c.Println(text)
    return nil
}
s.Run()

Returning an error instead of nil will print the error. Calling context.Close() will close the session with the specified exit code.

Contributing

Feel free to submit PRs or to fill Issues. Every kind of help is appreciated.

License

© Lukas Malkmus, 2017

Distributed under MIT License (The MIT License).

See LICENSE for more information.

interactive's People

Contributors

lukasmalkmus avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.