Skip to content

Have "eval" without code arg take code from standard input #546

@atifaziz

Description

@atifaziz

Today, running dotnet script eval shows help. I suggest changing the default behaviour to read the code from standard input input. It would enable naturally evaluating a script in pipelines:

PS> echo 'Console.WriteLine(DateTime.Now)' | dotnet script eval
PS> 1..10 | % { "Console.WriteLine($_);" } | dotnet run -p .\src\Dotnet.Script -f netcoreapp3.1 -- eval

As well as:

curl http://example.com/script.csx | dotnet script eval

The above example would make support of running remote scripts obsolete.

Since the current default behaviour of showing help is not something someone would be relying on programmatically (e.g. via shell scripts), this change could be considered non-breaking.

An alternative would be that if the code argument given to dotnet script eval is exactly a hypen (-) then it would mean read code from standard input, but this seems less discoverable and somewhat of a superficial requirement.

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy