Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dataroast Commands not properly accepting arguments #65

Open
swordboys923 opened this issue Dec 17, 2024 · 1 comment
Open

Dataroast Commands not properly accepting arguments #65

swordboys923 opened this issue Dec 17, 2024 · 1 comment

Comments

@swordboys923
Copy link

swordboys923 commented Dec 17, 2024

There is an issue in the command.py file of the dataroast folder. When calling from_string, the parsed_args variable never gets added to if the args only contains strings. I added the else block, and the function now works appropriately.

Note, the merge command (which the 'if "," in arg:' line is attempting to solve for) still doesn't work properly.

` def from_string(command: str) -> "Command":
parts = command.split()
cmd, raw_args = parts[0], parts[1:]

    # Process each argument, converting to appropriate type
    parsed_args: list[str | int | list[str]] = ['' for arg in raw_args]
    for i, arg in enumerate(raw_args):
        try:
            if "," in arg:
                parsed_args[i] = arg.split(",")
            elif arg.isnumeric():
                parsed_args[i] = int(arg)
            else:
                parsed_args[i] = arg
        except ValueError:
            pass

    if not cmd_exists(cmd):
        raise ValueError(f"Command {cmd} does not exist.")
    return Command(cmd, parsed_args)

`

@swordboys923
Copy link
Author

I also had to prepopulate the parsed_args with a list comp or else I was getting index out of bounds errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant