Browse Source

Added cli skeleton

main
Lakshmi Vyasarajan 14 years ago
parent
commit
f2031f76e0
4 changed files with 47 additions and 0 deletions
  1. +25
    -0
      hyde/cli.py
  2. +7
    -0
      hyde/engine.py
  3. +9
    -0
      hyde/hyde.py
  4. +6
    -0
      hyde/version.py

+ 25
- 0
hyde/cli.py View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
The command line interface for hyde.
"""
import argparse

from engine import init, gen, serve
from version import __version__

def main():
"""
The main function called by hyde executable
"""
parser = argparse.ArgumentParser(description='hyde - A Python Static Website Generator',
epilog='Use %(prog)s {command} -h to get help on individual commands')
parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + __version__)
parser.add_argument('-s', '--sitepath', action='store', default='.', help="Location of the hyde site")
subcommands = parser.add_subparsers(title="Hyde commands",
description="Entry points for hyde")
init_command = subcommands.add_parser('init', help='Initializes a new hyde site')
init_command.set_defaults(run=init)
init_command.add_argument('-f', '--force', action='store_true', default=False, dest='force',
help='Overwrite the current site if it exists')
args = parser.parse_args()
args.run(args)

+ 7
- 0
hyde/engine.py View File

@@ -0,0 +1,7 @@
def init(args):
print args.sitepath
print args.force

def gen(args): pass

def serve(args): pass

+ 9
- 0
hyde/hyde.py View File

@@ -0,0 +1,9 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The hyde executable
"""
from cli import main

if __name__ == "__main__":
main()

+ 6
- 0
hyde/version.py View File

@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
"""
Handles hyde version
TODO: Use fabric like versioning scheme
"""
__version__ = '0.6.0'

Loading…
Cancel
Save