Skip to content

Instantly share code, notes, and snippets.

@shadow-light
Last active September 14, 2018 03:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shadow-light/84f1e0ee45d699e1ba066a85ac31d52a to your computer and use it in GitHub Desktop.
Save shadow-light/84f1e0ee45d699e1ba066a85ac31d52a to your computer and use it in GitHub Desktop.
How to create a script, using invoke, that you can execute directly
#!/usr/bin/env python
import sys
from invoke import task, Collection, Program
@task
def say_hi(ctx):
print('hi!')
if __name__ == '__main__':
Program(namespace=Collection.from_module(sys.modules[__name__])).run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment