Git Product home page Git Product logo

pwshrun's People

Contributors

lord-executor avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

pwshrun's Issues

Declarative way of dealing with external dependencies on task level

Often, a specific task requires a specific external tool to be installed in order to work correctly. For example, using bat in a task, obviously requires bat to be available in in the path.

It would be nice to be able to declare dependencies together with the task metadata like so:

PwshRun-RegisterTasks "mybundle" @(
    @{
        Alias = "dostuff";
        Command = "MyBundle-DoStuff";
        Description = "Does stuff";
        Example = "`$RUNNER dostuff";
        Dependencies = @("bat")
    }
)

Use .count instead of .Length to get length of $taskArgs

if ($taskArgs.Length -eq 0) {

Ever seen this message:

PropertyNotFoundException: C:\Users\dtm\Documents\PowerShell\Modules\PwshRun\1.3.2\pwshrun-bootstrap.ps1:183
Line |
 183 |      if ($taskArgs.Length -eq 0) {
     |          ~~~~~~~~~~~~~~~~~~~~~~
     | The property 'Length' cannot be found on this object. Verify that the property exists.

So, I did some digging, and... while $taskArgs really does seem to be an IList<object>, powershell seems to be totally weird about it and (probably) wraps collections internally or something.

According to https://learn.microsoft.com/en-us/powershell/scripting/learn/deep-dives/everything-about-arrays?view=powershell-7.3#count, you can actually just use the .count property to get the length (tested on my machine). Note the lowercase. That's intentional.

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.