Open gedw99 opened 9 months ago
Thank you, Gerard, for the proposal. I think it makes sense. The only problem I see is that rye executable is already overloaded with options that I tried or that I have in ideas for. But concretely current behavior is this:
./rye
starts rye shell./rye file.rye
loads and executes rye fileSince we just made the first version of saving Rye shell state to a file, we need to make a quick way to reload shell state, this means something like ./rye -s shell_state.rye
but it must enter shell after loading the file so it will need additional flag or command for that.
Rye shell is an important part of Rye, so I'm wouldn't want to require an additional flag to enter it, in case main.rye exists in current folder ... What do you think if we leave current options as above but I main.rye is ran if present if commands is: ./rye .
- an dot would mean current folder in this case, so if there is main.rye in it it runs it?
Behavior would be similar to grep -r "something" .
or find . -name "xy"
... if you would pass a folder instead of . it would also execute main.rye if it found it in that folder.
What is you opinion on this?
I've implemented the .
option. so now it's bin/rye .
and it runs main.rye if it's in current folder or bin/rye examples/contextplay/.
and it will run main.rye in that folder. It's not yet of rye-front (just Rye) since it's not yet in a tagged release, it will be in few days.
If you have any feedback let me know. Thanks for the proposal!
If this is not what you wanted or you think there is a better way please reopen issue. I am closing it for now.
@gedw99 I've added your proposed main.rye functionality with dot "." argument in v0.0.18 ... you can see the CLI options here: https://www.reddit.com/r/ryelang/comments/1bv7bme/rye_cli_commands_and_flags_improved_and_help/
@refaktor thanks for the "." option. It will do the job for now. I appreciate there change,
I need to spend more time with the syntax for now, in order to make useful suggestions.
@gedw99 I've been thinking about more secure options to run Rye yesterday (using signed scripts and apparmour) and it coincides with the need to add something like "do_main" build option and when Rye is build with this it will only run main.rye in current folder by default, like you asked. I've also been thinking about trying to make a test android app with rye and fyne and I imagine it would be simpler if no arguments would need to be passed.
So I'm reopening this issue and I will try to add this build option. One idea about Rye is that you build your own binary on per project basis, so you can have all the dependencies and other options that you need for that project. This "do_main" would also make most sense per specific project.
@gedw99 do_main build flag was added to Rye, I will add it here too. If you build Rye with that only calling rye starts a main.rye in current folder.
@gedw99 I've built a test Fyne Rye app for Android. I will be also adding "embed_main" build flag that will build a Rye which already embeds main.rye into the binary and runds it, because packaged app in apk can't really open other files inside apk.
Wow this is really cool !!
thanks for there heads up. I will give it a try now
This "embed_main" should be online in a week or two ... next week I'll be missing from work a few days.
Would it make sense to formalise that main.rye is the first thing it looks for if nothing is passed in ?
There is already one example using this at https://github.com/refaktor/rye-front/blob/main/examples/webview/lightray/main.rye