Skip to content

Instantly share code, notes, and snippets.

@slode
Last active September 16, 2016 08:47
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
def print_cmd(command, line_length=80, indent=" "):
import sys, textwrap
lines = textwrap.wrap(
command,
width=line_length,
subsequent_indent=" \\\n" + indent,
break_long_words=False,
break_on_hyphens=False)
for line in lines:
sys.stdout.write(line)
sys.stdout.write("\n")
@slode
Copy link
Author

slode commented Sep 9, 2016

Python script to pretty print long command line calls. Will terminate lines with the \ character and indent all lines except the first.

@cslarsen
Copy link

cslarsen commented Sep 16, 2016

+1

Also, the benefit is, of course, that you can copy and paste the output into your own shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment