Home

Feedback needed: command-line interface

2»

Comments

  • How do I redirect nuget requests to custom nuget server?
  • edited August 2013
    Per execution. At the command line. In conjunction with "ref nuget:Rx-Main;"
  • I guess I could add a -nuservers option. You'd need to specify each of the desired server(s) in sequence. Is there a use-case? (For this versus global config)
  • Alpha/Beta queries will usually go to live nuget server while production queries will usually either let a local nuget server override (or forbid external nuget server reference altogether as it is by IT often considered a potential liability/attack vector). This will depend not only on what the queries do, but also the execution context, what the target data is as well as the set of privileges under which it executes rather than the computer on which it is installed.
    But lprun.exe is a huge win, no matter what.
  • edited August 2013
    If you don't mind poking the global config, you could write a query like this to change where LINQPad downloads NuGet packages, then call it as follows:
    lprun ConfigureNuGet.linq LocalServer=http://mylocalNugetServer
    lprun -nunuget MyQuery.linq > result.txt
    ...
  • That works. Thanks!
    Probably something that would work for query provided data connections as well? Having the possibility to set details from within the query (or query header) helps xcopy deployment.
  • Yes - you can specify query connection details entirely in the header of a .linq file. To see how it's done, look at a .linq file saved via the LINQPad GUI.

    Notice that there's an ID element in connection details of type Guid. If you omit this, LINQPad won't go looking in the global connections file and will simply use the details supplied.
  • I would like to think of this as the first step in separating the gui from the backend so that we can have a mono capable back end with a different ui....
  • Seems very promising.
    Is there an option to pass commands like Perl -e option, without any script file needed ?
    For example in Perl: perl -e "my $v=1; print $v+2;"
    would be in C# : lprun -e "int i = 1; Console.Write(i + 2);"
    (option name to be defined)
  • No, there's no option for that as yet.
  • Run the code below via lprun(Version 5.32.01)
    void Main(string[] args)
    {
    	Console.WriteLine(Console.IsErrorRedirected);
    	Console.Error.WriteLine("Hihihi");
    	throw new Exception("OH haha");
    }
    The output below shows that Console.Error.WriteLine and exception messages are still written to stdout instead of stderr, which is inconvient for me as I intent to use lrpun in TortoiseSVN's client-side pre-commit hook which displays only stderr when exit code is non-zero. May I confirm that this feature is not yet implemented?
    C:\Users\Administrator\Desktop>lprun.exe -warn svn_precommit_hook.linq  > outp
    ut.txt 2> error.txt
    
    C:\Users\Administrator\Desktop>type error.txt
    
    C:\Users\Administrator\Desktop>type output.txt
    True
    Hihihi
    Exception: OH haha
       在 UserQuery.Main(String[] args) 位置 C:\Users\Administrator\Desktop\svn_precommit_hook.linq:行号 5
       在 LINQPad.ExecutionModel.ClrQueryRunner.Run()
       在 LINQPad.ExecutionModel.Server.RunQuery(QueryRunner runner)
    
  • Writing to stderr output is not yet implemented. Right now, LINQPad only has a mechanism for a single output stream.
  • I've checked that LINQPad 7 is redirecting to stderr as expected but LINQPad 5 doesn't.
    Will it be ever supported? Could it be somehow hacked?

Sign In or Register to comment.