Utility functions for writing command-line programs