cmd

package
v0.0.0-...-3c36f29 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

* Copyright © 2020 stepsman authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright © 2020 stepsman authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright © 2020 stepsman authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright © 2020 stepsman authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright © 2020 stepsman authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright © 2020 stepsman authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright © 2020 stepsman authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

* Copyright © 2020 stepsman authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Index

Constants

View Source
const SeeLogMsg = " (use with \"--help\" or see stepsman.log file for more details ! \"tail ~/.stepsman/stepsman.log\")"
View Source
const TableWrapLen = 70

Variables

View Source
var BL *bl.BL
View Source
var LumberJack *lumberjack.Logger
View Source
var Parameters = AllParameters{
	CfgFile:        "",
	RunKey:         "",
	CreateFileName: "",
	Step:           "",
	Run:            "",
	InitialInput:   "",
	CurrentCommand: CommandUndetermined,
	CurrentRunId:   uuid.UUID{},
	FlagsReInit:    []func() error{},
}
View Source
var RootCmd = &cobra.Command{
	Use:   "stepsman",
	Short: "Step by step workflow manager",
	Long: `StepsMan is a step by step event driven business process and workflow manager.

hint: "stepsman prompt" will enter interactive mode`,
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		return PersistentPreRunE()
	},
}
View Source
var ServeCmd = &cobra.Command{
	Use:   "serve",
	Short: "serve will enter server mode and serve http requests",
	Long:  `Use serve to remote control stepsman via http. You can query, monitor and do remotely.`,
	Run: func(cmd *cobra.Command, args []string) {
		defer recoverAndLog("failed to serve")
		syncServeParams()
		if Parameters.InPromptMode {
			msg := "serve is not available from within prompt"
			Parameters.Err = &Error{
				Technical: fmt.Errorf(msg),
				Friendly:  msg,
			}
			return
		}
		serveServe.Serve(BL, Parameters.ServerAddress, Parameters.ServerPort, Parameters.ServerHealthPort)
	},
}
View Source
var StoreDir string

Functions

func Execute

func Execute() bool

Returns true on error

func Executor

func Executor(s string, wasEnter bool)

func InitConfig

func InitConfig()

func InitLogrus

func InitLogrus(out io.Writer, level log.Level)

func InitLogrusALL

func InitLogrusALL(out io.Writer, level log.Level)

func PersistentPreRunE

func PersistentPreRunE() error

func RenderStep

func RenderStep(stepRecord *api.StepRecord, script *bl.Template) (table.Writer, error)

func ResetCommandParameters

func ResetCommandParameters()

Types

type AllParameters

type AllParameters struct {
	// Flags
	GroupId             uuid.UUID
	GroupIdStr          string
	CfgFile             string
	DatabaseVendor      string
	DataSourceName      string
	DatabaseHost        string
	DatabasePort        int64
	DatabaseName        string
	DatabaseSSLMode     bool
	DatabaseAutoMigrate bool
	DatabaseUserName    string
	DatabasePassword    string
	DatabaseSchema      string
	CreateFileName      string
	FileType            string
	RunKey              string
	ServerPort          int64
	ServerAddress       string
	ServerHealthPort    int64
	Step                string
	OnlyTemplateType    string
	Run                 string
	Status              string
	Force               bool
	StatusOwner         string
	Context             string
	//ListQuery
	RangeStart       int64
	RangeEnd         int64
	RangeReturnTotal bool
	SortFields       []string
	SortOrder        string
	Filters          []string
	// Others
	InPromptMode     bool
	InitialInput     string
	CurrentCommand   CommandType
	CurrentStepIndex string
	CurrentRunId     uuid.UUID
	CurrentRun       *api.RunRecord
	FlagsReInit      []func() error
	Err              error
	Label            string
	State            string
}

type CommandType

type CommandType int
const (
	CommandUndetermined CommandType = iota
	CommandBang
	CommandCreateRun
	CommandDescribeRun
	CommandDoStep
	CommandListSteps
	CommandListRuns
	CommandGetRun
	CommandUpdateRun
	CommandUpdateStep
	CommandDeleteRun
)

type Error

type Error struct {
	Technical error
	Friendly  string
}

func (*Error) Error

func (ce *Error) Error() string

func (*Error) TechnicalError

func (ce *Error) TechnicalError() error

Jump to

Keyboard shortcuts

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