#!/usr/bin/env python

import sys

def start():
    pass

def test():
    pass

def refresh():
    pass

def main():
    valid_cmds = ["start", "test", "refresh"]
    help_str = "./manage.py {{{0}}}".format(','.join(valid_cmds))

    if len(sys.argv) != 2 or sys.argv[1] not in valid_cmds:
        print help_str
        sys.exit(1)

    cmd = sys.argv[1]
    getattr(sys.modules[__name__], cmd)()

if __name__ == "__main__":
    main()

@@ -26,16 +26,65 @@
 port sys
+%0Aimport os%0Aimport shutil%0A%0Aimport config%0Aimport db
 %0A%0Adef st
@@ -132,25 +132,843 @@
 f re
-fresh():%0A    pass
+set():%0A    %22%22%22%0A    Clears the Securedrop development application's state, restoring it to the%0A    way it was immediately after running %60setup_dev.sh%60. This command:%0A    1. Erases the development sqlite database file ($SECUREDROP_ROOT/db.sqlite)%0A    2. Regenerates the database%0A    3. Erases stored submissions and replies from $SECUREDROP_ROOT/store%0A    %22%22%22%0A    # Erase the development db file%0A    assert hasattr(config, 'DATABASE_FILE'), %22TODO: ./manage.py doesn't know how to clear the db if the backend is not sqlite%22%0A    os.remove(config.DATABASE_FILE)%0A%0A    # Regenerate the database%0A    db.init_db()%0A%0A    # Clear submission/reply storage%0A    for source_dir in os.listdir(config.STORE_DIR):%0A        # Each entry in STORE_DIR is a directory corresponding to a source%0A        shutil.rmtree(os.path.join(config.STORE_DIR, source_dir))
 %0A%0Ade
@@ -1019,13 +1019,11 @@
  %22re
-fresh
+set
 %22%5D%0A 

implement manage.py reset