Repository navigation
Closed as not planned
Labels
A:std-libraryDefining and improving the standard library written in Nucategory:enhancementNew feature or requestcategory:meta-issueAn issue that tracks other issues
Description
Go back to the roadmap.
hello there 👋
we've made a start on the standard library in #8150 🎉
i was thinking about some other things we might want to add to the standard library 😏
the actual ideas
👉 looking at my personal collection of scripts and taking comments i've had on the discord server:
Note
these are NOT true requests, only ideas i put forward 😉
some of them might not make sense in the standard library
some might be missing from what i've gathered in my personalnushellscripts
- a "downloads" module to interact with the downloads file by defining
$env.DOWNLOADS_DIR - some cross-platform tools
- a standardized
show banner - a "sys" module to interact with the system in a structured way
- a "trash" module to interact with the XDG standard trash with
rm --trashinside$env.XDG_DATA_HOME | path join Trash -
has-envis often asked for i think - and also some miscellaneous commands:
clip,history statsandhistory search, maybewatch cpu - i have a
shell_prompt setupwork-in-progress to allow designing the prompt in a friendly way - a
path add extensionto add a file extension to a path
👉 from the official community nu_scripts
Note
there are a lot of things in these scripts, so i've focused on the top-level directory names only, pre-selecting the ones that look that post promising to me at the moment 😋
i think that's all for now.
i'm curious about what you think of all this 😌
- i'll mark the ones that do not deserve the standard library as "won't fix" and tick them
- i can start working on the ones you think would be great in the standard library
- let me know if i forgot some ideas and i'll add them to the task list
cheers 👋
Metadata
Metadata
Assignees
Labels
A:std-libraryDefining and improving the standard library written in Nucategory:enhancementNew feature or requestcategory:meta-issueAn issue that tracks other issues
Activity
fdncred commentedon Mar 4, 2023
I'm not sure what "standard show banner" means. I mean, it's standardized already. We could add it to stdlib though as it exists in the rust code and allow people to change it, if that's what you mean. I'm also wondering if we move the banner to stdlib, how does that work with the config variable to turn it off? I guess we could do
if $env.config.show_banner {show_banner}.Generally, most of these seem good to me. I think the most important thing at this point is organization of it's usage. Because it really needs to be clear how to turn things off and not include things.
amtoine commentedon Mar 4, 2023
i mean, i have this
show bannerthat allows to show some banner.i thought this could be made more "standard" and put in the stdlib, e.g. by using the banner from the
rustcode and giving some options to the user to change it on the fly!these two are good ideas i think 😌
cool i'll see what i can do when i have some time, one step at a time 😉
could you give details about what you mean?
i opened #8304 to add a
READMEto the standard library, maybe that partially solves what you say here? 😋fdncred commentedon Mar 4, 2023
What I mean is that it doesn't need to turn into nu_scripts with stuff scattered everywhere with no real standard of where to put things or how to add or remove them. It would be good to have a readme.md in this folder to point people to whatever standard of organization we're going to use and how to remove things from the stdlib if they don't want them run aka comment them out. Much of this is still undefined but what I'm saying is that I think the stdlib needs to be super organized and kept tidy.
oops, i missed that you added a pr for a readme. good.
amtoine commentedon Mar 4, 2023
yep gotcha and agree on that 👍
no worries, i've done a bunch of times this morning 😉
amtoine commentedon Mar 5, 2023
i've added a
benchmarkidea in the "discord" section 👍FEATURE: add the startup time to `$nu` (#8353)
bobhy commentedon Mar 10, 2023
One thing to define is how to deploy the script files such that a user's config can easily load them and define aliases that depend on them.
I see there is
$env.NU_LIB_DIRSwhich is used bynu-checkcommand, so you cannu-check std.nuand it finds and parses that file. How about updatingusecommand to do likewise?[-]a few ideas for the standard library[/-][+]a few ideas of commands for the standard library[/+]fdncred commentedon Mar 12, 2023
I want to be careful about moving help commands over to stdlib. Generally, I agree with it. However, we need to be able to have some place where everything is searchable so that
help -f blahstill works. I don't want to have to search aliases, then search externs, then search commands, then something else. The key tohelp -f blahbeing useful is that it searched everything to try to help you find what you're looking for.amtoine commentedon Mar 12, 2023
agree with that.
so the point is more about "moving the subcommands of
help" and keeping the mainhelpwhere it is, i think!does that work for you @fdncred? 😋
bobhy commentedon Mar 12, 2023
bobhy commentedon Mar 13, 2023
Just to put this idea somewhere: logging, that would be used by modules (scripts) in the standard library and be a recommended way for users to add logging to their own scripts. Likewise a standard error function that user could put in scripts to display a standard Nushell error.
So commands like
log <level> <message>, with some standard flags that could be added to any script to select level of messages to actually display. you could do:without having to explicitly define a
--log-levelflag in your script, like--helpworks today.nualready has--log-level, but that applies to shell operation itself, and user would not want to see those messages when debugging his/her own script.For the error command, could be a thin wrapper around
make error. But it would be nice to add a second generic error that allows you to specify 2 spans with different labels.make errortoday only allows 1 span (so far as I can tell).[-]a few ideas of commands for the standard library[/-][+]standard library: a few ideas of commands[/+]add a cross platform `clip` command to the standard library (#8695)
REFACTOR: move the banner from the `rust` source to the standard libr…
REFACTOR: remove the shell commands (#8415)
kronberger-droid commentedon Nov 13, 2026
Most of this list exists by now, either built in or in
stdandstd-rfc(banner,sys,rm --trash,path add,std/clip,std math,std iter).std-rfcis the place to propose new commands.Please open single issues for the ideas that are still missing.