mitchkman
mitchkman

Reputation: 6680

Call Fabric directly in Python

I want to extend Fabric with some functionality and would like to call Fabric programmatically.

What I figured out is to call the main() method in https://github.com/fabric/fabric/blob/master/fabric/main.py, but I can't pass any parameters directly to the function, because it reads it's parameters within the function.

Any idea to set the command line parameters programmatically and the calling main()?

Upvotes: 7

Views: 2057

Answers (2)

Bogdan Iulian Bursuc
Bogdan Iulian Bursuc

Reputation: 2275

You can use the execute method in the Fabric library to call tasks.

http://docs.fabfile.org/en/1.8/api/core/tasks.html?highlight=execute#fabric.tasks.execute

Upvotes: 10

Morgan
Morgan

Reputation: 4131

You should read the Library use documentation, as it'll likely explain how to do what you're attempting.

Upvotes: 3

Related Questions