Closed stormasm closed 2 years ago
I can do all the math commands no problem
@luccasmmg sounds great ! thank you.... over time as you submit the PRs please reference this issue and then I will go ahead and mark it done ---- I will sign you up for the math commands now ---- so folks will know you are working on them...
Hi, I want to try all of config
commands
@vitvakatu Thank you ! I signed you up for all of the config commands...
I'd love to work on all the date commands!
@vitvakatu - engine-q config works a bit differently than Nushell, but you might be able to still port much of the functionality. Rather than using a toml file, engine-q uses a nushell script that runs in startup.
@onthebridgetonowhere - sounds good!
Could I have a go at first
as well? Thanks!
@onthebridgetonowhere - it's yours
May I try and port echo
and format
?
@aslynatilla - they're yours. echo
should be simpler in e-q than it was in Nushell as each
does all the iteration now. You should just be able to send on the PipelineData you get
@jntrnr yep, I've noticed this after I decided to work on config
:) I think I will be able to port it anyway. Thank you!
Could I also have into string
from conversions? Thanks!
Hi, please sign me up for the path
commands, if possible. :)
@onthebridgetonowhere - yup! it's yours
@LiHRaM - definitely. they're yours
Working on a few str
cases:
camel-case
kebab-case
pascal-case
screaming-snake-case
snake-case
Can i be assigned the from yaml
command?
@luccasmmg - yup, it's yours!
Worked on the str capitalize
command nushell/engine-q#317
@jntrnr - I am planning to do all the str
commands, but it will take me like a week or so (a bit every day). Unless, someone else wants to work on them and is faster :-)
We can also mark into string
as done, you added the cell path support to it.
@onthebridgetonowhere - cool I'll mark those.
@onthebridgetonowhere Could you implement the str to-datetime
and str to-decimal
as into datetime
and into decimal
? I think they should be there and not in the str
group.
@kubouch let's do that. And would it keep its original purpose of converting strings
only into datetime/decimal?
@onthebridgetonowhere I think so. We have into X
commands for other types as well. We might want to modify into decimal
to accept also integers, not only strings, but that should be easy to do.
Can i be assigned from url
and from eml
?
also the math variance
command it not marked in the issue, even tough it is done
@luccasmmg yup they're yours
Hello, I'm interesting in porting the parse
command.
@CBenoit - it's yours
@kubouch @onthebridgetonowhere related to the into
commands, there is into int
and str to-int
and they have similar but different functionality. I'd like to see all of str to-int
's functionality brought into into int
if possible. Thoughts?
@fdncred +1 definitely. I overlooked str to-int
.
@fdncred @kubouch we can do that! Thanks for the suggestion.
@vitvakatu - I ended up taking a look at the config from the engine side and put some basic support together for a config variable: https://github.com/nushell/engine-q/pull/332
I haven't merged it yet if you want to take a look.
I haven't ported any of the config
commands, yet. Happy to chat about designs and how this works with your work.
@jntrnr thank you for ping, I'll contact you in a few days if face some real problems. After a brief look, I think it won't notably affect my code
parse
(category strings) command done porting in https://github.com/nushell/engine-q/pull/338
Next I’ll port hash
command + subcommands.
Can I be assigned the rest of the "from" commands?
@luccasmmg - yup!
Could I contribute to random
commands? 😸
@jaeheonji great ! you are all signed up for the random commands... as you finish the commands reference this issue and we will mark them as done... We appreciate you helping us out, many thanks....
Hello, can I please be assigned to
all?
any?
find
keep until
keep while
skip
skip until
skip while
@arthur-targaryen you are all set and signed up for your requested commands... Thank you so much for helping out with our engine-q porting of nushell commands !
@stormasm hi, I'm afraid I can't find time to port config commands in the nearest future, so please make these commands available for others. It's really cool to see so much activity on this task!
@vitvakatu thanks for the heads up ! I removed your name from the config commands... Of course we welcome your participation in the future when you get more free time...
@jaeheonji @arthur-targaryen
FYI thanks for your effort --- it will be easier if you do this...
Our preference when sending us a Pull Request (PR) is to do one command at a time. It makes it a lot easier for us to review the code as well as making the merge conflicts easier to figure out...
Thanks kindly !
Our preference when sending us a Pull Request (PR) is to do one command at a time.
Ok, I understand! I will split my PR into smaller ones.
Since i'm almost finished with the from
(only two left) commands, can i be assigned all the to
as well?
@luccasmmg - yup!
Hi, I can take /platform
, i.e. clear, du, exec, kill, pwd, sleep and which.
@Scorpil sounds good, I'll add you
Phew, finished all the str
commands. I can do cal
and pathvar
next.
@onthebridgetonowhere Great job, thanks a lot! Maybe you can skip the pathvar
, I had some ideas how we could get away without it.
Sounds good! Will port cal
then, I remember I worked on it in the original nushell
.
Updated on January 14, 2022
We are getting closer thanks to everyone's help !
Instead of commenting on this issue, please go to nushell/nushell#4356
Engine-q will become Nushell's new parsing and evaluation engine in the future. As part of this, we'll port the existing Nushell commands into Engine-q. Much of this porting can be done mechanically, as while the two systems differ, they are similar enough that many commands can be ported following the steps below.
You can sign up to help out porting a command by commenting on this issue.
Our preference when sending us a Pull Request (PR) is to do one command at a time. It makes it a lot easier for us to review the code as well as making the merge conflicts easier to figure out...
Note: Instructions on how to port these commands from Nushell to Engine-q are below the list.
table
nowcd -
metadata
hide
Missing features/commands
to-nu
to-nu
decode
commandjson -r
Porting WholeStreamCommand (nushell) to Command (engine-q)
All commands have the standard boilerplate methods including
Name and usage is fairly obvious
Signature
The signature can have required parameters, optional parameters, or no parameters. An example of a command with no parameters is the command length.
Please be sure and add in the Category of the command you are porting so that our documentation and filtering system picks it up
Commands with optional and required parts should work similarly between Nushell and Engine-q.
Run
Nushell:
Engine-q:
Run is where all of the action happens when porting over a command from nushell or writing a new command. You'll notice that Engine-q uses a much more expanded form of the arguments when compared to Nushell's more compact form. This allows for clear access to the components of running a command:
EngineState
The EngineState gives access to the global state of the engine, which currently is mostly the declarations that need to be known in order to run any code in the system.
Stack
The stack is a snapshot of the values that the current block can see. This Stack is narrowed using closure capture to only the variables the block can see.
Call
The call represents the call itself, including:
decl_id
)head
)positional
)named
)Rather than reaching into this structure directly, it's often better to access the contents of this call via the helper methods that can evaluate the unevaluated arguments for you:
The type of the variable allows
call.req(...)?
to invoke the right converter for you, failing with a type mismatch error if the caller has passed the wrong type at runtime. We use the same technique in Nushell, so this should port similarly with the change of havingcontext
as a new argument to the helper methods.PipelineData
In Nushell, input and output were handled as streams. Commands often just applied themselves as calls onto these streams. The stream concept was helpful to get going, but also shows its limitations. For example, how do you represent a single value in the stream? What's the difference between a single item list and a single item? When should we take a list and flatten it into the stream? Ambiguities like this were fairly common in practice with implementing Nushell commands.
With Engine-q, we separate the various data types into specific cases. Single value outputs are now just a single value case of Value. Streams are handled separately from Value, and both form a
PipelineData
enum. This works for both input and output to commands.To port from Nushell to Engine-q, for commands that call
.map
or.flat_map
on the input stream, we've implemented helpers onValue
that you can call with the same name. You can also callinto_iter
to get a full iterator. Additionalyl, you can also match onPipelineData
yourself and handle the different cases.Adding your commands
Add your newly ported commands to the
crates/nu-command/src/default_context.rs
file that is in thenu-command
subcrate. There, you'll see a list of the commands that will be loaded in the default context. Adding your command here will make it visible when you start up Nu.Tests and subcommands
If you add a new top-level command with subcommands, you'll need to add the top-level command to the group of default commands in the test context. You'll find this list in the
crates/nu-command/src/example_test.rs
file.References
Core Engine-q data structures
From 12/13/2021 Discord
JT Note on Most important commands still needed to be ported