Skip to content
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

Updated select-aws-profile script to work with nushell version >= 0.94.2 #876

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

necromeo
Copy link

I've noticed that the select-aws-profile script doesn't work anymore as of nushell version 0.94.2.
I've never used that script before, therefore I don't know from which version on it stopped working.

Exporting a function with the same filename is disallowed, hence the name change to main. As per the docs:

Exporting a command called main from a module defines a command named as the module.

Also, there were scoping issues. The env vars weren't being set. Adding the --env flag fixes that.

@fdncred
Copy link
Collaborator

fdncred commented Jun 12, 2024

I'm not sure about renaming to main. Seems like someone could use this module and just call select-aws-profile and it work fine.

@necromeo
Copy link
Author

necromeo commented Jun 12, 2024

Can't leave it as select-aws-profile

Error: nu::parser::named_as_module

  × Can't export command named same as the module.
   ╭─[/home/andre/.config/nushell/select-aws-profile.nu:1:18]
 1 │ export def --env select-aws-profile [] {
   ·                  ─────────┬────────
   ·                           ╰── can't export from module select-aws-profile
 2 │     hide AWS_REGION;
   ╰────
  help: Module select-aws-profile can't export command named the same as the module. Either
        change the module name, or export `main` command.

@fdncred
Copy link
Collaborator

fdncred commented Jun 13, 2024

ya, i think that means that the file needs to be named different than the custom command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants