GithubHelp home page GithubHelp logo

cezidev / aesh Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aeshell/aesh

0.0 0.0 0.0 5.53 MB

Æsh is a Java library for handling console input.

Home Page: http://aeshell.github.com

License: Apache License 2.0

Java 100.00%

aesh's Introduction

Æsh (Another Extendable SHell)

Build Status

Æsh is a Java library to easily create commands through a well defined API. Æsh will take care of all the parsing and injection for your commands. Æsh uses the project 'aesh-readline' for it’s terminal/readline integration.

IMPORTANT:

We’re now heading into the final stages before we’ll tag an 1.0-alpha release. The master branch is fairly stable atm and the plan is to not change anything big in the upcoming weeks. We have released a snapshot version of 1.0 if you are eager to test. Just add this to your 'pom.xml':

<dependency>
  <groupId>org.aesh</groupId>
  <artifactId>aesh</artifactId>
  <version>1.0-SNAPSHOT</version>
</dependency>

'build.gradle' file.

dependencies {
    compile group: 'org.aesh', name: 'aesh', version: '1.0-SNAPSHOT'
}

Features:

Æsh is a library to easily create commands. We recommend using annotations as the default way of adding metadata for your commands, but we also have a builder API if that is preferred. Some of our features:

  • Easy to use API to create everything from simple to advanced commands

  • Supports different types of options (list, group, single) and arguments

  • Builtin completors for default values, booleans and files

  • Supports multiple hierarcy of sub commands eg: git rebase/pull/++

  • All option values and arguments are automatically injected during execution

  • Possible to add custom validators, activators, completors, converters, renderers and parsers

  • Automatically generates help/info text based on the metadata provided

  • Can add and remove commands during runtime

All the readline functionality included in 'aesh-readline', eg:

  • Line editing

  • History (search, persistence)

  • Completion

  • Masking

  • Undo and Redo

  • Paste buffer

  • Emacs and Vi editing mode

  • Supports POSIX OS’s and Windows

  • Easy to configure (history file & buffer size, edit mode, streams, possible to override terminal implementations, etc)

  • Support standard out and standard error

  • Redirect

  • Alias

  • Pipeline

How to build:

  • Æsh uses Gradle (http://gradle.org) as its build tool.

    • When you start a Gradle build via the wrapper [gradlew], Gradle will be automatically downloaded and used to run the build

      • Windows: gradlew.bat

      • Linux: gradlew

  • We also have a pom.xml included for you maven users out there.

To get going:

import org.aesh.command.Command;
import org.aesh.command.CommandDefinition;
import org.aesh.command.CommandException;
import org.aesh.command.CommandResult;
import org.aesh.command.impl.registry.AeshCommandRegistryBuilder;
import org.aesh.command.invocation.CommandInvocation;
import org.aesh.command.parser.CommandLineParserException;
import org.aesh.command.registry.CommandRegistry;
import org.aesh.console.settings.Settings;
import org.aesh.console.settings.SettingsBuilder;
import org.aesh.readline.ReadlineConsole;

import java.io.IOException;

public class SimpleExample {
    public static void main(String[] args) throws CommandLineParserException, IOException {
        CommandRegistry registry = new AeshCommandRegistryBuilder()
                .command(ExitCommand.class)
                .create();
        Settings settings = SettingsBuilder
                .builder()
                .commandRegistry(registry)
                .build();
        ReadlineConsole console = new ReadlineConsole(settings);
        console.setPrompt("[simple@aesh]$ ");
        console.start();
    }

    @CommandDefinition(name = "exit", description = "exit the program", aliases = {"quit"})
    public static class ExitCommand implements Command {
        @Override
        public CommandResult execute(CommandInvocation commandInvocation) throws CommandException, InterruptedException {
            commandInvocation.stop();
            return CommandResult.SUCCESS;
        }
    }
}

aesh's People

Contributors

adam-wyluda avatar aslakknutsen avatar balent avatar baranowb avatar brmeyer avatar danielsoro avatar gaol avatar gastaldi avatar gnodet avatar gonthim avatar hasalex avatar helio-frota avatar hokuda avatar jerr avatar jfdenise avatar jmartisk avatar johnaohara avatar koentsje avatar lincolnthree avatar mmarus avatar rhusar avatar ryanemerson avatar soul2zimate avatar stalep avatar tomashofman avatar vineetreynolds 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.