Skip to content

Commit

Permalink
Fix entry point
Browse files Browse the repository at this point in the history
  • Loading branch information
17o2 authored and laurierloi committed Jan 19, 2023
1 parent a98e17b commit f325b69
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
packages=find_packages('src'),
entry_points={
'console_scripts': [
'wireviz=wireviz.wv_cli:main',
'wireviz=wireviz.wv_cli:wireviz',
],
},
classifiers=[
Expand Down
3 changes: 3 additions & 0 deletions src/wireviz/wireviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,6 @@ def parse_file(yaml_file: str, file_out: (str, Path) = None) -> None:
file_out = file_out.resolve()

parse(yaml_input, file_out=file_out)

if __name__ == '__main__':
print('When running from the command line, please use wv_cli.py instead.')
6 changes: 4 additions & 2 deletions src/wireviz/wv_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

import click

if __name__ == '__main__':
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))

from wireviz import APP_NAME, __version__
import wireviz.wireviz as wv
from wireviz.wv_helper import open_file_read
Expand All @@ -19,7 +22,7 @@
@click.option('-p', '--prepend', default=None, type=Path, help='YAML file to prepend to the input file (optional).')
@click.option('-o', '--output-file', default=None, type=Path, help='File name (without extension) to use for output, if different from input file name.')
@click.option('-V', '--version', is_flag=True, default=False, help=f'Output {APP_NAME} version and exit.')
def main(file, format, prepend, output_file, version):
def wireviz(file, format, prepend, output_file, version):
"""
Parses the provided FILE and generates the specified outputs.
"""
Expand Down Expand Up @@ -79,5 +82,4 @@ def main(file, format, prepend, output_file, version):
print()

if __name__ == '__main__':
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
wireviz()

0 comments on commit f325b69

Please sign in to comment.