Skip to content

Instantly share code, notes, and snippets.

@zachwill
Created April 8, 2011 23:08
Show Gist options
  • Save zachwill/910912 to your computer and use it in GitHub Desktop.
Save zachwill/910912 to your computer and use it in GitHub Desktop.
Hello World Examples for the Python fabric framework
#!/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()
$ fab hello
Hello world!
Done.
$ fab hello:zach
Hello zach!
Done.
$ fab hello:name=zach
Hello zach!
Done.
$ 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