diff --git a/docs/Lama2/docs/tutorials/image.png b/docs/Lama2/docs/explanation/l2envOverideL2config.png similarity index 100% rename from docs/Lama2/docs/tutorials/image.png rename to docs/Lama2/docs/explanation/l2envOverideL2config.png diff --git a/docs/Lama2/docs/explanation/l2format.md b/docs/Lama2/docs/explanation/l2format.md index 916d6f1c..52067acd 100644 --- a/docs/Lama2/docs/explanation/l2format.md +++ b/docs/Lama2/docs/explanation/l2format.md @@ -134,7 +134,7 @@ The local variable's value is taken into consideration regardless of both files Get [Source Files](https://github.com/HexmosTech/Lama2/tree/main/examples/0020_override_project_root_local) -![Override of l2config.env with l2.env variable](image.png) +![Override of l2config.env with l2.env variable](l2envOverideL2config.png) #### The environment file can load results of commands diff --git a/docs/Lama2/docs/reference/cmdexec.md b/docs/Lama2/docs/reference/cmdexec.md index 1361e04a..37cb65c1 100644 --- a/docs/Lama2/docs/reference/cmdexec.md +++ b/docs/Lama2/docs/reference/cmdexec.md @@ -10,13 +10,14 @@ Package \`cmdexec\` provides a facility to execute l2 commands, stream output to ## Index -- [func ExecCommand(cmdSlice []string, stdinBody string, apiDir string) (httpie.ExResponse, error)](<#func-execcommand>) -- [func GenerateChainCode(httpRespBody string) string](<#func-generatechaincode>) -- [func GetJSVm() *goja.Runtime](<#func-getjsvm>) -- [func RunVMCode(jsCode string, vm *goja.Runtime)](<#func-runvmcode>) +- [func ExecCommand\(cmdSlice \[\]string, stdinBody string, apiDir string\) \(httpie.ExResponse, error\)](<#ExecCommand>) +- [func GenerateChainCode\(httpRespBody string\) string](<#GenerateChainCode>) +- [func GetJSVm\(\) \*goja.Runtime](<#GetJSVm>) +- [func RunVMCode\(jsCode string, vm \*goja.Runtime\)](<#RunVMCode>) -## func [ExecCommand]() + +## func [ExecCommand]() ```go func ExecCommand(cmdSlice []string, stdinBody string, apiDir string) (httpie.ExResponse, error) @@ -24,7 +25,8 @@ func ExecCommand(cmdSlice []string, stdinBody string, apiDir string) (httpie.ExR ExecCommand changes directory to the given \`apiDir\` and then executes the command specified in \`cmdStr\` During command execution, ExecCommand streams output to stdout. Once execution finishes, previous CWD is restored, and the command output is returned as a string -## func [GenerateChainCode]() + +## func [GenerateChainCode]() ```go func GenerateChainCode(httpRespBody string) string @@ -32,7 +34,8 @@ func GenerateChainCode(httpRespBody string) string GenerateChainCode takes in an HTTP response body and comes up with some JS code to define the "magic variable" result. What does the code do? The result is stored as a JS object, if the input value can be parsed as JSON. Otherwise the value is stored as a simple string. -## func [GetJSVm]() + +## func [GetJSVm]() ```go func GetJSVm() *goja.Runtime @@ -40,7 +43,8 @@ func GetJSVm() *goja.Runtime GetJSVm creates a new goja runtime instance with console.log enabled -## func [RunVMCode]() + +## func [RunVMCode]() ```go func RunVMCode(jsCode string, vm *goja.Runtime) @@ -48,6 +52,4 @@ func RunVMCode(jsCode string, vm *goja.Runtime) RunVMCode takes in a JS snippet as a string, executes the code in a JS VM, finally checks whether there are any errors, and if yes, logs the problem. Note: the vm runtime remains modified; so if you reuse the vm for other operations, the state from previous invocations carry over - - Generated by [gomarkdoc]() diff --git a/docs/Lama2/docs/reference/cmdgen.md b/docs/Lama2/docs/reference/cmdgen.md index a25fcbf0..2471e0c2 100644 --- a/docs/Lama2/docs/reference/cmdgen.md +++ b/docs/Lama2/docs/reference/cmdgen.md @@ -10,10 +10,11 @@ Package \`cmdgen\` provides an API to generate API request commands \(by default ## Index -- [func ConstructCommand(parsedInput *gabs.Container, o *lama2cmd.Opts) ([]string, string)](<#func-constructcommand>) +- [func ConstructCommand\(parsedInput \*gabs.Container, o \*lama2cmd.Opts\) \(\[\]string, string\)](<#ConstructCommand>) -## func [ConstructCommand]() + +## func [ConstructCommand]() ```go func ConstructCommand(parsedInput *gabs.Container, o *lama2cmd.Opts) ([]string, string) @@ -21,6 +22,4 @@ func ConstructCommand(parsedInput *gabs.Container, o *lama2cmd.Opts) ([]string, ConstructCommand extracts the HTTP verb, url and other API file inputs, figures out the type of target command and finally generates a string representing the generated command - - Generated by [gomarkdoc]() diff --git a/docs/Lama2/docs/reference/controller.md b/docs/Lama2/docs/reference/controller.md index 3c1c3d42..f3d79f68 100644 --- a/docs/Lama2/docs/reference/controller.md +++ b/docs/Lama2/docs/reference/controller.md @@ -10,38 +10,51 @@ Package controller coordinates all the other components in the \`Lama2\` project ## Index -- [func ExecuteProcessorBlock(block *gabs.Container, vm *goja.Runtime)](<#func-executeprocessorblock>) -- [func ExecuteRequestorBlock(block *gabs.Container, vm *goja.Runtime, opts *lama2cmd.Opts, dir string) httpie.ExResponse](<#func-executerequestorblock>) -- [func GetParsedAPIBlocks(parsedAPI *gabs.Container) []*gabs.Container](<#func-getparsedapiblocks>) -- [func HandleParsedFile(parsedAPI *gabs.Container, o *lama2cmd.Opts, dir string)](<#func-handleparsedfile>) -- [func Process(version string)](<#func-process>) +- [func ExecuteProcessorBlock\(block \*gabs.Container, vm \*goja.Runtime\)](<#ExecuteProcessorBlock>) +- [func ExecuteRequestorBlock\(block \*gabs.Container, vm \*goja.Runtime, opts \*lama2cmd.Opts, dir string\) httpie.ExResponse](<#ExecuteRequestorBlock>) +- [func GetParsedAPIBlocks\(parsedAPI \*gabs.Container\) \[\]\*gabs.Container](<#GetParsedAPIBlocks>) +- [func HandleParsedFile\(parsedAPI \*gabs.Container, o \*lama2cmd.Opts, dir string\)](<#HandleParsedFile>) +- [func Process\(version string\)](<#Process>) -## func [ExecuteProcessorBlock]() + +## func [ExecuteProcessorBlock]() ```go func ExecuteProcessorBlock(block *gabs.Container, vm *goja.Runtime) ``` -## func [ExecuteRequestorBlock]() + + + +## func [ExecuteRequestorBlock]() ```go func ExecuteRequestorBlock(block *gabs.Container, vm *goja.Runtime, opts *lama2cmd.Opts, dir string) httpie.ExResponse ``` -## func [GetParsedAPIBlocks]() + + + +## func [GetParsedAPIBlocks]() ```go func GetParsedAPIBlocks(parsedAPI *gabs.Container) []*gabs.Container ``` -## func [HandleParsedFile]() + + + +## func [HandleParsedFile]() ```go func HandleParsedFile(parsedAPI *gabs.Container, o *lama2cmd.Opts, dir string) ``` -## func [Process]() + + + +## func [Process]() ```go func Process(version string) @@ -49,6 +62,4 @@ func Process(version string) Process initiates the following tasks in the given order: 1. Parse command line arguments 2. Read API file contents 3. Expand environment variables in API file 4. Parse the API contents 5. Generate API request command 6. Execute command & retrieve results 7. Optionally, post\-process and write results to a JSON file - - Generated by [gomarkdoc]() diff --git a/docs/Lama2/docs/reference/lama2cmd.md b/docs/Lama2/docs/reference/lama2cmd.md index 4f7b0dfe..f530d414 100644 --- a/docs/Lama2/docs/reference/lama2cmd.md +++ b/docs/Lama2/docs/reference/lama2cmd.md @@ -10,18 +10,22 @@ Package \`lama2cmd\` provides CLI argument parsing facilities. It hosts the \`Op ## Index -- [func ArgParsing(o *Opts, version string)](<#func-argparsing>) -- [type Opts](<#type-opts>) - - [func GetAndValidateCmd(ipArgs []string) *Opts](<#func-getandvalidatecmd>) +- [func ArgParsing\(o \*Opts, version string\)](<#ArgParsing>) +- [type Opts](<#Opts>) + - [func GetAndValidateCmd\(ipArgs \[\]string\) \*Opts](<#GetAndValidateCmd>) -## func [ArgParsing]() + +## func [ArgParsing]() ```go func ArgParsing(o *Opts, version string) ``` -## type [Opts]() + + + +## type [Opts]() The Opts structure stores user preferences, and is used throughout the module to make various decisions. @@ -37,6 +41,7 @@ type Opts struct { PostmanFile string `short:"p" long:"postmanfile" description:"JSON export from Postman (Settings -> Data -> Export Data)"` LamaDir string `short:"l" long:"lama2dir" description:"Output directory to put .l2 files after conversion from Postman format"` Help bool `short:"h" long:"help" group:"AddHelp" description:"Usage help for Lama2"` + Env bool `short:"e" long:"env" description:"Get a JSON of environment variables"` Version bool `long:"version" description:"Print Lama2 binary version"` Positional struct { @@ -45,7 +50,8 @@ type Opts struct { } ``` -### func [GetAndValidateCmd]() + +### func [GetAndValidateCmd]() ```go func GetAndValidateCmd(ipArgs []string) *Opts @@ -53,6 +59,4 @@ func GetAndValidateCmd(ipArgs []string) *Opts GetAndValidateCmd takes in the user's CLI input, and checks for validity. If not OK, displays a help message in stdout. Otherwise, fills the Opts structure and returns it Moreover, based on user input, the outputManager gets configured \(whether user prefers trace/debug/info level\) - - Generated by [gomarkdoc]() diff --git a/docs/Lama2/docs/reference/outputmanager.md b/docs/Lama2/docs/reference/outputmanager.md index 2c1917c4..6d1a4501 100644 --- a/docs/Lama2/docs/reference/outputmanager.md +++ b/docs/Lama2/docs/reference/outputmanager.md @@ -11,20 +11,21 @@ Package \`outputmanager\` provides facilities for controlling the logging librar ## Index - [Variables](<#variables>) -- [func ConfigureZeroLog(level string)](<#func-configurezerolog>) -- [func ResponseToJSON(resp httpie.ExResponse) (*gabs.Container, error)](<#func-responsetojson>) -- [func WriteJSONOutput(resp httpie.ExResponse, targetPath string)](<#func-writejsonoutput>) +- [func ConfigureZeroLog\(level string\)](<#ConfigureZeroLog>) +- [func ResponseToJSON\(resp httpie.ExResponse\) \(\*gabs.Container, error\)](<#ResponseToJSON>) +- [func WriteJSONOutput\(resp httpie.ExResponse, targetPath string\)](<#WriteJSONOutput>) ## Variables -LogBuff is used to append various log statements into memory. If the user toggles the \`Output \(\-o\)\` option, then the contents of LogBuff is pushed into a JSON file +LogBuff is used to append various log statements into memory. If the user toggles the \`Output \(\-o\)\` option, then the contents of LogBuff is pushed into a JSON file ```go var LogBuff bytes.Buffer ``` -## func [ConfigureZeroLog]() + +## func [ConfigureZeroLog]() ```go func ConfigureZeroLog(level string) @@ -32,13 +33,17 @@ func ConfigureZeroLog(level string) ConfigureZeroLog provides global log level setting. By default, ZeroLog uses the DEBUG level; however, the function makes the desired level more explicit -## func [ResponseToJSON]() + +## func [ResponseToJSON]() ```go func ResponseToJSON(resp httpie.ExResponse) (*gabs.Container, error) ``` -## func [WriteJSONOutput]() + + + +## func [WriteJSONOutput]() ```go func WriteJSONOutput(resp httpie.ExResponse, targetPath string) @@ -46,6 +51,4 @@ func WriteJSONOutput(resp httpie.ExResponse, targetPath string) WriteJSONOutput is primarily built for helping with Extension/Integration building with external tools. Extension writers may simply call \`l2 \-n \-o /tmp/lama2.json ...\` to invoke WriteJSONOutput; the generated json file contains three keys: \`logs\`, \`headers\`, \`body\` - - Generated by [gomarkdoc]() diff --git a/docs/Lama2/docs/reference/parser.md b/docs/Lama2/docs/reference/parser.md index b2bfaa34..5ef8ca8e 100644 --- a/docs/Lama2/docs/reference/parser.md +++ b/docs/Lama2/docs/reference/parser.md @@ -13,73 +13,76 @@ The \`Parser\` struct is supposed to be extended to support parsing a new langua ## Index - [Variables](<#variables>) -- [func CustomPairMerge(destination, source interface{}) interface{}](<#func-custompairmerge>) -- [type Lama2Parser](<#type-lama2parser>) - - [func NewLama2Parser() *Lama2Parser](<#func-newlama2parser>) - - [func (p *Lama2Parser) AnyType() (*gabs.Container, error)](<#func-lama2parser-anytype>) - - [func (p *Lama2Parser) Boolean() (*gabs.Container, error)](<#func-lama2parser-boolean>) - - [func (p *Lama2Parser) ComplexType() (*gabs.Container, error)](<#func-lama2parser-complextype>) - - [func (p *Lama2Parser) DataHeader() (*gabs.Container, error)](<#func-lama2parser-dataheader>) - - [func (p *Lama2Parser) DataInput() (*gabs.Container, error)](<#func-lama2parser-datainput>) - - [func (p *Lama2Parser) Details() (*gabs.Container, error)](<#func-lama2parser-details>) - - [func (p *Lama2Parser) Digit() (*gabs.Container, error)](<#func-lama2parser-digit>) - - [func (p *Lama2Parser) Digits() (*gabs.Container, error)](<#func-lama2parser-digits>) - - [func (p *Lama2Parser) Exponent() (*gabs.Container, error)](<#func-lama2parser-exponent>) - - [func (p *Lama2Parser) FilesPair() (*gabs.Container, error)](<#func-lama2parser-filespair>) - - [func (p *Lama2Parser) FilesUnquoted() (*gabs.Container, error)](<#func-lama2parser-filesunquoted>) - - [func (p *Lama2Parser) Fraction() (*gabs.Container, error)](<#func-lama2parser-fraction>) - - [func (p *Lama2Parser) FractionRule1() (*gabs.Container, error)](<#func-lama2parser-fractionrule1>) - - [func (p *Lama2Parser) HTTPVerb() (*gabs.Container, error)](<#func-lama2parser-httpverb>) - - [func (p *Lama2Parser) HeaderData() (*gabs.Container, error)](<#func-lama2parser-headerdata>) - - [func (p *Lama2Parser) HeaderPair() (*gabs.Container, error)](<#func-lama2parser-headerpair>) - - [func (p *Lama2Parser) Headers() (*gabs.Container, error)](<#func-lama2parser-headers>) - - [func (p *Lama2Parser) Integer() (*gabs.Container, error)](<#func-lama2parser-integer>) - - [func (p *Lama2Parser) IntegerRule1() (*gabs.Container, error)](<#func-lama2parser-integerrule1>) - - [func (p *Lama2Parser) IntegerRule2() (*gabs.Container, error)](<#func-lama2parser-integerrule2>) - - [func (p *Lama2Parser) IntegerRule3() (*gabs.Container, error)](<#func-lama2parser-integerrule3>) - - [func (p *Lama2Parser) IntegerRule4() (*gabs.Container, error)](<#func-lama2parser-integerrule4>) - - [func (p *Lama2Parser) Lama2File() (*gabs.Container, error)](<#func-lama2parser-lama2file>) - - [func (p *Lama2Parser) List() (*gabs.Container, error)](<#func-lama2parser-list>) - - [func (p *Lama2Parser) Map() (*gabs.Container, error)](<#func-lama2parser-map>) - - [func (p *Lama2Parser) Multipart() (*gabs.Container, error)](<#func-lama2parser-multipart>) - - [func (p *Lama2Parser) Null() (*gabs.Container, error)](<#func-lama2parser-null>) - - [func (p *Lama2Parser) Number() (*gabs.Container, error)](<#func-lama2parser-number>) - - [func (p *Lama2Parser) OneNine() (*gabs.Container, error)](<#func-lama2parser-onenine>) - - [func (p *Lama2Parser) Pair() (*gabs.Container, error)](<#func-lama2parser-pair>) - - [func (p *Lama2Parser) PrimitiveType() (*gabs.Container, error)](<#func-lama2parser-primitivetype>) - - [func (p *Lama2Parser) Processor() (*gabs.Container, error)](<#func-lama2parser-processor>) - - [func (p *Lama2Parser) QuotedString() (*gabs.Container, error)](<#func-lama2parser-quotedstring>) - - [func (p *Lama2Parser) Requester() (*gabs.Container, error)](<#func-lama2parser-requester>) - - [func (p *Lama2Parser) Separator() (*gabs.Container, error)](<#func-lama2parser-separator>) - - [func (p *Lama2Parser) Sign() (*gabs.Container, error)](<#func-lama2parser-sign>) - - [func (p *Lama2Parser) Start() (*gabs.Container, error)](<#func-lama2parser-start>) - - [func (p *Lama2Parser) TheURL() (*gabs.Container, error)](<#func-lama2parser-theurl>) - - [func (p *Lama2Parser) Unquoted() (*gabs.Container, error)](<#func-lama2parser-unquoted>) - - [func (p *Lama2Parser) VarJSON() (*gabs.Container, error)](<#func-lama2parser-varjson>) - - [func (p *Lama2Parser) VarJSONPair() (*gabs.Container, error)](<#func-lama2parser-varjsonpair>) - - [func (p *Lama2Parser) VarJSONUnquoted() (*gabs.Container, error)](<#func-lama2parser-varjsonunquoted>) -- [type MinimalParser](<#type-minimalparser>) -- [type Parser](<#type-parser>) - - [func (p *Parser) Char() (rune, error)](<#func-parser-char>) - - [func (p *Parser) CharClass(charClass string) (rune, error)](<#func-parser-charclass>) - - [func (p *Parser) Init()](<#func-parser-init>) - - [func (p *Parser) Keyword(kw string, eatWsStart bool, eatWsEnd bool, caseInsensitive bool) ([]rune, error)](<#func-parser-keyword>) - - [func (p *Parser) LookAhead(rules []string) bool](<#func-parser-lookahead>) - - [func (p *Parser) Match(rules []string) (*gabs.Container, error)](<#func-parser-match>) - - [func (p *Parser) MatchUntil(end string) (*gabs.Container, error)](<#func-parser-matchuntil>) - - [func (p *Parser) Parse(text string) (*gabs.Container, error)](<#func-parser-parse>) - - [func (p *Parser) SetText(text string)](<#func-parser-settext>) - - [func (p *Parser) SplitCharRanges(charClass string) ([]string, error)](<#func-parser-splitcharranges>) - - [func (p *Parser) Start() *gabs.Container](<#func-parser-start>) +- [func CustomPairMerge\(destination, source interface\{\}\) interface\{\}](<#CustomPairMerge>) +- [type Lama2Parser](<#Lama2Parser>) + - [func NewLama2Parser\(\) \*Lama2Parser](<#NewLama2Parser>) + - [func \(p \*Lama2Parser\) AnyType\(\) \(\*gabs.Container, error\)](<#Lama2Parser.AnyType>) + - [func \(p \*Lama2Parser\) Boolean\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Boolean>) + - [func \(p \*Lama2Parser\) ComplexType\(\) \(\*gabs.Container, error\)](<#Lama2Parser.ComplexType>) + - [func \(p \*Lama2Parser\) DataHeader\(\) \(\*gabs.Container, error\)](<#Lama2Parser.DataHeader>) + - [func \(p \*Lama2Parser\) DataInput\(\) \(\*gabs.Container, error\)](<#Lama2Parser.DataInput>) + - [func \(p \*Lama2Parser\) Details\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Details>) + - [func \(p \*Lama2Parser\) Digit\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Digit>) + - [func \(p \*Lama2Parser\) Digits\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Digits>) + - [func \(p \*Lama2Parser\) Exponent\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Exponent>) + - [func \(p \*Lama2Parser\) FilesPair\(\) \(\*gabs.Container, error\)](<#Lama2Parser.FilesPair>) + - [func \(p \*Lama2Parser\) FilesUnquoted\(\) \(\*gabs.Container, error\)](<#Lama2Parser.FilesUnquoted>) + - [func \(p \*Lama2Parser\) Fraction\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Fraction>) + - [func \(p \*Lama2Parser\) FractionRule1\(\) \(\*gabs.Container, error\)](<#Lama2Parser.FractionRule1>) + - [func \(p \*Lama2Parser\) HTTPVerb\(\) \(\*gabs.Container, error\)](<#Lama2Parser.HTTPVerb>) + - [func \(p \*Lama2Parser\) HeaderData\(\) \(\*gabs.Container, error\)](<#Lama2Parser.HeaderData>) + - [func \(p \*Lama2Parser\) HeaderPair\(\) \(\*gabs.Container, error\)](<#Lama2Parser.HeaderPair>) + - [func \(p \*Lama2Parser\) Headers\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Headers>) + - [func \(p \*Lama2Parser\) Integer\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Integer>) + - [func \(p \*Lama2Parser\) IntegerRule1\(\) \(\*gabs.Container, error\)](<#Lama2Parser.IntegerRule1>) + - [func \(p \*Lama2Parser\) IntegerRule2\(\) \(\*gabs.Container, error\)](<#Lama2Parser.IntegerRule2>) + - [func \(p \*Lama2Parser\) IntegerRule3\(\) \(\*gabs.Container, error\)](<#Lama2Parser.IntegerRule3>) + - [func \(p \*Lama2Parser\) IntegerRule4\(\) \(\*gabs.Container, error\)](<#Lama2Parser.IntegerRule4>) + - [func \(p \*Lama2Parser\) Lama2File\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Lama2File>) + - [func \(p \*Lama2Parser\) List\(\) \(\*gabs.Container, error\)](<#Lama2Parser.List>) + - [func \(p \*Lama2Parser\) Map\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Map>) + - [func \(p \*Lama2Parser\) Multipart\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Multipart>) + - [func \(p \*Lama2Parser\) Null\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Null>) + - [func \(p \*Lama2Parser\) Number\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Number>) + - [func \(p \*Lama2Parser\) OneNine\(\) \(\*gabs.Container, error\)](<#Lama2Parser.OneNine>) + - [func \(p \*Lama2Parser\) Pair\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Pair>) + - [func \(p \*Lama2Parser\) PrimitiveType\(\) \(\*gabs.Container, error\)](<#Lama2Parser.PrimitiveType>) + - [func \(p \*Lama2Parser\) Processor\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Processor>) + - [func \(p \*Lama2Parser\) QuotedString\(\) \(\*gabs.Container, error\)](<#Lama2Parser.QuotedString>) + - [func \(p \*Lama2Parser\) Requester\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Requester>) + - [func \(p \*Lama2Parser\) Separator\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Separator>) + - [func \(p \*Lama2Parser\) Sign\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Sign>) + - [func \(p \*Lama2Parser\) Start\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Start>) + - [func \(p \*Lama2Parser\) TheURL\(\) \(\*gabs.Container, error\)](<#Lama2Parser.TheURL>) + - [func \(p \*Lama2Parser\) Unquoted\(\) \(\*gabs.Container, error\)](<#Lama2Parser.Unquoted>) + - [func \(p \*Lama2Parser\) VarJSON\(\) \(\*gabs.Container, error\)](<#Lama2Parser.VarJSON>) + - [func \(p \*Lama2Parser\) VarJSONPair\(\) \(\*gabs.Container, error\)](<#Lama2Parser.VarJSONPair>) + - [func \(p \*Lama2Parser\) VarJSONUnquoted\(\) \(\*gabs.Container, error\)](<#Lama2Parser.VarJSONUnquoted>) +- [type MinimalParser](<#MinimalParser>) +- [type Parser](<#Parser>) + - [func \(p \*Parser\) Char\(\) \(rune, error\)](<#Parser.Char>) + - [func \(p \*Parser\) CharClass\(charClass string\) \(rune, error\)](<#Parser.CharClass>) + - [func \(p \*Parser\) Init\(\)](<#Parser.Init>) + - [func \(p \*Parser\) Keyword\(kw string, eatWsStart bool, eatWsEnd bool, caseInsensitive bool\) \(\[\]rune, error\)](<#Parser.Keyword>) + - [func \(p \*Parser\) LookAhead\(rules \[\]string\) bool](<#Parser.LookAhead>) + - [func \(p \*Parser\) Match\(rules \[\]string\) \(\*gabs.Container, error\)](<#Parser.Match>) + - [func \(p \*Parser\) MatchUntil\(end string\) \(\*gabs.Container, error\)](<#Parser.MatchUntil>) + - [func \(p \*Parser\) Parse\(text string\) \(\*gabs.Container, error\)](<#Parser.Parse>) + - [func \(p \*Parser\) SetText\(text string\)](<#Parser.SetText>) + - [func \(p \*Parser\) SplitCharRanges\(charClass string\) \(\[\]string, error\)](<#Parser.SplitCharRanges>) + - [func \(p \*Parser\) Start\(\) \*gabs.Container](<#Parser.Start>) ## Variables + + ```go var DataInputType string ``` -## func [CustomPairMerge]() + +## func [CustomPairMerge]() ```go func CustomPairMerge(destination, source interface{}) interface{} @@ -87,7 +90,10 @@ func CustomPairMerge(destination, source interface{}) interface{} CustomPairMerge uses a gabs feature to deal with merge conflicts. More here: https://github.com/HexmosTech/gabs/blob/master/gabs.go#L511 -## type [Lama2Parser]() + +## type [Lama2Parser]() + + ```go type Lama2Parser struct { @@ -97,7 +103,8 @@ type Lama2Parser struct { } ``` -### func [NewLama2Parser]() + +### func [NewLama2Parser]() ```go func NewLama2Parser() *Lama2Parser @@ -105,7 +112,8 @@ func NewLama2Parser() *Lama2Parser NewLama2Parser creates a new Lama2Parser and initializes it properly -### func \(\*Lama2Parser\) [AnyType]() + +### func \(\*Lama2Parser\) [AnyType]() ```go func (p *Lama2Parser) AnyType() (*gabs.Container, error) @@ -113,49 +121,71 @@ func (p *Lama2Parser) AnyType() (*gabs.Container, error) AnyType is the top\-most element of a JSON structure It consists of Complex and Primitive Types -### func \(\*Lama2Parser\) [Boolean]() + +### func \(\*Lama2Parser\) [Boolean]() ```go func (p *Lama2Parser) Boolean() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [ComplexType]() + + + +### func \(\*Lama2Parser\) [ComplexType]() ```go func (p *Lama2Parser) ComplexType() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [DataHeader]() + + + +### func \(\*Lama2Parser\) [DataHeader]() ```go func (p *Lama2Parser) DataHeader() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [DataInput]() + + + +### func \(\*Lama2Parser\) [DataInput]() ```go func (p *Lama2Parser) DataInput() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [Details]() + + + +### func \(\*Lama2Parser\) [Details]() ```go func (p *Lama2Parser) Details() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [Digit]() + + + +### func \(\*Lama2Parser\) [Digit]() ```go func (p *Lama2Parser) Digit() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [Digits]() + + + +### func \(\*Lama2Parser\) [Digits]() ```go func (p *Lama2Parser) Digits() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [Exponent]() + + + +### func \(\*Lama2Parser\) [Exponent]() ```go func (p *Lama2Parser) Exponent() (*gabs.Container, error) @@ -163,7 +193,8 @@ func (p *Lama2Parser) Exponent() (*gabs.Container, error) An Exponent consists of mandatory 'e' or 'E', optional Sign, followed by Digits -### func \(\*Lama2Parser\) [FilesPair]() + +### func \(\*Lama2Parser\) [FilesPair]() ```go func (p *Lama2Parser) FilesPair() (*gabs.Container, error) @@ -171,7 +202,8 @@ func (p *Lama2Parser) FilesPair() (*gabs.Container, error) FilesPair tries to match key and value separated by \`@\`. The key and value can either be a quoted string, or an unquoted Files Unquoted String. If there is no match for either, a ParseError is returned. -### func \(\*Lama2Parser\) [FilesUnquoted]() + +### func \(\*Lama2Parser\) [FilesUnquoted]() ```go func (p *Lama2Parser) FilesUnquoted() (*gabs.Container, error) @@ -179,13 +211,17 @@ func (p *Lama2Parser) FilesUnquoted() (*gabs.Container, error) FilesUnquoted matches a string of characters other than \`@\` and returns them as a String -### func \(\*Lama2Parser\) [Fraction]() + +### func \(\*Lama2Parser\) [Fraction]() ```go func (p *Lama2Parser) Fraction() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [FractionRule1]() + + + +### func \(\*Lama2Parser\) [FractionRule1]() ```go func (p *Lama2Parser) FractionRule1() (*gabs.Container, error) @@ -193,25 +229,35 @@ func (p *Lama2Parser) FractionRule1() (*gabs.Container, error) A Fraction consists of mandatory "." \(dot\), followed by Digits. -### func \(\*Lama2Parser\) [HTTPVerb]() + +### func \(\*Lama2Parser\) [HTTPVerb]() ```go func (p *Lama2Parser) HTTPVerb() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [HeaderData]() + + + +### func \(\*Lama2Parser\) [HeaderData]() ```go func (p *Lama2Parser) HeaderData() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [HeaderPair]() + + + +### func \(\*Lama2Parser\) [HeaderPair]() ```go func (p *Lama2Parser) HeaderPair() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [Headers]() + + + +### func \(\*Lama2Parser\) [Headers]() ```go func (p *Lama2Parser) Headers() (*gabs.Container, error) @@ -219,13 +265,17 @@ func (p *Lama2Parser) Headers() (*gabs.Container, error) Headers detects HTTP headers; essentially strings separated by ":" character -### func \(\*Lama2Parser\) [Integer]() + +### func \(\*Lama2Parser\) [Integer]() ```go func (p *Lama2Parser) Integer() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [IntegerRule1]() + + + +### func \(\*Lama2Parser\) [IntegerRule1]() ```go func (p *Lama2Parser) IntegerRule1() (*gabs.Container, error) @@ -233,7 +283,8 @@ func (p *Lama2Parser) IntegerRule1() (*gabs.Container, error) InterRule1 matches a Digit -### func \(\*Lama2Parser\) [IntegerRule2]() + +### func \(\*Lama2Parser\) [IntegerRule2]() ```go func (p *Lama2Parser) IntegerRule2() (*gabs.Container, error) @@ -241,7 +292,8 @@ func (p *Lama2Parser) IntegerRule2() (*gabs.Container, error) IntegerRule2 matches 1\-9 mandatorily, and then tries to follow it with Digits -### func \(\*Lama2Parser\) [IntegerRule3]() + +### func \(\*Lama2Parser\) [IntegerRule3]() ```go func (p *Lama2Parser) IntegerRule3() (*gabs.Container, error) @@ -249,7 +301,8 @@ func (p *Lama2Parser) IntegerRule3() (*gabs.Container, error) IntegerRule3 starts with a mandatory Sign, and follows with IntegerRule1 \(Digit\) -### func \(\*Lama2Parser\) [IntegerRule4]() + +### func \(\*Lama2Parser\) [IntegerRule4]() ```go func (p *Lama2Parser) IntegerRule4() (*gabs.Container, error) @@ -257,13 +310,17 @@ func (p *Lama2Parser) IntegerRule4() (*gabs.Container, error) IntegerRule4 starts with a mandatory Sign, and follows with IntegerRule2 -### func \(\*Lama2Parser\) [Lama2File]() + +### func \(\*Lama2Parser\) [Lama2File]() ```go func (p *Lama2Parser) Lama2File() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [List]() + + + +### func \(\*Lama2Parser\) [List]() ```go func (p *Lama2Parser) List() (*gabs.Container, error) @@ -271,7 +328,8 @@ func (p *Lama2Parser) List() (*gabs.Container, error) List is a slightly lenient version of standard JSON list. In Lama2 List, it is OK to have a trailing comma after the last element \(whereas in strict JSON, it is not OK to have trailing comma\) -### func \(\*Lama2Parser\) [Map]() + +### func \(\*Lama2Parser\) [Map]() ```go func (p *Lama2Parser) Map() (*gabs.Container, error) @@ -279,19 +337,26 @@ func (p *Lama2Parser) Map() (*gabs.Container, error) Map is a slightly lenient version of standard JSON map. In Lama2 Map, it is OK to have a trailing comma after the last element \(whereas in strict JSON, it is not OK to have trailing comma\) -### func \(\*Lama2Parser\) [Multipart]() + +### func \(\*Lama2Parser\) [Multipart]() ```go func (p *Lama2Parser) Multipart() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [Null]() + + + +### func \(\*Lama2Parser\) [Null]() ```go func (p *Lama2Parser) Null() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [Number]() + + + +### func \(\*Lama2Parser\) [Number]() ```go func (p *Lama2Parser) Number() (*gabs.Container, error) @@ -299,31 +364,44 @@ func (p *Lama2Parser) Number() (*gabs.Container, error) A Number consists of a mandatory integer part, and optional Fraction and Exponent parts. The Number method "collects" these three elements, converts them into a json.Number\(\) type, and finally returns the Number wrapped within a gabs Container -### func \(\*Lama2Parser\) [OneNine]() + +### func \(\*Lama2Parser\) [OneNine]() ```go func (p *Lama2Parser) OneNine() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [Pair]() + + + +### func \(\*Lama2Parser\) [Pair]() ```go func (p *Lama2Parser) Pair() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [PrimitiveType]() + + + +### func \(\*Lama2Parser\) [PrimitiveType]() ```go func (p *Lama2Parser) PrimitiveType() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [Processor]() + + + +### func \(\*Lama2Parser\) [Processor]() ```go func (p *Lama2Parser) Processor() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [QuotedString]() + + + +### func \(\*Lama2Parser\) [QuotedString]() ```go func (p *Lama2Parser) QuotedString() (*gabs.Container, error) @@ -331,7 +409,8 @@ func (p *Lama2Parser) QuotedString() (*gabs.Container, error) QuotedString accepts both single\-quoted and double\-quoted types of strings. Moreover, it can deal with unicode escape characters, control characters appropriately Ultimately, we get a string wrapped in a gabs container -### func \(\*Lama2Parser\) [Requester]() + +### func \(\*Lama2Parser\) [Requester]() ```go func (p *Lama2Parser) Requester() (*gabs.Container, error) @@ -339,19 +418,26 @@ func (p *Lama2Parser) Requester() (*gabs.Container, error) Requester applies the rule: HTTPVerb Multipart? TheURL Details? -### func \(\*Lama2Parser\) [Separator]() + +### func \(\*Lama2Parser\) [Separator]() ```go func (p *Lama2Parser) Separator() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [Sign]() + + + +### func \(\*Lama2Parser\) [Sign]() ```go func (p *Lama2Parser) Sign() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [Start]() + + + +### func \(\*Lama2Parser\) [Start]() ```go func (p *Lama2Parser) Start() (*gabs.Container, error) @@ -359,19 +445,26 @@ func (p *Lama2Parser) Start() (*gabs.Container, error) Start primarily calls the Lama2File method -### func \(\*Lama2Parser\) [TheURL]() + +### func \(\*Lama2Parser\) [TheURL]() ```go func (p *Lama2Parser) TheURL() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [Unquoted]() + + + +### func \(\*Lama2Parser\) [Unquoted]() ```go func (p *Lama2Parser) Unquoted() (*gabs.Container, error) ``` -### func \(\*Lama2Parser\) [VarJSON]() + + + +### func \(\*Lama2Parser\) [VarJSON]() ```go func (p *Lama2Parser) VarJSON() (*gabs.Container, error) @@ -379,7 +472,8 @@ func (p *Lama2Parser) VarJSON() (*gabs.Container, error) Method VarJSON behaves in two ways depending on whether \`multipart\` is true or not. If there is no multipart, then VarJSON tries to match one or more VarJSONPairs However, if there is multipart, we try to match zero or more VarJSON, followed by zero or more file fields \(separated by \`@\`\). If there is no match at all, we return a ParseError; otherwise the we return the parsed data. -### func \(\*Lama2Parser\) [VarJSONPair]() + +### func \(\*Lama2Parser\) [VarJSONPair]() ```go func (p *Lama2Parser) VarJSONPair() (*gabs.Container, error) @@ -387,7 +481,8 @@ func (p *Lama2Parser) VarJSONPair() (*gabs.Container, error) VarJSONPair tries to match key and value separated by \`=\`. The key and value can either be a quoted string, or an unquoted VarJSON unquoted string. If there is no match for either, a ParseError is returned. -### func \(\*Lama2Parser\) [VarJSONUnquoted]() + +### func \(\*Lama2Parser\) [VarJSONUnquoted]() ```go func (p *Lama2Parser) VarJSONUnquoted() (*gabs.Container, error) @@ -395,7 +490,8 @@ func (p *Lama2Parser) VarJSONUnquoted() (*gabs.Container, error) VarJSONUnquoted matches a string of characters other than \`=\` and returns them as a String -## type [MinimalParser]() + +## type [MinimalParser]() MinimalParser enforces concrete Types to have a Start\(\) method, from which parsing process begins. In the present case, \`Lama2Parser\` adds up dozens of of methods to implement \`.l2\` syntax @@ -405,7 +501,8 @@ type MinimalParser interface { } ``` -## type [Parser]() + +## type [Parser]() Struct Parser stores information about the parsing process throughout. 1. Text: Incoming text is stored as an array of runes, to correctly handle unicode characters 2. Pos: Indicates the index position in Text which has already been scanned; starts with \-1 3. TotalLen: Number of runes in the input 4. Pm: Composing an external MinimalParser \(such as Lama2Parser\) which builds upon Parser to provide the new language recognition capabilities 5. ruleMethodMap: Scans through Pm, and creates a mapping from method name to method value through reflection 6. LineNum: Number of normalized newlines found till now. Used in providing useful context in error messages @@ -422,13 +519,17 @@ type Parser struct { } ``` -### func \(\*Parser\) [Char]() + +### func \(\*Parser\) [Char]() ```go func (p *Parser) Char() (rune, error) ``` -### func \(\*Parser\) [CharClass]() + + + +### func \(\*Parser\) [CharClass]() ```go func (p *Parser) CharClass(charClass string) (rune, error) @@ -436,7 +537,8 @@ func (p *Parser) CharClass(charClass string) (rune, error) CharClass implements the familiar regex syntax for specifying ranges of characters that are deemed acceptable. A good description of CharClass is available here: Read the section "Processing Character Ranges" at https://www.booleanworld.com/building-recursive-descent-parsers-definitive-guide/ -### func \(\*Parser\) [Init]() + +### func \(\*Parser\) [Init]() ```go func (p *Parser) Init() @@ -444,7 +546,8 @@ func (p *Parser) Init() Method Init creates the most important data stucture for parsing: ruleMethodMap. We use reflection to create a mapping of each Pm.\ to \ -### func \(\*Parser\) [Keyword]() + +### func \(\*Parser\) [Keyword]() ```go func (p *Parser) Keyword(kw string, eatWsStart bool, eatWsEnd bool, caseInsensitive bool) ([]rune, error) @@ -452,13 +555,17 @@ func (p *Parser) Keyword(kw string, eatWsStart bool, eatWsEnd bool, caseInsensit Method Keyword is a versatile; it can eat whitespace before/after the expected string, and it can do an optionally case insensitive match for the keyword -### func \(\*Parser\) [LookAhead]() + +### func \(\*Parser\) [LookAhead]() ```go func (p *Parser) LookAhead(rules []string) bool ``` -### func \(\*Parser\) [Match]() + + + +### func \(\*Parser\) [Match]() ```go func (p *Parser) Match(rules []string) (*gabs.Container, error) @@ -466,13 +573,17 @@ func (p *Parser) Match(rules []string) (*gabs.Container, error) Method Match is the most important of all in the parser package. Match takes in a slice of rules \(essentially method names\), and then executes them one by one. On successful match, we return a gabs Container with \`error\` set to \`nil\` When a rule fails to match, we reset the scan position to initial position; moreover, we keep a continuous track of the farthest/longest match till present. The farthest match error is potentially the most useful error message to the user; thus, for error report, Match returns the farthest matching error -### func \(\*Parser\) [MatchUntil]() + +### func \(\*Parser\) [MatchUntil]() ```go func (p *Parser) MatchUntil(end string) (*gabs.Container, error) ``` -### func \(\*Parser\) [Parse]() + + + +### func \(\*Parser\) [Parse]() ```go func (p *Parser) Parse(text string) (*gabs.Container, error) @@ -480,7 +591,8 @@ func (p *Parser) Parse(text string) (*gabs.Container, error) Method Parse normalizes newlines and then creates a rune version of the input data. The Start\(\) method proceeds to process the rune version of data -### func \(\*Parser\) [SetText]() + +### func \(\*Parser\) [SetText]() ```go func (p *Parser) SetText(text string) @@ -488,13 +600,17 @@ func (p *Parser) SetText(text string) Method SetText is a utility used primarily in testing, when we don't want to call Start\(\) automatically as in Parse -### func \(\*Parser\) [SplitCharRanges]() + +### func \(\*Parser\) [SplitCharRanges]() ```go func (p *Parser) SplitCharRanges(charClass string) ([]string, error) ``` -### func \(\*Parser\) [Start]() + + + +### func \(\*Parser\) [Start]() ```go func (p *Parser) Start() *gabs.Container @@ -502,6 +618,4 @@ func (p *Parser) Start() *gabs.Container Start\(\) in Parser provides a dummy default implementation; the expectation is that the higher level Struct \(Pm\) will implement its own version - - Generated by [gomarkdoc]() diff --git a/docs/Lama2/docs/reference/preprocess.md b/docs/Lama2/docs/reference/preprocess.md index 050880bd..e839408e 100644 --- a/docs/Lama2/docs/reference/preprocess.md +++ b/docs/Lama2/docs/reference/preprocess.md @@ -10,17 +10,22 @@ Package preprocess provides facilities to expand environment variables in \`.l2\ ## Index -- [func Expand(s string, vm \*goja.Runtime, mapping map[string]string) string](#func-expand) -- [func ExpandEnv(s string, vm \*goja.Runtime) string](#func-expandenv) -- [func ExpandHeaders(block *gabs.Container, vm *goja.Runtime)](#func-expandheaders) -- [func ExpandJSON(block *gabs.Container, vm *goja.Runtime)](#func-expandjson) -- [func ExpandURL(block *gabs.Container, vm *goja.Runtime)](#func-expandurl) -- [func GetLamaFileAsString(path string) string](#func-getlamafileasstring) -- [func LamaFile(inputFile string) (string, string)](#func-lamafile) -- [func LoadEnvFile(l2path string)](#func-loadenvfile) -- [func ProcessVarsInBlock(block *gabs.Container, vm *goja.Runtime)](#func-processvarsinblock) - -## func [Expand](https://github.com/HexmosTech/Lama2/blob/master/preprocess/expandvar.go#L19) +- [func Expand\(s string, vm \*goja.Runtime, mapping map\[string\]string\) string](<#Expand>) +- [func ExpandEnv\(s string, vm \*goja.Runtime\) string](<#ExpandEnv>) +- [func ExpandHeaders\(block \*gabs.Container, vm \*goja.Runtime\)](<#ExpandHeaders>) +- [func ExpandJSON\(block \*gabs.Container, vm \*goja.Runtime\)](<#ExpandJSON>) +- [func ExpandURL\(block \*gabs.Container, vm \*goja.Runtime\)](<#ExpandURL>) +- [func GetL2EnvVariables\(dir string\) \(\[\]byte, error\)](<#GetL2EnvVariables>) +- [func GetLamaFileAsString\(path string\) string](<#GetLamaFileAsString>) +- [func LamaFile\(inputFile string\) \(string, string\)](<#LamaFile>) +- [func LoadEnvFile\(l2path string\)](<#LoadEnvFile>) +- [func LoadEnvironments\(dir string\)](<#LoadEnvironments>) +- [func ProcessVarsInBlock\(block \*gabs.Container, vm \*goja.Runtime\)](<#ProcessVarsInBlock>) +- [func SearchL2ConfigEnv\(dir string\) \(string, error\)](<#SearchL2ConfigEnv>) + + + +## func [Expand]() ```go func Expand(s string, vm *goja.Runtime, mapping map[string]string) string @@ -28,7 +33,8 @@ func Expand(s string, vm *goja.Runtime, mapping map[string]string) string Expand replaces $\{var\} or $var in the string based on the mapping function. For example, os.ExpandEnv\(s\) is equivalent to os.Expand\(s, os.Getenv\). -## func [ExpandEnv](https://github.com/HexmosTech/Lama2/blob/master/preprocess/expandvar.go#L74) + +## func [ExpandEnv]() ```go func ExpandEnv(s string, vm *goja.Runtime) string @@ -36,50 +42,94 @@ func ExpandEnv(s string, vm *goja.Runtime) string ExpandEnv replaces $\{var\} or $var in the string according to the values of the current environment variables. References to undefined variables are replaced by the empty string. -## func [ExpandHeaders](https://github.com/HexmosTech/Lama2/blob/master/preprocess/preprocess.go#L25) + +## func [ExpandHeaders]() ```go func ExpandHeaders(block *gabs.Container, vm *goja.Runtime) ``` -## func [ExpandJSON](https://github.com/HexmosTech/Lama2/blob/master/preprocess/preprocess.go#L77) + + + +## func [ExpandJSON]() ```go func ExpandJSON(block *gabs.Container, vm *goja.Runtime) ``` -## func [ExpandURL](https://github.com/HexmosTech/Lama2/blob/master/preprocess/preprocess.go#L45) + + + +## func [ExpandURL]() ```go func ExpandURL(block *gabs.Container, vm *goja.Runtime) ``` -## func [GetLamaFileAsString](https://github.com/HexmosTech/Lama2/blob/master/preprocess/preprocess.go#L104) + + + +## func [GetL2EnvVariables]() + +```go +func GetL2EnvVariables(dir string) ([]byte, error) +``` + + + + +## func [GetLamaFileAsString]() ```go func GetLamaFileAsString(path string) string ``` -## func [LamaFile](https://github.com/HexmosTech/Lama2/blob/master/preprocess/preprocess.go#L118) + + + +## func [LamaFile]() ```go func LamaFile(inputFile string) (string, string) ``` -LamaFile takes in a path to an API file. It moves into the API file directory, reads the API contents, loads the \`l2config.env\` root variable file from the project directory. +LamaFile takes in a path to an API file. It moves into the API file directory, reads the API contents, loads the \`l2.env\` file if available, and finally substitutes environment vars in the API contents Once done, it reverts back to the original directory, and returns the processed l2 file. -Then loads the \`l2.env\` local variables file from the present directory, Variables which are already declared in \`l2config.env\` will be overwritten with local variable of \`l2.env\`. Once done, it reverts back to the original directory, and returns the processed l2 file. - -## func [LoadEnvFile](https://github.com/HexmosTech/Lama2/blob/master/preprocess/preprocess.go#L97) + +## func [LoadEnvFile]() ```go func LoadEnvFile(l2path string) ``` -## func [ProcessVarsInBlock](https://github.com/HexmosTech/Lama2/blob/master/preprocess/preprocess.go#L19) + + + +## func [LoadEnvironments]() + +```go +func LoadEnvironments(dir string) +``` + + + + +## func [ProcessVarsInBlock]() ```go func ProcessVarsInBlock(block *gabs.Container, vm *goja.Runtime) ``` -Generated by [gomarkdoc](https://github.com/princjef/gomarkdoc) + + + +## func [SearchL2ConfigEnv]() + +```go +func SearchL2ConfigEnv(dir string) (string, error) +``` + + + +Generated by [gomarkdoc]() diff --git a/docs/Lama2/docs/reference/utils.md b/docs/Lama2/docs/reference/utils.md index 9ec6b236..ec886a97 100644 --- a/docs/Lama2/docs/reference/utils.md +++ b/docs/Lama2/docs/reference/utils.md @@ -10,21 +10,22 @@ Package \`utils\` provides useful functions for simplifying various programming ## Index -- [func ChangeWorkingDir(dir string)](<#func-changeworkingdir>) -- [func ContainsRune(s []rune, e rune) bool](<#func-containsrune>) -- [func ContainsString(s []string, e string) bool](<#func-containsstring>) -- [func ContainsStringPartial(s []string, e string) bool](<#func-containsstringpartial>) -- [func GetFilePathComponents(name string) (string, string, string)](<#func-getfilepathcomponents>) -- [func PrettyPrint(i interface{}) string](<#func-prettyprint>) -- [func SetJSON(parentObj *gabs.Container, childObj *gabs.Container, key string) *gabs.Container](<#func-setjson>) -- [func UnicodeCategory(r rune) string](<#func-unicodecategory>) -- [func UpdateSelf()](<#func-updateself>) -- [type ParseError](<#type-parseerror>) - - [func NewParseError(pos int, line int, msg string, args []string) *ParseError](<#func-newparseerror>) - - [func (p ParseError) Error() string](<#func-parseerror-error>) - - -## func [ChangeWorkingDir]() +- [func ChangeWorkingDir\(dir string\)](<#ChangeWorkingDir>) +- [func ContainsRune\(s \[\]rune, e rune\) bool](<#ContainsRune>) +- [func ContainsString\(s \[\]string, e string\) bool](<#ContainsString>) +- [func ContainsStringPartial\(s \[\]string, e string\) bool](<#ContainsStringPartial>) +- [func GetFilePathComponents\(name string\) \(string, string, string\)](<#GetFilePathComponents>) +- [func PrettyPrint\(i interface\{\}\) string](<#PrettyPrint>) +- [func SetJSON\(parentObj \*gabs.Container, childObj \*gabs.Container, key string\) \*gabs.Container](<#SetJSON>) +- [func UnicodeCategory\(r rune\) string](<#UnicodeCategory>) +- [func UpdateSelf\(\)](<#UpdateSelf>) +- [type ParseError](<#ParseError>) + - [func NewParseError\(pos int, line int, msg string, args \[\]string\) \*ParseError](<#NewParseError>) + - [func \(p ParseError\) Error\(\) string](<#ParseError.Error>) + + + +## func [ChangeWorkingDir]() ```go func ChangeWorkingDir(dir string) @@ -32,7 +33,8 @@ func ChangeWorkingDir(dir string) ChangeWorkingDirectory tries to set the CWD; on failure it exits with a log error message -## func [ContainsRune]() + +## func [ContainsRune]() ```go func ContainsRune(s []rune, e rune) bool @@ -40,7 +42,8 @@ func ContainsRune(s []rune, e rune) bool ContainsRune searches for rune \`e\` in a slice of runes \`s\`; returns a boolean -## func [ContainsString]() + +## func [ContainsString]() ```go func ContainsString(s []string, e string) bool @@ -48,7 +51,8 @@ func ContainsString(s []string, e string) bool ContainsString searches for string \`e\` in a slice of strings \`s\`; returns a boolean -## func [ContainsStringPartial]() + +## func [ContainsStringPartial]() ```go func ContainsStringPartial(s []string, e string) bool @@ -56,7 +60,8 @@ func ContainsStringPartial(s []string, e string) bool ContainsStringPartial substring\-searches for string \`e\` in a slice of strings \`s\`; returns a boolean -## func [GetFilePathComponents]() + +## func [GetFilePathComponents]() ```go func GetFilePathComponents(name string) (string, string, string) @@ -64,7 +69,8 @@ func GetFilePathComponents(name string) (string, string, string) GetFilePathComponent returns absolute path, directory, and filename given a filepath -## func [PrettyPrint]() + +## func [PrettyPrint]() ```go func PrettyPrint(i interface{}) string @@ -72,7 +78,8 @@ func PrettyPrint(i interface{}) string PrettyPrint takes in a generic interface\{\} objects and uses standard JSON capabilities to try to print with indentation -## func [SetJSON]() + +## func [SetJSON]() ```go func SetJSON(parentObj *gabs.Container, childObj *gabs.Container, key string) *gabs.Container @@ -80,7 +87,8 @@ func SetJSON(parentObj *gabs.Container, childObj *gabs.Container, key string) *g SetJSON is a helper function to work with the \`gabs\` library, which in turn is an API on top of the standard JSON library The function helps us create \`parentObj.key = childObj\` through using the \`Merge\` primitive available in \`gabs\` -## func [UnicodeCategory]() + +## func [UnicodeCategory]() ```go func UnicodeCategory(r rune) string @@ -88,7 +96,8 @@ func UnicodeCategory(r rune) string UnicodeCategory returns the Unicode Character Category of the given rune. -## func [UpdateSelf]() + +## func [UpdateSelf]() ```go func UpdateSelf() @@ -96,7 +105,10 @@ func UpdateSelf() UpdateSelf downloads the installation script from the official repository, and executes it to update the l2 binary to the latest version -## type [ParseError]() + +## type [ParseError]() + + ```go type ParseError struct { @@ -106,13 +118,17 @@ type ParseError struct { } ``` -### func [NewParseError]() + +### func [NewParseError]() ```go func NewParseError(pos int, line int, msg string, args []string) *ParseError ``` -### func \(ParseError\) [Error]() + + + +### func \(ParseError\) [Error]() ```go func (p ParseError) Error() string diff --git a/docs/Lama2/docs/tutorials/examples.md b/docs/Lama2/docs/tutorials/examples.md index a9029fde..e6adcf1e 100644 --- a/docs/Lama2/docs/tutorials/examples.md +++ b/docs/Lama2/docs/tutorials/examples.md @@ -100,7 +100,7 @@ export REMOTE="http://httpbin.org" ### Case 3: Override Root variable with local variable -![Override of l2config.env with l2.env variable](image.png) +![Override of l2config.env with l2.env variable](l2envOverideL2config.png) ## Headers diff --git a/docs/Lama2/docs/tutorials/l2envOverideL2config.png b/docs/Lama2/docs/tutorials/l2envOverideL2config.png new file mode 100644 index 00000000..df8b877f Binary files /dev/null and b/docs/Lama2/docs/tutorials/l2envOverideL2config.png differ diff --git a/docs/Lama2/site/404.html b/docs/Lama2/site/404.html index d2385a4d..1c3db304 100644 --- a/docs/Lama2/site/404.html +++ b/docs/Lama2/site/404.html @@ -10,7 +10,7 @@ - + diff --git a/docs/Lama2/site/about/contact.html b/docs/Lama2/site/about/contact.html index c0791a98..4a23f2ca 100644 --- a/docs/Lama2/site/about/contact.html +++ b/docs/Lama2/site/about/contact.html @@ -12,7 +12,7 @@ - + diff --git a/docs/Lama2/site/about/hexmos.html b/docs/Lama2/site/about/hexmos.html index ba7ca01d..f4ce681c 100644 --- a/docs/Lama2/site/about/hexmos.html +++ b/docs/Lama2/site/about/hexmos.html @@ -12,7 +12,7 @@ - + @@ -690,8 +690,8 @@

