boaconstructor

package module
v0.0.0-...-42d8cf4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2024 License: MIT Imports: 20 Imported by: 0

README

package boaconstructor

Package boaconstructor is the implementation of the boa-constructor GUI app that lets the user lay out the cli of their command line app by filling in text fields, checking boxes and selecting from drop down selectors. The names of allowable commands and flags along with the number, type and optional/required status of the parameters to said commands and flags can be defined. Where possible validation is done to catch command line input errors by users of the app being defined During the design stages your work can be saved and recalled for editing. The preferred format is now JSON, although the original format is still viable and not going away any time soon. Saving and using the original format may still be the best choice if you intend to edit it by hand using a text editor. The input script format is based on the format used by docopt where the user creates a usage/help text that is parsed and a map created of the command line args actually received. Now that the GUI is available the hand written input script has been largely superseded by the JSON format generated by the GUI. The JSON data generated by boa-constructor can be passed to the Boa package function boa.FromJSON(jsonData string, args [] string) from your app and your app will receive a data structure containing the command line args with parameters etc. The same map will be obtained by passing to boa.FromHelp(help string,args [] string), a proper input script aka usage string aka help string. Go code to start your app, get and evaluate the commands received, and implement the help command can be generated from the GUI. The current implementation creates three files, main.go, runner.go and help.go

Documentation

Overview

Package boaconstructor is the implementation of the boa-constructor GUI app that lets the user lay out the cli of their command line app by filling in text fields, checking boxes and selecting from drop down selectors. The names of allowable commands and flags along with the number, type and optional/required status of the parameters to said commands and flags can be defined. Where possible validation is done to catch command line input errors by users of the app being defined. During the design stages your work can be saved and recalled for editing. The preferred format is now JSON, although the original format is still viable and not going away any time soon. Saving and using the original format may still be the best choice if you intend to edit it by hand using a text editor. The input script format is based on the format used by docopt where the user creates a usage/help text that is parsed and a map created of the command line args actually received. Docopt requires a more rigidly defined and formatted text. Now that the GUI is available the hand written input script has been largely superseded by the JSON format generated by the GUI. The JSON data generated by boa-constructor can be passed to the Boa package function boa.FromJSON(jsonData string, args []string) from your app and your app will receive a data structure containing the command line args with parameters etc. The same map will be obtained by passing to boa.FromHelp(help string, args []string), a proper inpu script aka usage string aka help string. Go code to start your app, get and evaluate the commands received, and implement the help command can be generated from the GUI. The current implementation creates three source files, main.go, runner.go and help.go

Index

Constants

View Source
const (
	Label1Text      = "Command"
	Label1TextFlag  = "Flag"
	Label2Text      = "Alias"
	Label3Text      = "Short Help"
	Label4Text      = "Long Help"
	Label5Text      = "Required With Other Commands/Flags"
	Label6Text      = "Required Or Other Commands/Flags"
	Label7Text      = "Code to Execute"
	Button1Text     = "Store/Next Command"
	Button1TextFlag = "Store/Next Flag"
	Button2Text     = "Previous Command"
	Button2TextFlag = "Previous Flag"
	Button3Text     = "Clear Command"
	Button3TextFlag = "Clear Flag"
	Button4Text     = "Save"
	InfoLabel1Text  = "Extra Data"
	Info1Text       = "Options "
	Info2Text       = "Command Parameter(s)"
	Info2TextFlag   = "Flag Parameter(s)"
	Info3Text       = "Command Parameter Type"
	Info3TextFlag   = "Flag Parameter Type"
	CheckText1      = "Default"
	CheckText2      = "Exclusive"
	CheckText3      = "Required"
	NELabelText     = "Fixed Number"
	Select1Text1    = "None"
	OptCheckText    = "Optional"
	Select1Text3    = "Fixed Number"
	Select1Text4    = "Variable Number"
	Select2Bool     = "Bool"
	Select2Str      = "String"
	Select2Int      = "Integer"
	Select2Float    = "Float"
	Select2Time     = "Time"
	Select2Duration = "Time Duration"
	Select2Date     = "Date"
	Select2Path     = "File Path"
	Select2URL      = "URL"
	Select2IP       = "IP Address"
	Select2Email    = "Email Address"
)
View Source
const (
	// Opens a json definition file
	FileItemOpen string = "Open"
	// Saves the current state to a json definition file
	FileItemSave = "Save"
	// Opens a script definition file
	FileItemOpenLegacy = "Open Script"
	// Saves the current state to a script definition file
	FileItemSaveLegacy = "Save Script"
	// Generates source code from the current  state
	FileItemGen = "Generate Code"
	// Clear all tabs and start fresh with verification if state changed
	EditItemClear = "Clear"
	// Refresh the preview screen
	EditItemPrev = "Refresh Preview"
	// Copy the preview screen to the system clipboard
	EditItemCopy = "Copy script to clipboard"
	// Copy the JSON formatted content to the system clipboard
	EditItemCopyJSON = "Copy JSON to clipboard"
	// Brief description of the app
	HelpItemAbout = "About"
	// View the readme file
	HelpItemHelp = "Help"
)

Variables

This section is empty.

Functions

func AssocString

func AssocString(c string) string

func ConstString

func ConstString(c string) string

func Run

func Run()

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL