Fix issues in the example configs#14601
Conversation
6a773bd to
4d2e16e
Compare
4d2e16e to
2b4cd1c
Compare
| # - 'd': dimmed | ||
|
|
||
| # foreground, background, and cursor colors are not handled by Nushell, but can be used by | ||
| # foreground, background, and cursor colors are not handled by Nushell, but can be used by |
There was a problem hiding this comment.
I am unsure what to do here, example configuration should work out of the box, or else it is really confusing to try different options
| $env.config.color_config.float # Float value | ||
| $env.config.color_config.glob # Glob value (must be declared) | ||
| # TODO: https://github.com/nushell/nushell/issues/14600 | ||
| #$env.config.color_config.glob # Glob value (must be declared) |
There was a problem hiding this comment.
Probably other deleted options in this list are affected by the same linked issue
There was a problem hiding this comment.
I think these are fine. They are simply lists of settings here. We don't need to show a "default" or example value for each one, IMHO. The code is uncommented so that it is syntax highlighted when viewing through nu-highlight. Ultimately, this is "documentation" that probably gets moved over to the Book itself, and these files go away.
There was a problem hiding this comment.
In the best scenario, docs would be autogenerated, so #14600 couldn't happen
There was a problem hiding this comment.
Also, this kind of approach (storing documentation as default config) is not really viable for something like nixos (where configs are managed by nix itself, you don't have a default config in your disposal)
There was a problem hiding this comment.
@PerchunPak Agreed - That's why the only method for a user to access them is nu config --sample. The end-user (and package manager) never has access to them directly.
In the past (0.100 and before) doc and defaults were mixed. Starting in 0.101 with these changes, they no longer are.
There was a problem hiding this comment.
So should I return all other deleted options?
There was a problem hiding this comment.
Yes, any option that is just listed by itself without an assignment should be returned. Thanks!
2b4cd1c to
ad4b24b
Compare
| use std/util "path add" | ||
| path add "~/.local/bin" | ||
| path add ($env.CARGO_HOME | path join "bin") | ||
| path add ($env.HOME | path join ".cargo/bin") |
There was a problem hiding this comment.
I don't have cargo installed, so I made it to not depend on cargo
There was a problem hiding this comment.
Well, that would break my system ;-)
If you were using Cargo, then you'd need to use $env.CARGO_HOME to calculate it properly.
It's okay to have examples that don't run on everyone's system. The point here is a dynamically computed path based on an environment variable. If it's $env.HOME, that's no different than:
path add "~/.cargo/bin"
That's the exact same example as the one above it ;-)
d021982 to
4a20783
Compare
NotTheDr01ds
left a comment
There was a problem hiding this comment.
I think it would be good to have a PR that we can quickly approve with the typo fixes. We can sort the others out separately, but I'd like to make sure your typo corrections get into 0.101.
| $env.config.plugin_gc.default | ||
| # true to enable stopping of inactive plugins | ||
| $env.config.plugin_gc.default.enabled | ||
| # how long to wait after a plugin is inactive to stop it |
There was a problem hiding this comment.
| # how long to wait after a plugin is inactive to stop it | |
| # How long to wait after a plugin is inactive before stopping it |
| # Configuration for plugin garbage collection | ||
| $env.config.plugin_gc | ||
| $env.config.plugin_gc.default | ||
| # true to enable stopping of inactive plugins |
There was a problem hiding this comment.
| # true to enable stopping of inactive plugins | |
| # true to enable stopping inactive plugins |
There was a problem hiding this comment.
I know this was the original text that I left in from the original config - Just noticing it could be improved as long as it's getting moved :-)
| # before your config.nu loads), the path variable is a list that can | ||
| # be appended to using, for example: | ||
| $env.path ++= "~/.local/bin" | ||
| $env.PATH ++ [ "~/.local/bin" ] |
There was a problem hiding this comment.
| $env.PATH ++ [ "~/.local/bin" ] | |
| $env.PATH ++= [ "~/.local/bin" ] |
Right?
There was a problem hiding this comment.
These worked when I wrote them. Then the ++ and ++= operators were changed ;-).
There was a problem hiding this comment.
Huh, it used to raise a syntax error but no longer
| @@ -1,5 +1,7 @@ | |||
| # env.nu | |||
| # | |||
| # version = "0.100.1" | |||
There was a problem hiding this comment.
There's probably a buildscript somewhere that needs to be updated in order to do this. Otherwise it's always going to be out-of-date.
When I get back to my desk I'll try to figure this out.
There was a problem hiding this comment.
But I'm not sure we should put a version in a file that simply has comments anyway :-)
| $env.config.color_config.float # Float value | ||
| $env.config.color_config.glob # Glob value (must be declared) | ||
| # TODO: https://github.com/nushell/nushell/issues/14600 | ||
| #$env.config.color_config.glob # Glob value (must be declared) |
There was a problem hiding this comment.
@PerchunPak Agreed - That's why the only method for a user to access them is nu config --sample. The end-user (and package manager) never has access to them directly.
In the past (0.100 and before) doc and defaults were mixed. Starting in 0.101 with these changes, they no longer are.
| $env.config.hooks.display_output = "" # Before Nushell output is displayed in the terminal | ||
| $env.config.hooks.command_not_found = [] # When a command is not found | ||
| # Before each prompt is displayed | ||
| $env.config.hooks.pre_prompt = [{ null }] |
There was a problem hiding this comment.
I can understand moving the comments for consistency, but why the null additions?
There was a problem hiding this comment.
Those were in 0.100.0 example config, and because $env.config.hooks.env_change had wrong type, I decided to return default value as an example. I can remove all nulls if you prefer so
cbaa2ec to
2747ec2
Compare
|
I think we should add something to the top along the lines of: |
160945e to
eb54aaf
Compare
|
Shouldn't |
Not any longer. As primarily constants now, they can be set and used in the same file. There's really nothing that we have to set in |
For me, they didn't apply inside config.nu until I moved them to env.nu ( |
They work for me on the latest main. I just tested again. |
|
I also think all config files should have a version number to show which version of nushell they're compatible with. |
fdncred
left a comment
There was a problem hiding this comment.
If this is a "sample" people will put it in place as the config and try it out. This file should work. I've added a few comments where it doesn't work but there are more than I listed.
Release is quickly approaching and we need to get this resolved.
| @@ -1,6 +1,4 @@ | |||
| # Nushell Config File | |||
| # | |||
| # version = "0.100.1" | |||
There was a problem hiding this comment.
add versions back and add them to all files please.
| # --------------- | ||
| # Per-plugin configuration. See https://www.nushell.sh/contributor-book/plugins.html#configuration. | ||
| plugins: {} | ||
| $env.config.plugins |
There was a problem hiding this comment.
all keys should have values - also on $env.config.table.abbreviated_row_count above, as well as rows below.
Ack - No. This is documentation. This was never designed to be run. I'll change the name of the file and command to be more clear on that. |
If we don't want people trying to use these files, which seems like they intuitively would, given the file names, then the files should have documentation (or something other than sample/example) in the name and the first lines of the file should state that it's documentation and not intended to be used as a configuration file. If they're going to be documentation, hopefully they'll be complete, otherwise I'm not sure what purpose they serve. e.g. I'm not sure how helpful it is to say "here's some of the settings you can use" vs "this is a list of all settings and what they mean". |
|
@PerchunPak The confusion on this seems to likely be due to my poor choice of naming :-/ I definitely never intended these to be used as actual configuration files - They are simply doc. I've just submitted #14608 to rename these from While doing this, I went ahead and pulled in most of your changes so that we can get this nailed down before the feature freeze in two days. Thank you, Thank you, Thank you! for finding these. About the only change I didn't make was updating indentation to 4 spaces consistently. We haven't settled on that yet, and are leaning towards 2 spaces for Nushell code-style. I know there are inconsistencies right now, but I'll update them when we land on a decision there. |
eb54aaf to
604812f
Compare
|
For some reason, sample config had multiple syntax errors and other issues, like undefined options. Other configs had minor issues like spaces at the end of line.
604812f to
8d555fd
Compare
|
@NotTheDr01ds should be done, except for #14601 (comment) (but I feel that #14608 is more suitable for this change) |
|
ok, thanks. |
# Description With great thanks to @fdncred and especially @PerchunPak (see #14601) for finding and fixing a number of issues that I pulled in here due to the filename changes and upcoming freeze. This PR primarily fixes a poor wording choice in the new filenames and `config` command options. The fact that these were called `sample_config.nu` (etc.) and accessed via `config --sample` created a great deal of confusion. These were never intended to be used as-is as config files, but rather as in-shell documentation. As such, I've renamed them: * `sample_config.nu` becomes `doc_config.nu` * `sample_env.nu` becomes `doc_env.nu` * `config nu --sample` becomes `config nu --doc` * `config env --sample` because `config env --doc` Also the following: * Updates `doc_config.nu` with a few additional comment-fixes on top of @PerchunPak's changes. * Adds version numbers to all files - Will need to update the version script to add some files after this PR. * Additional doc on plugin and plugin_gc configuration which I had failed to previously completely update from the older wording * Updated the comments in the `scaffold_*.nu` files to point people to `help config`/`help nu` so that, if things change in the future, it will become more difficult for the comments to be outdated. * # User-Facing Changes Mostly doc. `config nu` and `config env` changes update new behavior previously added in 0.100.1 # Tests + Formatting - 🟢 `toolkit fmt` - 🟢 `toolkit clippy` - 🟢 `toolkit test` - 🟢 `toolkit test stdlib` # After Submitting * Update configuration chapter of doc * Update the blog entry on migrating config * Update `bump-version.nu`
This file is not made accessible to the user through any of our `config` commands. Thus I discussed with Douglas to delete it, to ensure it doesn't go out of date (the version added with nushell#14601 was not yet part of the bumping script) All the necessary information on how to setup a `login.nu` file is provided in the website documentation
This file is not made accessible to the user through any of our `config` commands. Thus I discussed with Douglas to delete it, to ensure it doesn't go out of date (the version added with #14601 was not yet part of the bumping script) All the necessary information on how to setup a `login.nu` file is provided in the website documentation
For some reason, it had multiple syntax errors and other issues, like undefined options. Would be great to add a test for sourcing all example configs, but I don't know rust
See also #14249 (comment)
CC @NotTheDr01ds