Skip to content

Add New-VtConsoleSequence, to provide embeddable strings and not require Pansies in distributable code #19

Description

@fsackur

Use case: my team has ~200 powershell modules deployed to an enterprise nuget source. Our dependency trees are a little cumbersome. We don't want to add any dependencies if we can avoid it.

We do use ANSI sequences, some of which I have generated with Pansies - ♥ - but I am currently doing some awkward manipulation to create strings which I can embed in our modules.

I would like to use a function New-VtConsoleSequence in development, to create those strings.

It would have a Reset switch in one parameterset, to output an ANSI reset; the other parameterset would accept any valid input to the ctor for RgbColor, e.g. ForestGreen1, ea0016.

I would also like a EscapeAsExpression switch, which would behave as follows:

> New-VtConsoleSequence ea0016 -EscapeAsExpression
$([char]27)[38;2;234;0;22m

> New-VtConsoleSequence -Reset -EscapeAsExpression
$([char]27)[39m

Then my module functions will have code like this:

$DeepSkyBlue = "$([char]27)[38;2;0;191;255m"
$Reset       = "$([char]27)[0m"
Write-Information "$DeepSkyBlue`Stuff possibly relating to other stuff.$Reset"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions