Skip to content

PSResourceGet module assumes the required modules statement location in script file in specific place #1248

Open
@peetrike

Description

@peetrike

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

About Requires states that the #Requires statements can appear on any line in a script. Yet the module PSResourceGet assumes that #Requires -Modules statement is above comment based help block.

@'
<#PSScriptInfo
.VERSION 1.0.0
.GUID {0}
.AUTHOR Me
.TAGS
#>
<#
.DESCRIPTION
just for testing
#>

#Requires -Modules mymodule
'@ -f (new-guid) | set-content -path test.ps1

Get-PSScriptFileInfo -Path .\test.ps1 | select -ExpandProperty scriptRequiresComment

Expected behavior

RequiredModules
---------------
{mymodule}

Actual behavior

RequiredModules
---------------
{}

Error details

No response

Environment data

PSResourceGet: 0.5.22
PowerShell: 5.1 or 7.3.5

Visuals

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions