command

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MatchSymbol = iota + 1
	MatchWord
	MatchLookahead
)
View Source
const (
	PlantUMLEnvVar  = "SYSL_PLANTUML"
	PlantUMLDefault = "http://localhost:8080/plantuml"
)
View Source
const (
	UpTo                 = 0
	BBApplication        = 1
	BBEndpointCollection = 2
	BBCommandLine        = 3
)
View Source
const ArrowColorNone = "none"
View Source
const ComponentStart = `` /* 132-byte string literal not displayed */
View Source
const PumlHeader = `` /* 216-byte string literal not displayed */
View Source
const StateStart = `` /* 159-byte string literal not displayed */

Variables

View Source
var (
	Version   = "unspecified"
	GitCommit = "unspecified"
	BuildDate = "unspecified"
	BuildOS   = "unspecified"
)

Version - Binary version GitCommit - Commit SHA of the source code BuildDate - Binary build date BuildOS - Operating System used to build binary

Functions

func DeflateAndEncode

func DeflateAndEncode(text []byte) (string, error)

The functions below ported from https://github.com/dougn/python-plantuml/blob/master/plantuml.py

func DoConstructSequenceDiagrams

func DoConstructSequenceDiagrams(
	cmdContextParam *CmdContextParamSeqgen,
	model *sysl.Module,
	logger *logrus.Logger,
) (map[string]string, error)

func EnsureFlagsNonEmpty

func EnsureFlagsNonEmpty(cmd *kingpin.CmdClause, excludes ...string)

Helper function to validate that a set of command flags are not empty values

func GenerateDataModels

func GenerateDataModels(datagenParams *CmdContextParamDatagen,
	model *sysl.Module, logger *logrus.Logger) (map[string]string, error)

func GenerateDatabaseScripts added in v0.4.2

func GenerateDatabaseScripts(scriptParams *CmdDatabaseScriptParams, model *sysl.Module,
	logger *logrus.Logger) ([]database.ScriptOutput, error)

func GenerateIntegrations

func GenerateIntegrations(intgenParams *CmdContextParamIntgen,
	model *sysl.Module,
	logger *logrus.Logger) (map[string]string, error)

func GenerateModDatabaseScripts added in v0.4.2

func GenerateModDatabaseScripts(scriptParams *CmdDatabaseScriptParams, modelOld, modelNew *sysl.Module,
	logger *logrus.Logger) ([]database.ScriptOutput, error)

func GenerateView

func GenerateView(args *Args, params *IntsParam, mod *sysl.Module) string

func LoadSyslModule

func LoadSyslModule(root, filename string, fs afero.Fs, logger *logrus.Logger) (*sysl.Module, string, error)

func Main2

func Main2(
	args []string,
	fs afero.Fs,
	logger *logrus.Logger,
	main3 func(args []string, fs afero.Fs, logger *logrus.Logger) error,
) int

Main2 calls Main3 and handles any errors it returns. It takes its output streams and command-line arguments and even Main3 as parameters to support testability.

func Main3

func Main3(args []string, fs afero.Fs, logger *logrus.Logger) error

Main3 is the real main function. It takes its output streams and command-line arguments as parameters to support testability.

func MergeAttributes

func MergeAttributes(app, edpnt map[string]*sysl.Attribute) map[string]*sysl.Attribute

func OutputPlantuml

func OutputPlantuml(output, plantuml, umlInput string, fs afero.Fs) error

func ParseBlackBoxesFromArgument

func ParseBlackBoxesFromArgument(blackboxFlags map[string]string) [][]string

func Serialize

func Serialize(w io.Writer, delim string, node Node) error

Serialize serializes node to string

func TransformBlackBoxes

func TransformBlackBoxes(blackboxes []*sysl.Attribute) [][]string

func TransformBlackboxesToUptos

func TransformBlackboxesToUptos(m map[string]*Upto, bbs [][]string, uptoType UptoType)

Types

type AppDependency

type AppDependency struct {
	Self, Target AppElement
	Statement    *sysl.Statement
}

func (*AppDependency) String

func (dep *AppDependency) String() string

type AppElement

type AppElement struct {
	Name     string
	Endpoint string
}

