diff --git a/cfbs/args.py b/cfbs/args.py index 7e3b015e..ac234f98 100644 --- a/cfbs/args.py +++ b/cfbs/args.py @@ -1,13 +1,44 @@ import argparse import os +from typing import List, Union from cfbs import commands from cfbs.utils import cache, GenericExitError +class ArgsTypesNamespace(argparse.Namespace): + """Manual type hints to args attributes""" + + command: Union[str, None] + args: List[str] + loglevel: str + manual: bool + version: bool + force: bool + non_interactive: bool + index: Union[str, None] + check: bool + checksum: Union[str, None] + keep_order: bool + git: Union[str, None] + git_user_name: Union[str, None] + git_user_email: Union[str, None] + git_commit_message: Union[str, None] + ignore_versions_json: bool + omit_download: bool + check_against_git: bool + minimum_version: Union[str, None] + to_json: Union[str, None] + reference_version: Union[str, None] + masterfiles_dir: Union[str, None] + ignored_path_components: List[str] + offline: bool + masterfiles: Union[str, None] + + def get_args(): parser = get_arg_parser() - args = parser.parse_args() + args = parser.parse_args(namespace=ArgsTypesNamespace()) return args diff --git a/cfbs/cfbs_config.py b/cfbs/cfbs_config.py index 32b5001d..a04d14cb 100644 --- a/cfbs/cfbs_config.py +++ b/cfbs/cfbs_config.py @@ -430,7 +430,7 @@ def add_command( "There seems to already be input for module '%s'. " % name + "Note that old input may break the module. " + "Please make sure to run 'cfbs input' to re-enter input " - + "before building and depolying/installing your project." + + "before building and deploying/installing your project." ) elif prompt_user( self.non_interactive, diff --git a/cfbs/commands.py b/cfbs/commands.py index e00b56b8..2f42d9dc 100644 --- a/cfbs/commands.py +++ b/cfbs/commands.py @@ -9,7 +9,7 @@ import logging as log import json import functools -from typing import Union +from typing import List, Union from collections import OrderedDict from cfbs.analyze import analyze_policyset from cfbs.args import get_args @@ -399,7 +399,7 @@ def add_command( @cfbs_command("remove") @commit_after_command("Removed module%s %s", [PLURAL_S, FIRST_ARG_SLIST]) -def remove_command(to_remove: list): +def remove_command(to_remove: List[str]): config = CFBSConfig.get_instance() config.warn_about_unknown_keys() if "build" not in config: diff --git a/cfbs/main.py b/cfbs/main.py index b1844805..140f8c2b 100644 --- a/cfbs/main.py +++ b/cfbs/main.py @@ -176,6 +176,7 @@ def _main() -> Union[int, Result]: min_version=args.minimum_version, ) + # Commands you cannot run outside a cfbs repo: if not is_cfbs_repo(): raise GenericExitError( "This is not a cfbs repo, to get started, type: cfbs init"