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

add new nushell def --env def --wrapped syntax #158

Closed
fdncred opened this issue Oct 5, 2023 · 5 comments
Closed

add new nushell def --env def --wrapped syntax #158

fdncred opened this issue Oct 5, 2023 · 5 comments

Comments

@fdncred
Copy link
Contributor

fdncred commented Oct 5, 2023

Kubouch introduced some new syntax in PR10566. We need to support this syntax in the extension.

Old Env Syntax

def-env name [] {}

New Env Syntax

def --env name [] {}

or (I don't think the order matters)

def name --env [] {}

Old Wrapped Syntax

extern-wrapped name [] {}

New Wrapped Syntax

def --wrapped name [] {}

or (I don't think the order matters)

def name --wrapped [] {}

@glcraft Are you interested in helping with this one too?

@glcraft
Copy link
Contributor

glcraft commented Oct 6, 2023

I have some question:

  • I can handle any flags with --\w+ or I can handle only these two flags --(?:env|wrapped). I think it's better for the highlighter to handle all flags with the first solution to make colors consistent as you type. What do you prefer ?
  • About the order, it is simpler to implement both flags position at once at once, like (flags)(name)(flags), which makes the following valid for the highlighter : def --env name --env [] {}. Is it okay for you or do I need to make 2 separates rules. (Remember, this is for the highlighter only, it does not affect validation code in any case)
  • Should I need to wrap multi flags in case def evolves in the future to handle multiple flags, like def --flags1 --flags2 name [] {} ?

@fdncred
Copy link
Contributor Author

fdncred commented Oct 6, 2023

I can handle any flags with --\w+ or I can handle only these two flags --(?:env|wrapped). I think it's better for the highlighter to handle all flags with the first solution to make colors consistent as you type. What do you prefer ?

Right now, there are only env and wrapped. I haven't heard of any plans to add others.

About the order, it is simpler to implement both flags position at once at once, like (flags)(name)(flags), which makes the following valid for the highlighter : def --env name --env [] {}. Is it okay for you or do I need to make 2 separates rules. (Remember, this is for the highlighter only, it does not affect validation code in any case)

I think one rule is fine for the highlighter, if that's easier. If two rules is easier, do that.

Should I need to wrap multi flags in case def evolves in the future to handle multiple flags, like def --flags1 --flags2 name [] {} ?

I don't understand this question.

@glcraft
Copy link
Contributor

glcraft commented Oct 6, 2023

Right now, there are only env and wrapped. I haven't heard of any plans to add others.

Ok so I will implement those two only. If necessary in the future we can change for some more easily.

I think one rule is fine for the highlighter, if that's easier. If two rules is easier, do that.

It's easier to make one rule. I will do so 👍

I don't understand this question.

Is it planned that we use def with more than one flag at a time.
As you said earlier, there is no plan to other flags. So are --env and --wrapped usable in a same definition ?
Something like def --env --wrapped [] {}

@fdncred
Copy link
Contributor Author

fdncred commented Oct 6, 2023

I'd guess that def --env --wrapped [] {} is probably a thing. It means that we pass arguments as strings to an external and then we can also change the environment after that, like doing a cd. So, I think we should plan on that happening.

@glcraft glcraft mentioned this issue Oct 6, 2023
@fdncred
Copy link
Contributor Author

fdncred commented Oct 6, 2023

closed by #160

@fdncred fdncred closed this as completed Oct 6, 2023
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