type AppLabeler

type AppLabeler interface {
	LabelApp(appName, controls string, attrs map[string]*sysl.Attribute) string
}

type AppPair

type AppPair struct {
	Self   string
	Target string
}

type Args

type Args struct {
	// contains filtered or unexported fields
}

type ClassLabeler

type ClassLabeler interface {
	LabelClass(className string) string
}

type CmdContextParamCodegen

type CmdContextParamCodegen struct {
	// contains filtered or unexported fields
}

type CmdContextParamDatagen

type CmdContextParamDatagen struct {
	// contains filtered or unexported fields
}

type CmdContextParamIntgen

type CmdContextParamIntgen struct {
	// contains filtered or unexported fields
}

type CmdContextParamSeqgen

type CmdContextParamSeqgen struct {
	// contains filtered or unexported fields
}

type CmdDatabaseScriptParams added in v0.4.2

type CmdDatabaseScriptParams struct {
	// contains filtered or unexported fields
}

type CodeGenOutput

type CodeGenOutput struct {
	// contains filtered or unexported fields
}

func GenerateCode

func GenerateCode(
	codegenParams *CmdContextParamCodegen,
	model *sysl.Module, modelAppName string,
	fs afero.Fs, logger *logrus.Logger) ([]*CodeGenOutput, error)

GenerateCode transform input sysl model to code in the target language described by grammar and a sysl transform

type Command

type Command interface {
	Configure(*kingpin.Application) *kingpin.CmdClause
	Execute(ExecuteArgs) error
	Name() string
	MaxSyslModule() int
}

type DataModelParam

type DataModelParam struct {
	ClassLabeler
	// contains filtered or unexported fields
}

type DataModelView

type DataModelView struct {
	ClassLabeler
	// contains filtered or unexported fields
}

func MakeDataModelView

func MakeDataModelView(
	p ClassLabeler, mod *proto.Module, stringBuilder *strings.Builder,
	title, project string,
) *DataModelView

func (*DataModelView) GenerateDataView

func (v *DataModelView) GenerateDataView(dataParam *DataModelParam) string

func (*DataModelView) UniqueVarForAppName

func (v *DataModelView) UniqueVarForAppName(appName string) string

type Element

type Element interface {
	Accept(Visitor) error
}

type EndpointCollectionElement

type EndpointCollectionElement struct {
	// contains filtered or unexported fields
}

func MakeEndpointCollectionElement

func MakeEndpointCollectionElement(
	title string,
	endpoints []string,
	blackboxes map[string]*Upto,
) *EndpointCollectionElement

func (*EndpointCollectionElement) Accept

type EndpointElement

type EndpointElement struct {
	// contains filtered or unexported fields
}

func (*EndpointElement) Accept

func (e *EndpointElement) Accept(v Visitor) error

type EndpointLabeler

type EndpointLabeler interface {
	LabelEndpoint(*EndpointLabelerParam) string
}

type EndpointLabelerParam

type EndpointLabelerParam struct {
	EndpointName string
	Human        string
	HumanSender  string
	NeedsInt     string
	Args         string
	Patterns     string
	Controls     string
	Attrs        map[string]*sysl.Attribute
}

type EntityViewParam

type EntityViewParam struct {
	// contains filtered or unexported fields
}

type ExecuteArgs

type ExecuteArgs struct {
	Modules        []*sysl.Module
	Filesystem     afero.Fs
	Logger         *logrus.Logger
	DefaultAppName string
}

type FormatParser

type FormatParser struct {
	// contains filtered or unexported fields
}

func MakeFormatParser

func MakeFormatParser(fmtStr string) *FormatParser

func (*FormatParser) FmtOutput

func (fp *FormatParser) FmtOutput(appname, epname, eplongname string, attrs map[string]*sysl.Attribute) string

func (*FormatParser) FmtSeq

func (fp *FormatParser) FmtSeq(epname, eplongname string, attrs map[string]*sysl.Attribute) string

func (*FormatParser) LabelApp

func (fp *FormatParser) LabelApp(appname, controls string, attrs map[string]*sysl.Attribute) string

func (*FormatParser) LabelClass

func (fp *FormatParser) LabelClass(classname string) string

