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

Syntax sugar for function containing shell commands #46

Open
no-more-secrets opened this issue Jan 21, 2024 · 2 comments
Open

Syntax sugar for function containing shell commands #46

no-more-secrets opened this issue Jan 21, 2024 · 2 comments

Comments

@no-more-secrets
Copy link

no-more-secrets commented Jan 21, 2024

Can I propose a sugared syntax for defining a function containing only shell commands. Currently we have this:

function foo()
  return {
    # shell commands only
  }
end

I think this would be nicer like so:

function foo() {
    # shell commands only
}

The two would be equivalent; the latter would be syntax sugar for the former. I think this would make the scripting language even more integrated with the shell language, i.e. it would feel even more natural to mix the two while still keeping the two separate. What do you think?

@gahag
Copy link
Collaborator

gahag commented Feb 7, 2024

Interesting suggestion. I believe this would require significant changes to the parser, tho. Feel free to submit a PR :)

@no-more-secrets
Copy link
Author

@gahag I probably won't have the bandwidth to do it myself, but happy to leave it here in case anyone else would like to pick it up.

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

No branches or pull requests

2 participants