Skip to content

standard library: a few ideas of commands #8311

Closed as not planned
Closed as not planned

Description

@amtoine

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 personal nushell scripts

👉 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 👋

Activity

  1. added
    category:enhancement
    on Mar 4, 2023
  2. added
    A:std-library
    on Mar 4, 2023
  3. fdncred commented on Mar 4, 2023

    @fdncred
    Contributor

    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.

  4. amtoine commented on Mar 4, 2023

    @amtoine
    MemberAuthor

    I'm not sure what "standard show banner" means.

    i mean, i have this show banner that 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 rust code and giving some options to the user to change it on the fly!

    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}.

    these two are good ideas i think 😌

    Generally, most of these seem good to me.

    cool i'll see what i can do when i have some time, one step at a time 😉

    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.

    could you give details about what you mean?
    i opened #8304 to add a README to the standard library, maybe that partially solves what you say here? 😋

  5. fdncred commented on Mar 4, 2023

    @fdncred
    Contributor

    could you give details about what you mean?

    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.

  6. amtoine commented on Mar 4, 2023

    @amtoine
    MemberAuthor

    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.

    yep gotcha and agree on that 👍

    oops, i missed that you added a pr for a readme. good.

    no worries, i've done a bunch of times this morning 😉

  7. amtoine commented on Mar 5, 2023

    @amtoine
    MemberAuthor

    i've added a benchmark idea in the "discord" section 👍

  8. bobhy commented on Mar 10, 2023

    @bobhy
    Contributor

    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_DIRS which is used by nu-check command, so you can nu-check std.nu and it finds and parses that file. How about updating use command to do likewise?

  9. changed the title [-]a few ideas for the standard library[/-] [+]a few ideas of commands for the standard library[/+] on Mar 10, 2023
  10. fdncred commented on Mar 12, 2023

    @fdncred
    Contributor

    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 blah still works. I don't want to have to search aliases, then search externs, then search commands, then something else. The key to help -f blah being useful is that it searched everything to try to help you find what you're looking for.

  11. amtoine commented on Mar 12, 2023

    @amtoine
    MemberAuthor

    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 blah still works. I don't want to have to search aliases, then search externs, then search commands, then something else. The key to help -f blah being useful is that it searched everything to try to help you find what you're looking for.

    agree with that.

    so the point is more about "moving the subcommands of help" and keeping the main help where it is, i think!

    does that work for you @fdncred? 😋

  12. bobhy commented on Mar 12, 2023

    @bobhy
    Contributor
  13. bobhy commented on Mar 13, 2023

    @bobhy
    Contributor

    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:

    > myscript.nu --log-level debug <other arguments to myscript>

    without having to explicitly define a --log-level flag in your script, like --help works today.

    nu already 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 error today only allows 1 span (so far as I can tell).

  14. changed the title [-]a few ideas of commands for the standard library[/-] [+]standard library: a few ideas of commands[/+] on Mar 14, 2023
  15. added
    category:meta-issue
    on Apr 8, 2023
  16. kronberger-droid commented on Nov 13, 2026

    @kronberger-droid
    Contributor

    Most of this list exists by now, either built in or in std and std-rfc (banner, sys, rm --trash, path add, std/clip, std math, std iter).
    std-rfc is the place to propose new commands.
    Please open single issues for the ideas that are still missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:std-librarycategory:enhancementcategory:meta-issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions