You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(...) Runs foo.nu in current context and call the `main` command automatically, (...)
But it does not happens:
/home/me/nu-report〉touch foo.nu 04/20/2022 11:06:06 AM
/home/menu-report〉nvim ./foo.nu 04/20/2022 11:06:11 AM
/home/menu-report〉cat ./foo.nu 04/20/2022 11:06:25 AM
def main [] { echo'Hi!' }
/home/me/nu-report〉chmod +x ./foo.nu 04/20/2022 11:06:28 AM
/home/me/nu-report〉source ./foo.nu 04/20/2022 11:06:32 AM
/home/me/nu-report〉source ./foo.nu; main 04/20/2022 11:06:46 AM
Hi!
How to reproduce
Create a .nu file with the content: def main [] { echo 'Hi!' }
touch foo.nu
nvim ./foo.nu # write the file
cat ./foo.nu
# def main [] { echo 'Hi!' }
Give execution permission to the file.
chmod +x ./foo.nu
Try source
source ./foo.nu
# nothingsource ./foo.nu; main
# Hi!### Expected behavior
Is expected that `source` invokes `main` by default, as informed.
### Screenshots![image](https://user-images.githubusercontent.com/43730756/164250746-5669ad2c-e563-4e50-b7c0-8920f4c8ef20.png)
### Configuration![image](https://user-images.githubusercontent.com/43730756/164250985-1189aab1-b85b-4ed3-bb33-a98c4aee48fd.png)
| key | value || ------------------ | ----------------------------------- || version | 0.61.0 || branch ||| tag ||| build_os | linux-x86_64 || rust_version | rustc 1.60.0 (7737e0b5c 2022-04-04) || rust_channel | stable-x86_64-unknown-linux-gnu || cargo_version | cargo 1.60.0 (d1fd9fe 2022-03-01) || pkg_version | 0.61.0 || build_time | 2022-04-20 09:56:20 -03:00 || build_rust_channel | release || features | default, trash, which, zip || installed_plugins ||### Additional context
_No response_
The text was updated successfully, but these errors were encountered:
i thought main was only invoked if launching a nushell script like nu script_name.nu paramaters versus with source? it seems to work that way for me with your example foo.nu script.
Describe the bug
Invoking
source --help
it says:But it does not happens:
How to reproduce
.nu
file with the content:def main [] { echo 'Hi!' }
source
The text was updated successfully, but these errors were encountered: