p4

package module
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 11 Imported by: 1

README

p4go

Go interface library to use Perforce Helix Core command line (p4 or p4.exe)

This is a fork of Robert Cowhams great work https://github.com/rcowham/go-libp4 but converted to use p4 -Mj, json output.

The advantage of json is the ease of use of the results, which are of type map[string]string rather than map[interface{}]interface{}

Documentation

Overview

Package p4 wraps the Perforce Helix Core command line.

It assumes p4 or p4.exe is in the PATH. It uses the p4 -G global option which returns Python marshalled dictionary objects.

p4 Python parsing module is based on: https://github.com/hambster/gopymarshal

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type P4

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

P4 - environment for P4

func NewP4

func NewP4() *P4

NewP4 - create and initialise properly

func NewP4Params

func NewP4Params(port string, user string, client string) *P4

NewP4Params - create and initialise with params

func (*P4) Run

func (p4 *P4) Run(args []string) ([]map[string]string, error)

Run - runs p4 command and returns map

func (*P4) RunBytes

func (p4 *P4) RunBytes(args []string) ([]byte, error)

RunBytes - runs p4 command and returns []byte output

func (*P4) Save

func (p4 *P4) Save(specName string, specContents map[string]string, args []string) ([]map[string]string, error)

Save - runs p4 -i for specified spec returns result

func (*P4) SaveTxt added in v0.2.3

func (p4 *P4) SaveTxt(specName string, specContents map[string]string, args []string) (string, error)

The Save() func doesn't work as it needs the data marshalled instead of map[string]string This is a quick fix, the real fix is writing a marshal() function or try using gopymarshal

type Runner added in v0.2.0

type Runner interface {
	Run([]string) ([]map[string]string, error)
}

Runner is an interface to make testing p4 commands more easily

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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