Add wv_cli.py, add Click requirement, change entry point
This commit is contained in:
parent
8e59a14e4e
commit
a810bd53ae
@ -1,3 +1,4 @@
|
|||||||
|
click
|
||||||
graphviz
|
graphviz
|
||||||
pillow
|
pillow
|
||||||
pyyaml
|
pyyaml
|
||||||
|
|||||||
5
setup.py
5
setup.py
@ -17,6 +17,7 @@ setup(
|
|||||||
long_description=open(README_PATH).read(),
|
long_description=open(README_PATH).read(),
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
install_requires=[
|
install_requires=[
|
||||||
|
'click',
|
||||||
'pyyaml',
|
'pyyaml',
|
||||||
'pillow',
|
'pillow',
|
||||||
'graphviz',
|
'graphviz',
|
||||||
@ -27,7 +28,9 @@ setup(
|
|||||||
package_dir={'': 'src'},
|
package_dir={'': 'src'},
|
||||||
packages=find_packages('src'),
|
packages=find_packages('src'),
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': ['wireviz=wireviz.wireviz:main'],
|
'console_scripts': [
|
||||||
|
'wireviz=wireviz.wv_cli:main',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 4 - Beta',
|
'Development Status :: 4 - Beta',
|
||||||
|
|||||||
29
src/wireviz/wv_cli.py
Normal file
29
src/wireviz/wv_cli.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import click
|
||||||
|
|
||||||
|
import wireviz.wireviz
|
||||||
|
|
||||||
|
@click.command()
|
||||||
|
@click.argument('filepath', nargs=-1)
|
||||||
|
@click.option('-p', '--prepend', default=None)
|
||||||
|
@click.option('-o', '--output', default='hpst')
|
||||||
|
@click.option('-V', '--version', is_flag=True, default=False)
|
||||||
|
def main(filepath, prepend, output, version):
|
||||||
|
print('WireViz!')
|
||||||
|
# get list of files
|
||||||
|
try:
|
||||||
|
_ = iter(filepath)
|
||||||
|
except TypeError:
|
||||||
|
filepaths = [filepath]
|
||||||
|
else:
|
||||||
|
filepaths = list(filepath)
|
||||||
|
|
||||||
|
for f in filepaths:
|
||||||
|
print(f)
|
||||||
|
print()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||||
|
wireviz()
|
||||||
Loading…
x
Reference in New Issue
Block a user