Created
April 8, 2011 23:08
-
-
Save zachwill/910912 to your computer and use it in GitHub Desktop.
Hello World Examples for the Python fabric framework
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
#!/usr/bin/env python | |
from fabric.api import local | |
def hello(name='world'): | |
print('\n\n') | |
print('Hello %s!' % name) | |
print('\n\n') | |
def check_git(): | |
local('git status') | |
local('git diff --word-diff') | |
def init(name): | |
if name: | |
hello(name) | |
else: | |
hello() | |
check_git() |
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
$ fab hello | |
Hello world! | |
Done. | |
$ fab hello:zach | |
Hello zach! | |
Done. | |
$ fab hello:name=zach | |
Hello zach! | |
Done. |
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
$ fab init | |
Hello world! | |
[localhost] local: git status | |
fatal: Not a git repository (or any of the parent directories): .git | |
Fatal error: local() encountered an error (return code 128) while executing 'git status' | |
Aborting. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment