tree: b1b26638a48dd940c41e58314e990ec94e43fbe6 [path history] [tgz]
  1. lint/
  2. proto/
  3. protodef/
  4. .gitignore
  5. main.go
  6. README.md
  7. update.sh
cmd/cdpgen/README.md

cdpgen

The cdpgen tool is used to generate the Golang API for the Chrome DevTools Protocol from the protocol definitions (JSON).

Beware, this tool is not a feat of engineering, it's only purpose is to generate the Golang API. It has gone thourgh many revisions while prototyping the API and might contain both messy and dead code.

Installing

go get -u github.com/mafredri/cdp/cmd/cdpgen

Usage

The current protocol definitions are committed in this repository under the protodef directory.

Generating the cdp package

$ cdpgen -dest-pkg github.com/mafredri/cdp \
    -browser-proto $GOPATH/src/github.com/mafredri/cdp/cmd/cdpgen/protodef/browser_protocol.json \
    -js-proto $GOPATH/src/github.com/mafredri/cdp/cmd/cdpgen/protodef/js_protocol.json

Updating protocol definitions

$ ./update.sh

Future improvements

  • Better formatting for comments, consider sentence construction, proper casing and line length.