Skip to content

lama2cmd

import "github.com/HexmosTech/lama2/lama2cmd"

Package `lama2cmd` provides CLI argument parsing facilities. It hosts the `Opts` structure to record user intentions

Index

func ArgParsing

func ArgParsing(o *Opts, version string)

func SetLSPServer

func SetLSPServer(server LSPServer)

type LSPServer

LSPServer defines the interface for starting an LSP server

type LSPServer interface {
    StartLspServer()
}

type Opts

The Opts structure stores user preferences, and is used throughout the module to make various decisions.

type Opts struct {
    Output   string `short:"o" long:"output" description:"Path to output JSON file to store logs, headers and result"`
    Verbose  []bool `short:"v" long:"verbose" description:"Show verbose debug information"`
    Prettify bool   `short:"b" long:"prettify" description:"Prettify specified .l2 file"`
    // Sort     bool   `short:"s" long:"sort" description:"Sort specification into recommended order"`
    Convert     string `short:"c" long:"convert" description:"Generate code in given language and library (ex: python.requests); reference: tinyurl.com/l2codegen"`
    Nocolor     bool   `short:"n" long:"nocolor" description:"Disable color in httpie output"`
    Update      bool   `short:"u" long:"update" description:"Update l2 binary to the latest released version (Linux/MacOS only)"`
    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"`
    Lsp         bool   `short:"z" long:"lsp" description:"Start the lsp server"`
    Version     bool   `long:"version" description:"Print Lama2 binary version"`

    Positional struct {
        LamaAPIFile string
    }   `positional-args:"yes"`
}

func GetAndValidateCmd

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