DEV Community

Zach Whaley
Zach Whaley

Posted on • Updated on

Better P4 Output

P4 Output

If you're using Perforce for version control, and you're using their command line tool, p4,
you probably know that p4 is not a great tool.
Perforce itself is a decent version control manager, it's certainly not the worst (*cough* CVS),
but the p4 tool is just not that great 😞

  • p4's output is hard to read and inconsistent
  • p4's various commands use inconsistent options and arguments
  • And p4's return codes differ from the return codes of their own APIs!

There is nothing sensible I can do about the last two problems, but the bad output.
That was something I could fix.

Better P4 Output

I wrote a program called BP4O (Better P4 Output) to improve p4's output and readability.

asciicast

Without BP4O, you get a deluge of text scattered across the screen.
Finding the files, their changes, and the changelists they share is difficult and nearly impossible at a glance,
and keeping that information straight between changes and commands is even more difficult.

With BP4O, we turn that same output into a readable block, reasonably separated by sections, columns, and colors.
Relevant information, like what files are in a changelist, and how files have been modified, is easily visible.

BP4O will also color your diffs, page long output, and provide aliased commands!

Overall, BP4O makes using p4 better without changing how you use p4.

Installing BP4O

BP4O works with Bash, Zsh*, and Fish shell, and is available for

macOS:

brew tap zachwhaley/beer
brew install bp4o
Enter fullscreen mode Exit fullscreen mode

Ubuntu:

sudo add-apt-repository ppa:zachwhaley/ppa
sudo apt update
sudo apt install bp4o
Enter fullscreen mode Exit fullscreen mode

Fedora/CentOS:

sudo dnf copr enable zachwhaley/bp4o
sudo dnf install bp4o
Enter fullscreen mode Exit fullscreen mode

The Code

BP4O's code is open source on GitHub

Contributions are welcome!

http://zachwhaleys.website/2017/01/05/bp4o/

Top comments (0)