-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
csi improvements #5857
csi improvements #5857
Conversation
82eb008
to
3e41e03
Compare
|
@dotnet/roslyn-compiler @amcasey @KevinH-MS @cston |
|
Do you mean the rest of the arguments after -- are treated as file names? |
|
@gafter Yes, or script arguments. See https://en.wikipedia.org/wiki/Command-line_interface#Option_conventions_in_Unix-like_systems |
|
Does each row of that table have a corresponding unit test? |
|
馃憤 The |
|
@tmat Actually, some of these results are confusing. Let's chat about the goals here. |
|
What does the very first case do? If everything following "--" is an argument, what gets run? |
|
@TyOverby Wrote up a proposed I agree with his proposed behavior, although I don't think special syntax should be specified for |
|
As a linux user, I would expect the following syntax out of an interpreter CLI. UsageScript ArgumentsIn all of these executions, I either expect to have my script name to be passed in on the arguments or not. This is how other scripting languages solve this problem
I'm ok with any of these decisions as long as it's consistent. That said, I think Ruby's option is the better choice and I'll use that in further examples. The meaning of "--""--" should only mean "we are done parsing csi-arguments." If we have already started parsing csi-arguments, then include the "--" in the script-arguments, otherwise leave it out. For example, there should be no difference between and The meaning of "-i"When "-i" is passed, csi will be started in "interactive mode" The only other way to enter "interactive mode" would be to pass in no script-arguments. csi # Open in interactive mode
csi -i # Open in interactive mode
csi a b c # Try to execute the script "a"
csi -i a b c # executes script "a" with argumetns ["b", "c"] and drops to interactive afterwards
These semantics are the same as python's The meaning of "-"When a single dash "-" is used in the place of a filename, instead of reading a file, stdin is used instead. |
Totally agree on |
|
Yeah, changing - to -i. We can implement - later. |
|
Specifically, in the table, here are what I would expect:
|
|
@TyOverby I have modified the impl to match Python, except for not implementing support for "-" (we can add it later). The behavior is slightly different from what you suggest in the table above. I have updated the table above. |
|
@tmat: How are you judging if the first argument to csi is a script file or not? What is it that makes these different? csi -i a b c
csi -i script.csx a b c |
|
@TyOverby It always is. In Python "-" means read the input from tty. That essentially means there is no script file to execute, just the stdin. |
|
@tmat So what is the way to pass in arguments to an interpreted mode that doesn't run a script by default? |
|
Not for U1. Will add later. The scenario is imo not important. |
|
Ok great! LGTM |
|
@JohnHamby FYI - this would resolve #5288 |
|
@tmat what would be the syntax to pass arguments to csi interactive mode without a script file when we add it later? |
|
@ManishJayaswal API review - yes, it's separate. |
|
@tmat Ok. So the example at the very top in description is incorrect then? csi -i a b c
|
|
Right. Fixed. |
|
馃憤 |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Improves and cleans up handling of command line arguments for csi.
Adds some alternative forms for arguments:
csc:
vbc:
csi:
Also changes "--" to match ruby/python/*nix. It indicates that the remaining arguments should not be treated as options.
csi only accepts a single script on the command line, any arguments following the script file name is now considered an argument to the script, not to csi.
"/i" or "-i" is now used to launch REPL after executing specified script with arguments:
The design mimics Python.
Fixes #5277