Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

sShell - A simple golang shell library

installation

go get github.com/theskibb/sShell

you can now import the library with

import(
    "github.com/theskibb/sShell/sShell"
)

how to use

to create a shell using the library you need to create a ShellSettings struct

ShellSettings needs three fields:

  • Prompt: the prompt indicator for the shell
  • ExitMsg: typing this message will stop the shell
  • Commands: an array of Command structs
  • DefaultHandler: handles inputs which are not in the commands array
    • needs to be a func(args []string) string
  • SingleMode: boolean. if set to true, you only get to do one command, the result of which is returned from the StartShell function

Command structs need three fields:

  • Input: the command name you write into the shell
  • handler: the function which will execute when you run the command
    • needs to be a func(args []string) string
  • HelpMsg: the string which will be displayed for this command when you run help

examples

for examples of how to use the library, see the examples folder.

About

simple library for creating shells in golang

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages