Last active
September 16, 2016 08:47
-
-
Save slode/b62a56acf283cd574b20839b3f483cca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
+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
Python script to pretty print long command line calls. Will terminate lines with the
\
character and indent all lines except the first.