Skip to content

A golang reader for the Perforce/Helix broker filter output

License

Notifications You must be signed in to change notification settings

brettbates/p4broker-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A reader for the Perforce/helix broker filter output.

For example if you have a p4broker.conf stanza like so:

command: access
{
    action=filter;
    execute=/path/to/go/program;
}

You can use this p4broker-reader.Read() within the receiving go program to get the output dictionary as a map[string]string.

And example dictionary is like so:

brokerListenPort: 1998
brokerTargetPort: localhost:1999
command: access
clientProg: p4
clientVersion: 2020.2/LINUX26X86_64/2057778
clientProtocol: 89
apiProtocol: 99999
workspace: NP-B-BATES
user: brett.bates
clientIp: 127.0.0.1
clientHost: ahost
cwd: /home/brett/scratch/broker
clientPort: 1998
argCount: 2
Arg0: read
Arg1: //path/to/file

Example usage:

// Pass in an io.Reader, though you probably want os.Stdin to get input from p4broker
res, err := Read(os.Stdin)
if err != nil {
	log.Fatalf("%v", err)
}
log.Printf("%v", res["Arg0"])

About

A golang reader for the Perforce/Helix broker filter output

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages