0

I need to document some very long command line instructions. What convention should I use to indicate that the line is not broken?

For example, for the command:

fab --fabfile=create_virtualenv.py --hosts=<user@remote> create_virtualenv:base=<base_folder>,name=<ve_name>,requirements=<requirements_file>,packages=<package_folder>

I was thinking:

fab --fabfile=create_virtualenv.py --hosts=<user@remote> \\
create_virtualenv:base=<base_folder>,name=<ve_name>,\\
requirements=<requirements_file>,packages=<package_folder>

but that's just me making something up based on a half-forgotten example, and I can see potential for ambiguities regarding whitespace and punctuation.

A referenced standard would be best, or consistent, well-regarded implementation.

lofidevops
  • 15,528
  • 14
  • 79
  • 119

1 Answers1

1

On Windows, I would use the same character that CMD.EXE uses for line continuation - the caret ^.

fab --fabfile=create_virtualenv.py --hosts=<user@remote> ^
create_virtualenv:base=<base_folder>,name=<ve_name>,^
requirements=<requirements_file>,packages=<package_folder>

See Long commands split over multiple lines in Windows Vista batch (.bat) file for more info. Be sure to read the first three answers, as they each have useful information.

On 'nix, I would use a single \ for the same reason. A double \\ would imply a backslash literal, so that is not good. But a single \ at the end implies line continuation.

fab --fabfile=create_virtualenv.py --hosts=<user@remote> \
create_virtualenv:base=<base_folder>,name=<ve_name>,\
requirements=<requirements_file>,packages=<package_folder>
Community
  • 1
  • 1
dbenham
  • 127,446
  • 28
  • 251
  • 390