Git Product home page Git Product logo

powershellguard's People

Contributors

1redone avatar nohwnd avatar smurawski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

powershellguard's Issues

What is 'Guard'?

The readme references Guard but doesn't give a newcomer any idea of what Guard is, or even what company makes it. Maybe add a link to the wiki page of Guard, or a link to the Guard company's product site?

Of course, we can't rule out the very real possibility that everyone else in the world knows about Guard, except me.

New-Guard does not support spaces in path.

The New-Guard command does not like me giving it a folder name with spaces in it. I tried many work around but I cannot find a way to protect the path.
I am happy to help with debugging if I am given some guidance where to inject some code.

I have made a small module to create the guards I need, based on VSCodeWatcherTask
Watch-Project -WorkspaceRoot "c:\Users\fma146\OneDrive - Maersk Group\PowerShell\Build" -Type Project

which basically runs:
New-Guard -Path "$WorkspaceRoot" -PathFilter "*.ps1" -MonitorSubdirectories -TestPath "$WorkspaceRoot\Tests" -TestCommand {
Write-Host "Invoking Watch.Project"
Invoke-Pester -PesterOption @{IncludeVSCodeMarker=$true}
} -Wait

which, when tests complete, results in:
Tests completed in 5.24s
Passed: 42 Failed: 0 Skipped: 0 Pending: 0 Inconclusive: 0
Exception calling "InvokeScript" with "1" argument(s): "The term 'C:\Users\fma146\OneDrive' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if apath was included, verify that the path is correct and try again."
At C:\Users\fma146\Documents\WindowsPowerShell\Modules\PowerShellGuard\0.8.68\PowerShellGuard.psm1:195 char:7
$ExecutionContext.InvokeCommand.InvokeScript($Command)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : CommandNotFoundException

The "=" operator is missing after a named argument.

Error generated when attempting to Import-Module:

The "=" operator is missing after a named argument.
At C:\Users\cb2215\Documents\WindowsPowerShell\Modules\PowerShellGuard\PowerShellGuard.psm1:23 char:50

  •   [parameter(ValueFromPipelineByPropertyName) <<<< ]
    
    • CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : MissingEqualsInNamedArgument
PS> $PSVersionTable.PSVersion

  Major  Minor  Build  Revision
  -----  -----  -----  --------
  2      0      -1     -1

Example does not work

Running the second example yields lot of these errors:

PS C:\Projects\PSTMigration> dir *.ps1 | New-Guard -TestPath {"./Tests/$($_.basename).Tests.ps1"}
Resolve-Path : Cannot evaluate parameter 'Path' because its argument is specified as a script block and there is no
input. A script block cannot be evaluated without input.
At C:\Projects\PowerShellGuard\PowerShellGuard.psm1:52 char:33
+       $TestPath = (resolve-path $TestPath).Path
+                                 ~~~~~~~~~
    + CategoryInfo          : MetadataError: (:) [Resolve-Path], ParameterBindingException
    + FullyQualifiedErrorId : ScriptBlockArgumentNoInput,Microsoft.PowerShell.Commands.ResolvePathCommand

Adding ValueFromPipeline=$true to $Path does not solve the issue, it only changes the error to:

Resolve-Path : Cannot evaluate parameter 'Path' because its argument is specified as a script block and there is no
input. A script block cannot be evaluated without input.
At C:\Projects\PowerShellGuard\PowerShellGuard.psm1:52 char:33
+       $TestPath = (resolve-path $TestPath).Path
+                                 ~~~~~~~~~
    + CategoryInfo          : MetadataError: (:) [Resolve-Path], ParameterBindingException
    + FullyQualifiedErrorId : ScriptBlockArgumentNoInput,Microsoft.PowerShell.Commands.ResolvePathCommand

Support ScriptBlock instead of TestCommand

Feature Enhancement :)

It would be nice to be able to supply my own Powershell script block to execute instead of just a string of text. Further, it would be awesome if the script block could pass the changed file(s) to the script block as an argument.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.