-
Notifications
You must be signed in to change notification settings - Fork 163
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli: add support for passing command-line arguments to the REPL and script environments #412
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that's what the discussion asked for? They were talking about reusing the pixel format arguments, which are probably already available from iface
.
Also this silently ignores excess arguments for scripts that don't parse args.
Huh, somehow I missed that detail ... the risks of quickly reading something on mobile and thinking about it lots 🤦♀️
Granted, but only after a glasgow repl uart -V 3.3 -m 5 # presents Glasgow's normal error
glasgow repl uart -V 3.3 -- -m 5 # passes in [ '-m', '5' ] |
Ew, no. |
Ah, I missed that detail. That's fine then to merge for |
Where I've done this: future = eval(code, {"iface":iface, "device":device, "args":args.remaining[1:]}) ... I was suggesting doing this: future = eval(code, {"iface":iface, "device":device, "args":args}) ... giving the script access to Glasgow's args (e.g: pixel format from the WS2812 applet), as well as Still ew?
I think I agree re REPL mode as it's so heavily interactive... but perhaps changes in light of above? |
Oh, no, this is fine. (That's actually what I would suggest!) |
Yeah, that's clearly fine. |
0c33fb7
to
19e3d7e
Compare
…cript environments
7e3f949
As discussed in
#glasgow
, it would be nice to make command line arguments available to the REPL and script environments (especially the latter).This patch adds support for this, with a small example script.