-
Notifications
You must be signed in to change notification settings - Fork 40
Porting commands to engine-q list #242
Comments
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 |
@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 |
@onthebridgetonowhere - it's yours |
May I try and port |
@aslynatilla - they're yours. |
@jntrnr yep, I've noticed this after I decided to work on |
Could I also have |
Hi, please sign me up for the |
@onthebridgetonowhere - yup! it's yours @LiHRaM - definitely. they're yours |
Working on a few
|
Can i be assigned the |
@luccasmmg - yup, it's yours! |
Worked on the |
@jntrnr - I am planning to do all the |
@onthebridgetonowhere - cool I'll mark those. |
@matthewauld thank you for all of your effort... You are now signed up for compact and default... Enjoy ! |
No problem! Really like nushell, figure this is a good way to learn the internals! |
I'm working on porting |
@onthebridgetonowhere - nice! if you haven't looked yet, you should be able to use some of the logic from the new |
Great suggestion, thanks JT. |
Could I have a go at the |
sure @pantonshire, have at it. |
looking for |
@fdncred - I'm signed up for |
I can do |
@kubouch it's yours |
I am thinking I'll give |
@onthebridgetonowhere - it's yours |
Currently, Maybe @andrasio might have some comments :-) . |
I'm trying to port |
thanks @nibon7 it's yours. |
We can do that, sure! I will @ you once there's a PR with the changes. |
I am unable to work on the |
Thanks @onthebridgetonowhere - i'll unmark you. we sure appreciate all your contributions! |
Closing this in favour of: nushell/nushell#4356 |
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
The text was updated successfully, but these errors were encountered: