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 #Requires -PSEdition and -Assembly #197

Merged
merged 3 commits into from Mar 17, 2021

Conversation

theaquamarine
Copy link
Contributor

-PSEdition works correctly, but -Assembly is a bit of a cheat. It mostly looks right, but currently it matches the argument as variable.parameter.powershells, with a couple of exceptions:

  • Assembly names can have dots in, #Requires -Assembly System.Management.Automation. This is true of modules too, but currently -Modules AzureRM.Netcore gets tokenised as two variable.parameter.powershells with the dot as a meta.requires.powershell. It looks more or less right as is, but it's an easy enough fix.

  • Assemblies can be specified by file paths, eg #Requires -Assembly path\to\foo.dll. The dots and path separators both get tokenised as meta.requires.powershell, but paths are a bit more complicated to handle. I was hoping there was already a pattern for matching a path, but nothing jumped out at me?

  • Assemblies can be specified using an assembly specifier, eg #Requires -Assembly "System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", which would require allowing quotes, commas, and spaces at least.

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for this contribution

@andyleejordan andyleejordan merged commit c150c15 into PowerShell:master Mar 17, 2021
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

Successfully merging this pull request may close these issues.

None yet

4 participants