Hexmos

Through deep R&D, good software, relevant tools and techniques, we work to improve organizational health.

For a sample of our R&D, check these resources out:

    -
  1. 📕 Turnover and Other Organizational Ailments: A deeply research-backed exploration into the roots of organizational troubles and their cures, this book assimilates 80+ longitudinal and empirical studies to provide recommendations to improve organizational health.
  2. -
  3. 👍 Hexmos Feedback, a tool to provide continuous feedback to your colleagues, so that not a single beneficial thing said or done goes unnoticed
  4. +
  5. 📕 Turnover and Other Organizational Ailments: A deeply research-backed exploration into the roots of organizational troubles and their cures, this book assimilates 80+ longitudinal and empirical studies to provide recommendations to improve organizational health.
  6. +
  7. 👍 Hexmos Feedback, a tool to provide continuous feedback to your colleagues, so that not a single beneficial thing said or done goes unnoticed
diff --git a/docs/Lama2/site/explanation/faq.html b/docs/Lama2/site/explanation/faq.html index bce43578..6d802d16 100644 --- a/docs/Lama2/site/explanation/faq.html +++ b/docs/Lama2/site/explanation/faq.html @@ -12,7 +12,7 @@ - + diff --git a/docs/Lama2/site/explanation/l2envOverideL2config.png b/docs/Lama2/site/explanation/l2envOverideL2config.png new file mode 100644 index 00000000..df8b877f Binary files /dev/null and b/docs/Lama2/site/explanation/l2envOverideL2config.png differ diff --git a/docs/Lama2/site/explanation/l2format.html b/docs/Lama2/site/explanation/l2format.html index e2982f5a..aecc4b3b 100644 --- a/docs/Lama2/site/explanation/l2format.html +++ b/docs/Lama2/site/explanation/l2format.html @@ -12,7 +12,7 @@ - + @@ -531,11 +531,32 @@
  • - - Environments variables/commands can be defined in <requests_dir>/l2.env + + API variables can be defined in apirequest.l2 -
  • + +
  • + + API environment variables can be defined locally in l2.env + + +
  • + +
  • + + API environment variables can be defined at root using l2config.env + + +
  • + +
  • + + If l2config.env(root) variables are redeclared in l2.env(local) + + +