Skip to content

Commit

Permalink
Improved typing of the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
gijswobben committed Jul 6, 2020
1 parent 65c4850 commit 755d836
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pyfiguration/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from importlib.util import spec_from_file_location, module_from_spec
from importlib.abc import Loader

from typing import Any, List, Dict, Optional
from typing import Any, Callable, List, Dict, Optional
from functools import reduce
from .configuration import Configuration

Expand Down Expand Up @@ -288,19 +288,18 @@ def cli(args: Optional[List[str]] = None):
"""

# Parse the input arguments
args = vars(parser.parse_known_args(args)[0])
parsedArgs = vars(parser.parse_known_args(args)[0])

# Execute the selected action
actions[args.get("command", None)][args.get("inspect_type", None)](**args)
actions[parsedArgs.get("command", None)][parsedArgs.get("inspect_type", None)](**parsedArgs)


actions = {
actions: Dict[str, Dict[str, Callable[..., None]]] = {
"inspect": {
"config": inspectConfig,
"script": inspectScript,
"module": inspectScript,
},
None: showHelp,
}
}


Expand Down

0 comments on commit 755d836

Please sign in to comment.