Skip to content

Invoke-psake with option to return documentation should return objects instead of formated string #153

Closed
@mabead

Description

Invoke-psake already has options (-docs, -detailedDocs) to display the list of Task defined in a psake script. Unfortunately, these options return formatted strings:

if ($showDetailed) {
    $docs | sort 'Name' | format-list -property Name,Alias,Description,"Depends On",Default
} else {
    $docs | sort 'Name' | format-table -autoSize -wrap -property Name,Alias,"Depends On",Default,Description
}

Since the information on the tasks is already formatted as a list/table, the script that invokes -docs or -detailedDocs can't do anything else than print this information to the console.

In order to be able to be to do something with this data from the outside, there should be an option to return the objects themselves (ex: -structuredDocs). For example, we could do:

if ($showDetailed) {
    $docs | sort 'Name' | format-list -property Name,Alias,Description,"Depends On",Default
} elseif ($showSummary) {
    $docs | sort 'Name' | format-table -autoSize -wrap -property Name,Alias,"Depends On",Default,Description
} else {
    $docs
}

I am looking to have this feature because I want to be able to print a tree of the task dependencies in my build script. This will make it easier for my users to know which targets are available AND how they relate to each other... with minimal mental effort ;)

What do you think about this feature? From my opinion, it only opens up the door for people to do fun stuff with this metadata.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions