cmd/starlark: add -c flag to execute cmdline program#47
Merged
alandonovan merged 1 commit intogoogle:masterfrom Dec 7, 2018
Merged
cmd/starlark: add -c flag to execute cmdline program#47alandonovan merged 1 commit intogoogle:masterfrom
alandonovan merged 1 commit intogoogle:masterfrom
Conversation
alandonovan
approved these changes
Dec 7, 2018
cmd/starlark/starlark.go
Outdated
| var ( | ||
| cpuprofile = flag.String("cpuprofile", "", "gather CPU profile in this file") | ||
| showenv = flag.Bool("showenv", false, "on success, print final global environment") | ||
| execprog = flag.String("c", "", "execute program `c`") |
Contributor
There was a problem hiding this comment.
c (in the usage) should be stmt or prog, perhaps?
Collaborator
Author
There was a problem hiding this comment.
Changed to prog. It can be more than one stmt--it can contain semicolons.
alandonovan
reviewed
Dec 7, 2018
cmd/starlark/starlark.go
Outdated
| var ( | ||
| cpuprofile = flag.String("cpuprofile", "", "gather CPU profile in this file") | ||
| showenv = flag.Bool("showenv", false, "on success, print final global environment") | ||
| execprog = flag.String("c", "", "execute prog `c`") |
Contributor
There was a problem hiding this comment.
Er, you changed program to prog but left c alone. :)
Collaborator
Author
There was a problem hiding this comment.
Sigh. I'm so scatterbrained right now. Multitasking. Sorry. :( Fixed now.
Contributor
There was a problem hiding this comment.
No worries. The "Commit" button on most of these apps might as well be called "Begin spelling review" in my case.
-c was chosen to match Python. Sample: $ starlark -c "print(max(range(10)))" 9 $ starlark -c "a = 'hi'" -showenv a = "hi"
Collaborator
Author
|
Hmm, I thought I might have write access, but I guess I was wrong. :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-c was chosen to match Python. Sample:
$ starlark -c "print(max(range(10)))"
9
$ starlark -c "a = 'hi'" -showenv
a = "hi"