Skip to content

Discussion: DSL: json => PS with custom attributes #94

Description

Hi maintainers,

I love that we have Crescendo and I have many use cases. But it's a hard sell to my team, because the creation of JSON files is different enough to the normal workflow to present a barrier to adoption.

I propose a DSL based on custom attributes that lets these be written as powershell script instead.

As a discussion starter:

[Crescendo.Command(OriginalName = 'bcu.exe', OriginalCommandElements = @('diag'), OutputHandlers = 'Parse-BcuDiagOutput')]
function Get-BcuDiag
{
    param
    (
        [Parameter()]
        [Crescendo.Parameter(OriginalName = "--tempshow")]
        [switch]$ShowTemperature
    )

    # no function body - that's Crescendo's job
}

Activity

  1. theJasonHelmick commented on Jul 28, 2021

    @theJasonHelmick
    Collaborator

    Freddie Sackur (@fsackur) - Thank you for opening this discussion. I’m going to transfer this to the Discussions page. Also linking similar discussion "Why JSON instead of psd1?" #96

    This is not on our plans for the crescendo GA, but I’m very interested in this discussion as adoption and the ease of creating the configuration files is important. Our focus has been to make the schematized JSON configuration as simple as possible, and we are investigating autogeneration of the configuration for newer native commands that produce structured output like Docker or kubectl. This wouldn’t cover all scenarios, especially older commands. As this investigation progresses, I will share more information here. Depending on community feedback, the autogeneration might be something we could look at doing post Crecendo GA.

    This doesn’t address those folks that would prefer to use PowerShell script to create the JSON configuration and I would be interested in further understanding:

    • What are the benefits to the authors/maintainers of Crescendo modules by adding the extra step of writing PowerShell script to generate the JSON?
    • Could some of the challenge to editing a JSON file be lessened with better tooling such as cmdlet that lets you specific a new command and basic options as parameters?: I.e. New-CrescendoCommand -verb -Noun -Alias <string[]> -OriginalCommand -OriginalCommandElements <>
    • Because folks may have different approaches to scripting the JSON, I would be interested in seeing what approach the community takes.

    Thank you for opening the discussion!

  2. locked and limited conversation to collaborators on Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions