Inspired by Google python-fire
fuego is a library for automatically generating command line interfaces (CLIs) from function and struct.
- fuego is a simple way to create a CLI in Go.
- fuego helps with exploring existing code or turning other people's code into a CLI. [1]
- fuego shows documentation of each method or functions for help.
go get github.com/corona10/fuego
- Support flag options
- More error handling
- Support more types
package main
import (
"fmt"
"github.com/corona10/fuego"
)
func Add(a int, b int) (int, int) {
fmt.Println(a, b)
return a + b, 2*a + b
}
func main() {
fuego.Fire(Add)
}
package main
import (
"fmt"
"github.com/corona10/fuego"
)
type Sample struct {
Name string
}
func (s Sample) Add(a, b int) int {
return a + b
}
func (s Sample) Minus(a, b int) int {
return a - b
}
func (s Sample) HelloWorld() {
fmt.Println(s.Name)
fmt.Println("Hello world!")
}
func main() {
var s Sample
s.Name = "test"
fuego.Fire(s)
}
- Haeun Kim
- Sebastien Binet: The contributor who proposed the name fuego.