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

Feature Request: parameter autocompletion #4

Open
juzdepeche opened this issue Aug 25, 2022 · 1 comment
Open

Feature Request: parameter autocompletion #4

juzdepeche opened this issue Aug 25, 2022 · 1 comment

Comments

@juzdepeche
Copy link

Would be helpful and nice to have a command parameter autocompletion (like the command autocomplete). A way to use it could be to pass a list of values like in the example below.

Usage:

        private static void ConfigureGiveCollectibleCommand()
        {
            DevConsole.AddCommand(Command.Create(
                name: "collectible_give",
                aliases: "",
                helpText: "Gives collectibles to the player",
                p1: Parameter.Create(
                    name: "collectible type",
                    helpText: "The collectible type to give to the player"
--->             autocompletion: new List<CollectibleType>() { CollectibleType.Life, CollectibleType.Ammo, CollectibleType.Mana }
                ),
                p2: Parameter.Create(
                    name: "amount",
                    helpText: "The amount you want to give to the player"
                ),
                callback: (CollectibleType type, int amount) => GiveCollectible(type, amount)
            ));
        }
@DavidF-Dev
Copy link
Owner

@juzdepeche Thanks for the suggestion. It's been a while since I've touched this project, but I'll take a look into it.

The autoCompletion parameter would most likely need to be a list of strings (and/or a delegate that returns a list of strings). It would be up to the developer to ensure that the provided parameters CAN be converted from string for use in their callback method.

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

2 participants