def _parse_args_to_nested_dict(args):
    """Parse the command-line arguments into a nested dictionary."""
    result = _nested_dict()

    i = 0
    while i < len(args):
        arg = args[i]
        if not arg.startswith("--"):
            i += 1
            continue

        # Handle --key=value format
        if "=" in arg:
            key, value = arg[2:].split("=", 1)
        # Handle --key value format
        else:
            key = arg[2:]
            i += 1
            if i >= len(args):
                break
            value = args[i]

        # Convert value to int if possible
        value = int(value) if value.isdigit() else value

        # Build nested dict structure
        keys = key.split(".")
        current = result
        for k in keys[:-1]:
            current = current[k]
        current[keys[-1]] = value

        i += 1

    return result
Parse the command-line arguments into a nested dictionary.
sweagent/run/common.py