Skip to content

Commit

Permalink
Merge branch 'docs'
Browse files Browse the repository at this point in the history
Pull in the documentation branch with Sphinx docs for the begins
project.
  • Loading branch information
Aaron Iles committed Aug 1, 2014
2 parents 91fea9b + d00f1b6 commit a381414
Show file tree
Hide file tree
Showing 9 changed files with 1,176 additions and 12 deletions.
5 changes: 5 additions & 0 deletions docs/_templates/layout.html
@@ -0,0 +1,5 @@
{% extends "!layout.html" %}
{% block sidebartoc %}
<h3>{{ _('Table Of Contents') }}</h3>
{{ toctree(includehidden=True) }}
{% endblock %}
21 changes: 21 additions & 0 deletions docs/api.rst
@@ -0,0 +1,21 @@
==============
The begins API
==============

.. automodule:: begin
:members:
:undoc-members:

Utilities
=========

.. automodule:: begin.utils
:members:
:undoc-members:

Help Formatters
===============

.. automodule:: begin.formatters
:members:
:undoc-members:
17 changes: 17 additions & 0 deletions docs/examples/advanced.py
@@ -0,0 +1,17 @@
import begin
import logging

@begin.subcommand
def hello(name):
"Say hello"
logging.info("Hello {0}".format(name))

@begin.subcommand
def goodbye(name):
"Say goodbye"
logging.info("Goodbye {0}".format(name))

@begin.start
@begin.logging
def main():
"Greetings and salutations"
4 changes: 2 additions & 2 deletions docs/examples/flask_quickstart.py
Expand Up @@ -7,7 +7,7 @@
def hello_world():
return 'Hello World!'

@begin.start(env_prefix='WEB_')
@begin.convert(port=int, debug=begin.utils.tobool)
@begin.start(auto_convert=True, env_prefix='WEB_')
@begin.logging
def main(host='127.0.0.1', port=8080, debug=False):
app.run(host=host, port=port, debug=debug)
17 changes: 17 additions & 0 deletions docs/examples/rawhelp.py
@@ -0,0 +1,17 @@
import begin
my_formatter = begin.formatters.compose(begin.formatters.RawDescription)

@begin.subcommand
def sub():
"""Such text
Very whitespace
So exact
"""

@begin.start(formatter_class=my_formatter)
def main():
"""Plain text formatting for this help:
- how does it look?
Params:
foo is yummy...
"""
23 changes: 23 additions & 0 deletions docs/examples/shell.py
@@ -0,0 +1,23 @@
import shutil
import begin

begin.subcommand(shutil.copy)
begin.subcommand(shutil.copy2)
begin.subcommand(shutil.copyfile)
begin.subcommand(shutil.copymode)
begin.subcommand(shutil.copystat)
begin.subcommand(shutil.copytree)
begin.subcommand(shutil.move)
begin.subcommand(shutil.rmtree)

# Patch in doc before the func is wrapped by begin.start
def patch_doc(doc):
def decorate(func):
func.__doc__ = doc
return func
return decorate

@begin.start
@patch_doc(shutil.__doc__)
def main():
pass

0 comments on commit a381414

Please sign in to comment.