Skip to content

Commit

Permalink
fixup! Add CLI to run any Python program based on argparse
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Feb 8, 2022
1 parent 2694a78 commit cf77dba
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gooey/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import sys
from importlib import import_module
from importlib.metadata import entry_points
try:
from importlib.metadata import entry_points
except ImportError:
from importlib_metadata import entry_points

from gooey import Gooey

Expand All @@ -26,6 +29,9 @@ def main(args=None):
# the path to a function was passed
module_path, function_name = args[0].split(':')
prog = module_path.split('.', 1)[0]
else:
print('usage: gooey [SCRIPT | MODULE:FUNCTION] [-- SCRIPT_ARGS...]', file=sys.stderr)
sys.exit(1)
if len(args) > 1:
if args[1] == '--':
del args[1]
Expand Down

0 comments on commit cf77dba

Please sign in to comment.