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
Save slode/b62a56acf283cd574b20839b3f483cca to your computer and use it in GitHub Desktop.
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")
@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