manage

package
v0.0.0-...-08ab71a Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright 2021 The Gong2 Authors Licensed under the GNU Lesser General Public License v3; you may not use this file except in compliance with the License.

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

This section is empty.

Variables

View Source
var LangExector *langExector

Functions

func DirectExec

func DirectExec(command string, arg ...string) (txt string, err error)

*

  • command direct exector
  • call carefully, such as rm shell command
  • generally use it to detect enviorment

Types

type Host

type Host struct{}

type IFileManage

type IFileManage interface {
	GetRootPath() string
	Dir(relativePath string) ([]string, error)
	Read(filePath string) ([]byte, error)
	ReadString(filePath string) (string, error)
	ExecFile(command string, filepath string, arg ...string) (string, error)
	ExecTagFile(command string, tag string, filePath string) (string, error)
}

func NewLocalManage

func NewLocalManage(rootPath string) (IFileManage, error)

type IRemoteManage

type IRemoteManage interface {
	GetHosts() map[string]string
}

type LANG

type LANG uint32
const (
	PYTHON LANG = iota
)

type LocalManage

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

*

  • localmanager is used to manage local directory.
  • localmanage must bind program's root path.
  • all it's operation should be limited under this directory
  • such as exec file, so file exector take relative path as parameters

func (*LocalManage) Dir

func (localManage *LocalManage) Dir(relativePath string) (dirs []string, err error)

func (*LocalManage) ExecFile

func (localManage *LocalManage) ExecFile(command string, filePath string, arg ...string) (txt string, err error)

*

  • execut file under filepath *

func (*LocalManage) ExecTagFile

func (localManage *LocalManage) ExecTagFile(command string, tag string, filePath string) (txt string, err error)

*

  • execute file with tag
  • such as: cmd /c filename

func (*LocalManage) GetRootPath

func (localManage *LocalManage) GetRootPath() string

func (*LocalManage) Read

func (localManage *LocalManage) Read(filePath string) (bytes []byte, err error)

func (*LocalManage) ReadString

func (localManage *LocalManage) ReadString(filePath string) (str string, err error)

func (*LocalManage) ReadYaml

func (localManage *LocalManage) ReadYaml(filePath string) (map[string]interface{}, error)

*

  • parse yaml file

Jump to

Keyboard shortcuts

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