Fabfiles With Command Line Arguments
Posted
by phasetwenty
on Stack Overflow
See other posts from Stack Overflow
or by phasetwenty
Published on 2010-05-18T17:07:36Z
Indexed on
2010/05/18
17:10 UTC
Read the original article
Hit count: 318
Is there a clean way to have your fabfile take command line arguments? I'm writing an installation script for a tool that I want to be able to specify an optional target directory via the command line.
I wrote some code to test what would happen if I passed in some command line arguments:
# fabfile.py
import sys
def install():
_get_options()
def _get_options():
print repr(sys.argv[1:])
A couple of runs:
$ fab install
['install']
Done.
$ fab install --electric-boogaloo
Usage: fab [options] <command>[:arg1,arg2=val2,host=foo,hosts='h1;h2',...] ...
fab: error: no such option: --electric-boogaloo
© Stack Overflow or respective owner