// THIS IS AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
// Generated using github.com/1pkg/gofire 🔥 2021-10-25T19:12:53+02:00.
package main

import (
	"context"
	"flag"
	"fmt"
	"os"
	"os/signal"
)

// CommandGofireFlag is autogenerated cli interface for Gofire function.
func CommandGofireFlag(ctx context.Context) (err error) {
	var driver *string
	var pckg *string
	var a0 string
	var a1 string
	if err = func(ctx context.Context) (err error) {
		defer func() {
			if err != nil {
				flag.Usage()
			}
		}()
		var driver_ string
		flag.StringVar(&driver_, "driver", "", " ")
		var pckg_ string
		flag.StringVar(&pckg_, "pckg", "", " ")
		flag.Usage = func() {
			doc, usage, list := "Gofire 🔥 is command line interface generator tool.\nThe first required argument dir represents directory path of source package.\nThe second required argument fun represents source function name.\nOptional flag driver represents driver backend name, one of [flag, pflag, cobra, reftype, bubbletea], flag by default.\nOptional flag pckg represents source package name, useful if package name and directory is different, last element of dir by default.", "Gofire -driver=\"\" -pckg=\"\" arg0 arg1 [-help -h]", "func Gofire(ctx context.Context, driver, pckg *string, dir, fun string), -driver string (default \"\") -pckg string (default \"\") arg 0 string arg 1 string"
			if doc != "" {
				_, _ = fmt.Fprintln(flag.CommandLine.Output(), doc)
			}
			if usage != "" {
				_, _ = fmt.Fprintln(flag.CommandLine.Output(), usage)
			}
			if list != "" {
				_, _ = fmt.Fprintln(flag.CommandLine.Output(), list)
			}
		}
		flag.Parse()
		{
			v := string(driver_)
			driver = &v
		}
		{
			v := string(pckg_)
			pckg = &v
		}
		{
			const i = 0
			if flag.NArg() <= i {
				return fmt.Errorf("argument %d-th is required", i)
			}
			a0 = flag.Arg(i)
		}
		{
			const i = 1
			if flag.NArg() <= i {
				return fmt.Errorf("argument %d-th is required", i)
			}
			a1 = flag.Arg(i)
		}
		return
	}(ctx); err != nil {
		return
	}
	Gofire(ctx, driver, pckg, a0, a1)
	return
}

// auto generated main entrypoint.
func main() {
	ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
	defer stop()
	func(err error) {
		if err != nil {
			fmt.Println(err)
			os.Exit(2)
		}
	}(CommandGofireFlag(ctx))
}
