nushell icon indicating copy to clipboard operation
nushell copied to clipboard

`move`-Command Tests, Refactor, Fix

Open dannou812 opened this issue 1 year ago • 3 comments

fixes #11783

Description

Firstly Tests for the move Command have been added. Afterwards some duplicate Code has been removed and finally an error-message has been added for when a column is tried to be moved based on itself. This should fix #11783 .

To reiterate, the example of the initial issue now plays out as follows:

> {a: 1} | move a --after a                             
Error: nu::shell::incompatible_parameters

  × Incompatible parameters.
   ╭─[entry #1:1:15]
 1 │ {a: 1} | move a --after a
   ·               ┬         ┬
   ·               │         ╰── relative to itself
   ·               ╰── Column cannot be moved
   ╰────

User-Facing Changes

The error message shown above.

Tests + Formatting

I added some Tests for the behavior of the command. If I should add more, please let me know but I added everything that came to mind when thinking about the command.

dannou812 avatar Feb 19 '24 21:02 dannou812

I am sorry for all the commits but somehow I am not getting all the clippy warnings on my local machine. If anyone knows what the problem could be please let me know (I am running cargo clippy --workspace -- -D warnings -D clippy::unwrap_used)

dannou812 avatar Feb 19 '24 22:02 dannou812

Other than my comment above I think this looks good. Thanks!

fdncred avatar Feb 19 '24 23:02 fdncred

Great, I will change and commit it immediately.

dannou812 avatar Feb 19 '24 23:02 dannou812

Thanks for helping make nushell better!

fdncred avatar Feb 20 '24 13:02 fdncred