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

Add support for optional and params T[] toolshed command arguments. #5573

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

ElectroJr
Copy link
Member

@ElectroJr ElectroJr commented Dec 23, 2024

This PR allows toolshed commands to use optional and params T[] arguments. Optional & variable-length arguments can be truncated using the command terminator ';' or the new explicit pipe symbol '|'. The pipe symbol conflicts with some existing bitwise or commands (|' and |~'), so I just removed the symbolic "name" for those commands. Due to the renaming, this needs a space-wizards/space-station-14/pull/34029 so that the AllCommandsHavePermissions test passes.

I've tried briefly looking around, but didn't find a lot about how to use reflection to check for params collections in .net 9. So I'm not sure how hard it'd be to update or if the current implementation (checking for ParamArrayAttribute) would cause any issues.

This PR also makes varous other toolshed related changes, including:

  • The signature of Toolshed type parsers have changed. Instead of taking in an optional command argument name string, they now take in a CommandArgument struct.
  • Semicolon terminated command blocks no longer return anything. I.e., i { i 2 ; } is no longer a valid command, as the block has no return value.
    • There's no real reason for this change other than that I think it makes more sense.
  • The default auto-completion hint for Toolshed commands have been changed and somewhat standardized. Most type parsers should now have a hint of the form:
    • <name (Type)> for mandatory arguments
    • [name (Type)] for optional arguments
    • [name (Type)]... for variable length arguments (i.e., for params T[])
  • The auto-generated output of the help and explain commands have changed to try make the output more readable, and so that they also specify whether a command requires type arguments. E.g., the comp:get command now shows up as comp:get<T>.

@ElectroJr ElectroJr added Status: Requires Content PR This PR breaks content and requires both to be merged together. Status: Needs Review This PR needs to be reviewed before it can be merged. Toolshed labels Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Review This PR needs to be reviewed before it can be merged. Status: Requires Content PR This PR breaks content and requires both to be merged together. Toolshed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant