nu-cmd-extra crate infrastructure in place with the Bits command as the model for adding other commands#9327
nu-cmd-extra crate infrastructure in place with the Bits command as the model for adding other commands#9327stormasm merged 8 commits intonushell:mainfrom stormasm:bits
Conversation
…cmd-extra in the next couple of commits
…tting the tests to work
…thing passes globally
amtoine
left a comment
There was a problem hiding this comment.
yeaaah, loooks great, as with the dataframes 👌
no tests disabled and looks it's working 💪
cargo run --features "" -- -n
does not have the bits commands but
cargo run --features extra -- -n
does 🥳
👇 a little question in a thread down below
❓ and an extra question, why do we have the code in nu-cmd-extra/src/extra/ and not nu-cmd-extra/src/? 😮
I tried to model it after the dataframes crate... But in reality I tried doing exactly what you said and just have nu-cmd-extra/src/But the way features work in Rust and Cargo it makes it way easier to have that "extra" level of indirection, no pun intended with the word extra 😄 |
|
@stormasm |
The way features work its easy to create a feature in rust if the code lives in a particular directory... So for example later on we can come along and bucket things up differently... We may possibly want to have a math feature and a bits-bytes feature... But initially I think it will be easier just to lump all of the nu-cmd-extra commands into one feature... I always find features to be confusing to end user developers who are not intimately familiar So my thinking for now is lets just keep this simple --- and have one feature called extra... In the future if we have lots and lots of commands in nu-cmd-extra then we can come back |
|
@stormasm |
|
@stormasm |
|
Yes it is a breaking change as they will need to build with this command to get the bits command... cargo build --features=extra' |
|
thanks 😌 |
requires - #9455 # ⚙️ Description in this PR i move the commands we've all agreed, in the core team, to move out of the core Nushell to the `extra` feature. > **Warning** > in the first commits here, i've > - moved the implementations to `nu-cmd-extra` > - removed the declaration of all the commands below from `nu-command` > - made sure the commands were not available anymore with `cargo run -- -n` ## the list of commands to move with the current command table downloaded as `commands.csv`, i've run ```bash let commands = ( open commands.csv | where is_plugin == "FALSE" and category != "deprecated" | select name category "approv. %" | rename name category approval | insert treated {|it| ( ($it.approval == 100) or # all the core team agreed on them ($it.name | str starts-with "bits") or # see #9241 ($it.name | str starts-with "dfr") # see #9327 )} ) ``` to preprocess them and then ```bash $commands | where {|it| (not $it.treated) and ($it.approval == 0)} ``` to get all untreated commands with no approval, which gives ``` ╭────┬───────────────┬─────────┬─────────────┬──────────╮ │ # │ name │ treated │ category │ approval │ ├────┼───────────────┼─────────┼─────────────┼──────────┤ │ 0 │ fmt │ false │ conversions │ 0 │ │ 1 │ each while │ false │ filters │ 0 │ │ 2 │ roll │ false │ filters │ 0 │ │ 3 │ roll down │ false │ filters │ 0 │ │ 4 │ roll left │ false │ filters │ 0 │ │ 5 │ roll right │ false │ filters │ 0 │ │ 6 │ roll up │ false │ filters │ 0 │ │ 7 │ rotate │ false │ filters │ 0 │ │ 8 │ update cells │ false │ filters │ 0 │ │ 9 │ decode hex │ false │ formats │ 0 │ │ 10 │ encode hex │ false │ formats │ 0 │ │ 11 │ from url │ false │ formats │ 0 │ │ 12 │ to html │ false │ formats │ 0 │ │ 13 │ ansi gradient │ false │ platform │ 0 │ │ 14 │ ansi link │ false │ platform │ 0 │ │ 15 │ format │ false │ strings │ 0 │ ╰────┴───────────────┴─────────┴─────────────┴──────────╯ ``` # 🖌️ User-Facing Changes ``` $nothing ``` # 🧪 Tests + Formatting - ⚫ `toolkit fmt` - ⚫ `toolkit clippy` - ⚫ `toolkit test` - ⚫ `toolkit test stdlib` # 📖 After Submitting ``` $nothing ``` # 🔍 For reviewers ```bash $commands | where {|it| (not $it.treated) and ($it.approval == 0)} | each {|command| try { help $command.name | ignore } catch {|e| $"($command.name): ($e.msg)" } } ``` should give no output in `cargo run --features extra -- -n` and a table with 16 lines in `cargo run -- -n`
I wanted to get the infrastructure in place for starters for our nu-cmd-extra crate...
The plan is to put inside here the following commands...
I thought it would be easier to do one at a time as well as get the nu-cmd-extra crate out there on crates.io
for this upcoming release...
Once this lands the infrastructure will be in place to move over the other noted commands for now...
And then add other stuff we do NOT want to be in 1.0.