func (*FormatParser) LabelEndpoint

func (fp *FormatParser) LabelEndpoint(p *EndpointLabelerParam) string

func (*FormatParser) Parse

func (fp *FormatParser) Parse(attrs map[string]string) string

type IntsDiagramVisitor

type IntsDiagramVisitor struct {
	// contains filtered or unexported fields
}

func MakeIntsDiagramVisitor

func MakeIntsDiagramVisitor(
	mod *sysl.Module, stringBuilder *strings.Builder,
	drawableApps map[string]struct{}, project string,
) *IntsDiagramVisitor

func (*IntsDiagramVisitor) VarManagerForComponent

func (v *IntsDiagramVisitor) VarManagerForComponent(appName string, nameMap map[string]string) string

func (*IntsDiagramVisitor) VarManagerForEPA

func (v *IntsDiagramVisitor) VarManagerForEPA(name string) string

func (*IntsDiagramVisitor) VarManagerForTopState

func (v *IntsDiagramVisitor) VarManagerForTopState(appName string) string

type IntsParam

type IntsParam struct {
	// contains filtered or unexported fields
}

type Node

type Node []interface{}

Node can be string or node

type RelationshipParam

type RelationshipParam struct {
	Entity       string
	Relationship string
	Count        uint32
}

type SequenceDiagramVisitor

type SequenceDiagramVisitor struct {
	AppLabeler
	EndpointLabeler
	// contains filtered or unexported fields
}

func MakeSequenceDiagramVisitor

func MakeSequenceDiagramVisitor(
	a AppLabeler,
	e EndpointLabeler,
	w *SequenceDiagramWriter,
	m *sysl.Module,
	appName string,
	group string,
	logger *logrus.Logger,
) *SequenceDiagramVisitor

func (*SequenceDiagramVisitor) UniqueVarForAppName

func (v *SequenceDiagramVisitor) UniqueVarForAppName(appName string) string

func (*SequenceDiagramVisitor) Visit

func (v *SequenceDiagramVisitor) Visit(e Element) error

type SequenceDiagramWriter

type SequenceDiagramWriter struct {
	// contains filtered or unexported fields
}

func MakeSequenceDiagramWriter

func MakeSequenceDiagramWriter(autogenWarning bool, properties ...string) *SequenceDiagramWriter

func (*SequenceDiagramWriter) Activate

func (s *SequenceDiagramWriter) Activate(agent string)

func (*SequenceDiagramWriter) Activated

func (s *SequenceDiagramWriter) Activated(agent string, suppressed bool) func()

func (*SequenceDiagramWriter) Deactivate

func (s *SequenceDiagramWriter) Deactivate(agent string)

func (*SequenceDiagramWriter) Indent

func (s *SequenceDiagramWriter) Indent()

func (*SequenceDiagramWriter) String

func (s *SequenceDiagramWriter) String() string

func (*SequenceDiagramWriter) Unindent

func (s *SequenceDiagramWriter) Unindent()

func (*SequenceDiagramWriter) Write

func (s *SequenceDiagramWriter) Write(p []byte) (n int, err error)

func (*SequenceDiagramWriter) WriteByte

func (s *SequenceDiagramWriter) WriteByte(c byte) error

func (*SequenceDiagramWriter) WriteHead

func (s *SequenceDiagramWriter) WriteHead(v string) (int, error)

func (*SequenceDiagramWriter) WriteString

func (s *SequenceDiagramWriter) WriteString(v string) (n int, err error)

func (*SequenceDiagramWriter) WriteTo

func (s *SequenceDiagramWriter) WriteTo(w io.Writer) (n int64, err error)

type StatementElement

type StatementElement struct {
	EndpointElement
	// contains filtered or unexported fields
}

func (*StatementElement) Accept

func (e *StatementElement) Accept(v Visitor) error

type Upto

type Upto struct {
	VisitCount int
	Comment    string
	ValueType  UptoType
}

type UptoType

type UptoType int

type VarManager

type VarManager interface {
	UniqueVarForAppName(appName string) string
}

type Visitor

type Visitor interface {
	Visit(Element) error
}

Jump to

Keyboard shortcuts

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