SerenadeMi
A dynamic menu system for writing BBsMi appllications and more
Table of Contents
Installation
go get github.com/BBsMi/SerenadeMi
Usage
Steps to use
Make sure your go.mod is correctly initalized for your project
go mod init (package url)
mkdir menu
import "(your package url)/menu"
Link your struct
Golang will not accept new functions added to an external package. To get around this we must declare we are extending the packages struct. In menu/types.go
:
package SerenadeMiFunctions
import "github.com/BBsMi/SerenadeMi"
type Inits SerenadeMi.Inits
func Init() Inits {
return Inits{}
}
Create your functions
Create your functions in ./menu
using some sort of standardize naming scheme (examples: F(function number).go
, (function short name).go
, (function number).go
) using the following template. Replace FXXX
with F and that functions number.
package SerenadeMiFunctions
import "github.com/BBsMi/SerenadeMi"
func (i *Inits) FXXX_Init() SerenadeMi.Entry { return nil }
func FXXX(attrib *interface{}) error { return nil }
Boilerplate ( go mod init myapp
with this example )
package main
import (
smf "myapp/menu"
"github.com/BBsMi/SerenadeMi"
)
func main() {
// Init our functions
om := smf.Init()
// Load menu into engine
smi := SerenadeMi.Init(&om)
smi.Spew()
// smi.Exec(uint(1))
// smi.Exec("hello")
// smi.Pager(uint(0), uint(100))
}
Support
Please open an issue for support.
Contributing
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.
License
(c) 2023 GNU AFFERO GENERAL PUBLIC LICENSE v3.0