Skip to content
/ fuego Public

fuego is a library for automatically generating command line interfaces (CLIs) from function and struct.

License

Notifications You must be signed in to change notification settings

corona10/fuego

Repository files navigation

Build Status GoDoc Go Report Card Coverage Status License

fuego

Inspired by Google python-fire

fuego is a library for automatically generating command line interfaces (CLIs) from function and struct.

Features

  • 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.

Installation

go get github.com/corona10/fuego

TODO

  • Support flag options
  • More error handling
  • Support more types

asciicast

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)
}

Special thanks to

About

fuego is a library for automatically generating command line interfaces (CLIs) from function and struct.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages