config

package
v0.0.0-...-6ac6f58 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseDir = "/etc/bk_dist"
	RunDir  = ".tbs"

	OSWindows = "windows"
)

Variables

This section is empty.

Functions

func GetFile

func GetFile(filename string) string

GetFile get the config file from base dir

func GetRunFile

func GetRunFile(dir, filename string) string

GetRunFile get the runtime file from run dir

Types

type CmdReplaceRule

type CmdReplaceRule struct {
	Cmd    string   `json:"cmd" value:"" usage:"used to match target cmd, it's optional"`
	CmdWay MatchWay `json:"cmd_match_way" value:"match_equal" usage:"match way for cmd"`

	Anchor    string   `json:"anchor_key" value:"" usage:"anchor key to search, is can't be empty"`
	AnchorWay MatchWay `json:"anchor_match_way" value:"match_equal" usage:"match way for anchor"`

	ReplaceOffset int    `json:"replace_offset" value:"0" usage:"the offset with Anchor index, it can't out of range of parameter array"`
	SourceRegKey  string `json:"source_reg_key" value:"" usage:"the source key to be replaced specified by regex"`
	TargetKey     string `json:"target_key" value:"" usage:"the target key to be replaced"`
}

CmdReplaceRule define replace rules for input cmd

func (CmdReplaceRule) Replace

func (r CmdReplaceRule) Replace(cmd string, parameters []string)

Replace replace input parameters with this rule

type MatchWay

type MatchWay string

MatchWay define match way

const (
	MatchPrefix  MatchWay = "match_prefix"
	MatchSuffix  MatchWay = "match_suffix"
	MatchEqual   MatchWay = "match_equal"
	MatchInclude MatchWay = "match_include"
)

define match way

Jump to

Keyboard shortcuts

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