Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion cfbs/args.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
2 changes: 1 addition & 1 deletion cfbs/cfbs_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions cfbs/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions cfbs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down