This commit is contained in:
2025-12-27 11:49:06 +03:00
parent ac5267fd76
commit 84ea17c4b2
3 changed files with 82 additions and 39 deletions

View File

@@ -232,10 +232,10 @@ class ContextManager(object):
def __init__(self, config: ContextManagerConfig):
self.config = config
def print_contexts_list(self) -> None:
def list_contexts(self) -> None:
print('\n'.join(self.config.get_contexts_list()))
def load_context(self, context_name: str) -> None:
def apply_context(self, context_name: str) -> None:
print(f'loading and applying context: "{context_name}"')
try:
tasks = self.config.get_tasks_for_context(context_name)
@@ -284,9 +284,9 @@ class Runner(object):
try:
ctxmgr = ContextManager(config)
if args.command == COMMAND_LIST:
ctxmgr.print_contexts_list()
ctxmgr.list_contexts()
elif args.command == COMMAND_APPLY:
ctxmgr.load_context(args.__dict__[COMMAND_CTX_NAME]) # guaranteed to be present by argparse
ctxmgr.apply_context(args.__dict__[COMMAND_CTX_NAME]) # guaranteed to be present by argparse
except Exception as e:
print(f'error executing command:', e)
return 3