Skip to content

Commit cbf5ce3

Browse files
committed
implement cli using Click library
1 parent 0b2c0a7 commit cbf5ce3

File tree

5 files changed

+32
-15
lines changed

5 files changed

+32
-15
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ push: test build
3131
> twine upload dist/*
3232
.PHONY: push
3333

34-
.build-sentinel: $(shell find matsim/*.py) $(shell find docs/*) README.md setup.py
34+
#.build-sentinel: $(shell find simwrapper/*.py) $(shell find docs/*) README.md setup.py
35+
.build-sentinel: $(shell find simwrapper/*.py) README.md setup.py
3536
> rm -rf dist
3637
> python3 setup.py sdist bdist_wheel
3738
> twine check dist/*

setup.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pathlib
22

3-
from setuptools import setup
3+
from setuptools import setup,find_packages
44

55
# The directory containing this file
66
HERE = pathlib.Path(__file__).parent
@@ -11,8 +11,8 @@
1111

1212
# This call to setup() does all the work
1313
setup(
14-
version=VERSION,
1514
name="simwrapper",
15+
version=VERSION,
1616
description="Python support library for SimWrapper data visualization tool",
1717
long_description_content_type="text/markdown",
1818
url="https://github.com/simwrapper/simwrapper-python-tools",
@@ -23,13 +23,17 @@
2323
"License :: OSI Approved :: GNU General Public License (GPL)",
2424
"Programming Language :: Python :: 3",
2525
],
26-
packages=["simwrapper"],
27-
scripts=['simwrapper/go-simwrapper.py']
26+
packages=find_packages(),
2827
install_requires=[
28+
"Click",
2929
],
3030
extras_require = {
3131
},
3232
tests_require=["assertpy", "pytest"],
33-
entry_points={},
33+
entry_points={
34+
'console_scripts': [
35+
'simwrapper = simwrapper.simwrapper:cli'
36+
]
37+
},
3438
long_description=README,
3539
)

simwrapper/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
#from . import Events, Network, Plans, TripEventHandler, writers
2-
3-
#read_network = Network.read_network
4-
#event_reader = Events.event_reader
5-
#plan_reader = Plans.plan_reader
1+
# hi

simwrapper/go-simwrapper.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

simwrapper/simwrapper.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
4+
# click makes building cmdline tools easy, see docs at
5+
# https://click.palletsprojects.com/en/8.0.x
6+
7+
import click
8+
9+
@click.group()
10+
def cli():
11+
pass
12+
13+
@cli.command(help="Start a local file server in this folder")
14+
@click.option('--port', default=8000, help="Port number to use, default is 8000")
15+
def serve(port):
16+
click.echo("SERVE! " + str(port))
17+
18+
# @cli.command(help="Open your browser and view files in this folder")
19+
# def browse():
20+
# click.echo("OPEN!!")

0 commit comments

Comments
 (0)