Forráskód Böngészése

Start working on a decent command line interface

Oz N Tiram 9 éve
szülő
commit
8f79040916
2 módosított fájl, 27 hozzáadás és 1 törlés
  1. 20 1
      frank/frank.py
  2. 7 0
      setup.py

+ 20 - 1
frank/frank.py

@@ -113,6 +113,7 @@ import subprocess
 import subprocess as sp
 import hashlib
 import yaml
+import click
 from flask import Flask, request, abort
 import conf
 from shell import Shell
@@ -309,5 +310,23 @@ def start():
     else:
         report_success(results)
 
-if __name__ == '__main__':
+
+@click.group()
+@click.option('--debug/--no-debug', default=False)
+def cli(debug):
+    pass
+
+
+@cli.command()
+def web():
     app.run(host='0.0.0.0', debug=True)
+
+
+@cli.command()
+def worker():
+    click.echo('will start the consumer...')
+
+
+@cli.command()
+def queue():
+    click.echo('will start the queue')

+ 7 - 0
setup.py

@@ -5,6 +5,13 @@ setup(name='frank',
       version='0.0.1',
       license="AGPL",
       packages=find_packages(exclude=['tests']),
+      install_requires=[
+        'Click',           
+      ],
+      entry_points='''
+        [console_scripts]
+        frankci=frank.frank:cli
+      '''
       )