Perforce: Formatting, Scripting, and the Command-line Interface
In this blog post I will discuss some of the convenient tricks that you can leverage when navigating Perforce and its command-line interface. A lot of these are well documented in a post that's available on Perforce's website, but this blog post will look at a few of those features with more detail.
The Perforce command-line interface features support for a variety of useful global command-line arguments that can be used for altering the output and and operation of the command-line tool.
The output from the Perforce command-line interface can be used using a combination of the -ztag, -e, and -F command-line arguments.
The -ztag global command-line argument displays the standard output from the Perforce command-line interface in a format that conforms to a specification.
The specification is denoted in that each "key" or "attribute" of an object, is prefixed with "... " and then proceeded by the name of the key. The data for that particular attribute or property is then displayed afterwards using a white-space character as the delimiter. Find below an example.
-e and -F
These global command-line arguments are particularly useful for filtering and identifying "keys", "properties" or "attributes" from resulting attributes that we wish to extract from the output.
Understanding how these global command-line arguments can be used is incredibly powerful. With this, we can now write additional applications that is capable of executing this commands and parsing the command-line standard output.