Password file completion for `pass` no longer worked as the pattern was
passed to `ls` as a string.
Fixed it by converting the pattern to a glob.
Co-authored-by: TechnoTecna <techno.tecna@protonmail.com>
`find` highlights the returned value,
which breaks the `gcm` macro,
it returns
```
error: pathspec '?[37m?[0m?[41;37mmain?[0m?[37m?[0m' did not match any file(s) known to git
```
I opted in to using `ansi strip` instead of `--no-highlight`, because I
think it covers wider range of nu shell versions
I use Nushell and npm, and noticed that the npm section hasn't been
updated for a long time, to the point where it no longer works with
current npm versions. In fact, the current script produces the following
result:

So I've updated the npm-related scripts to fix this issue. Now it works
correctly:

Additionally, since npm -l | lines generates over 900 lines of output,
this causes each run to take a long time (at least on my machine).
Therefore, I've implemented caching using stor to store the results,
which significantly reduces the execution time for subsequent calls.
With caching enabled, the delay is now barely noticeable.
Before it would fail in paths outside the home directory with
```
× Pipeline empty.
╭─[/home/filipp/.config/nushell/panache-git.nu:32:76]
31 │ let current_dir_relative_to_home = (
32 │ do --ignore-errors { $current_dir | path relative-to $nu.home-path } | str join
· ────┬───
· ╰── no input value was piped in
33 │ )
╰────
```
This small fix prepends the `INCLUDE` environment variable instead of
overriding it.
This is important if one has already added paths to this environment,
for example, in cases where one needs a common set of codebase that gets
included in all C/C++ projects (such as utility functions and such).
nu_msvs doesn't work at all on my setup, vswhere return empty string
when called from nushell, the only way i made it to work is calling it
from powershell
on json parsing side
installationPath is not an array, and vswhere return an array of
installations is not correct
e.g
```json
[
{
"instanceId": "406fd398",
"installDate": "2024-04-25T13:16:29Z",
"installationName": "VisualStudioPreview/17.14.0-pre.5.0+36025.13",
"installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\Preview",
"installationVersion": "17.14.36025.13",
"productId": "Microsoft.VisualStudio.Product.BuildTools",
"productPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\Preview\\Common7\\Tools\\LaunchDevCmd.bat",
"state": 4294967295,
"isComplete": true,
"isLaunchable": true,
"isPrerelease": true,
"isRebootRequired": false,
"displayName": "Visual Studio Build Tools 2022",
"description": "Visual Studio Build Tools vous permet de générer des applications MSBuild natives et managées sans passer par l'IDE Visual Studio. Il existe des options pour installer les compilateurs et bibliothèques Visual C++, ainsi que la prise en charge d'ATL, de MFC et de C++/CLI.",
"channelId": "VisualStudio.17.Preview",
"channelUri": "https://aka.ms/vs/17/pre/channel",
"enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
"installedChannelId": "VisualStudio.17.Preview",
"installedChannelUri": "https://aka.ms/vs/17/pre/channel",
"releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=661273#17.14.0-pre.5.0",
"resolvedInstallationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\Preview",
"thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=661288",
"updateDate": "2025-04-29T20:49:54.8401699Z",
"catalog": {
"buildBranch": "d17.14",
"buildVersion": "17.14.36025.13",
"id": "VisualStudioPreview/17.14.0-pre.5.0+36025.13",
"localBuild": "build-lab",
"manifestName": "VisualStudioPreview",
"manifestType": "installer",
"productDisplayVersion": "17.14.0 Preview 5.0",
"productLine": "Dev17",
"productLineVersion": "2022",
"productMilestone": "Preview",
"productMilestoneIsPreRelease": "True",
"productName": "Visual Studio",
"productPatchVersion": "0",
"productPreReleaseMilestoneSuffix": "5.0",
"productSemanticVersion": "17.14.0-pre.5.0+36025.13",
"requiredEngineVersion": "3.14.2074.57458"
},
"properties": {
"campaignId": "",
"channelManifestId": "VisualStudio.17.Preview/17.14.0-pre.5.0+36025.13",
"includeRecommended": "0",
"nickname": "",
"setupEngineFilePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\setup.exe"
}
}
]
```
When starting a new shell session inside a rust folder you'd get this
error:

This pr fixes this issue.
Entering a folder without having a previous folder happen when you for
example start a new terminal or starts a multiplexer already inside that
folder.
[lftp](https://lftp.yar.ru/) is the program which I use when I need to
copy many files at once via SSH. Though having `FTP` in the name, it
supports more protocols than just FTP.
This PR provides auto-completion for the "site" argument. Source of
sites are:
- SSH aliases (for SFTP and FISH protocols).
- LFTP's bookmarks.

Inspired by @kiil, this PR adds another game for exploration &
inspiration - this time, based on the seminal incremental idle game
[Universal
Paperclips](https://www.decisionproblem.com/paperclips/index2.html).
This game implements a screen drawing loop with a roughly 60FPS
framerate, asynchronous user interaction via the new `job send` and `job
recv` commands, rudimentary deltatime calculations, and the ability to
save and load state memory.
The game does not feature any of the special mechanics that emerge from
the original, though a future project may emerge to make a more 1:1
replica of the original.
I have also updated the .gitignore to make sure no one accidentally
pushes their game save to the repo after trying it out. 😃
Sometimes you know you starred something long time ago, the you go to
github.com your stars and search on the bar.
That's all good but wouldn't it be great to do that from the comfort of
nushell?
This pr does that.
You can test it with
```nu
gh my stars | explore
```
Sometimes I have to use windows,
I would like to have a place were I can find useful nushell stuff making
my easier and maybe eventually copy stuff other people might contribute.
Would you see this fit?
**NOTE**: I will gladly remove editorconfig if you prefer a separate pr
or you don't want it at all.
This PR updates the `modules/virtual_environments/nu_conda_2/conda.nu`
script to address several issues encountered with newer versions of
Mamba/Conda and Nushell.
**Problem:**
The existing script failed when used with recent Mamba versions (e.g.,
Mamba 2.x) due to changes in the JSON output format of `mamba info
--json`. Specifically:
* The key for environment directories is now `"envs directories"`
instead of `"envs_dirs"`.
* The key for the base environment path is now `"base environment"`
instead of `"root_prefix"`.
* The `mamba info --envs --json` command returns minimal information,
requiring separate calls to `mamba info --json` to get necessary details
like `envs_dirs` and `root_prefix`.
Additionally, several Nushell syntax errors were present:
* Incorrect syntax for assigning the result of a multi-branch `if/else`
expression to a variable using `let`.
* Incorrect usage of `run-external`, attempting to pass flags like
`--json` directly instead of as separate string arguments.
* The `--no-banner` flag is not supported by `mamba info`.
These issues resulted in errors like `Cannot find column 'envs_dirs'`,
`Could not find environment named '...'`, `keyword_missing_arg`, and
`unknown_flag`.
**Solution:**
This PR implements the following fixes:
1. **Updated `load-conda-info-env`:**
* Detects Mamba/Conda/Micromamba correctly.
* For Mamba, makes separate calls to `mamba info --json` and `mamba info
--envs --json`.
* Explicitly extracts `envs_dirs` and `root_prefix` using the correct
key names (`"envs directories"`, `"base environment"`) observed in Mamba
2.x output.
* For Conda, assumes `conda info --json` provides all necessary keys
(`envs_dirs`, `root_prefix`, `envs`).
* Includes basic logic for Micromamba (parsing text output).
* Constructs the `$env.CONDA_INFO` record reliably with the required
keys.
2. **Corrected Nushell Syntax:**
* Fixed the `let cmd_base = ...` assignment by wrapping the `if/else`
expression in parentheses `()`.
* Fixed all `run-external` calls to pass the command and arguments as
separate strings (e.g., `run-external "mamba" "info" "--json"`).
3. **Removed Unsupported Flag:** Removed `--no-banner` from `mamba info`
calls.
4. **Improved Error Handling:** Added checks in `activate` to ensure
`$env.CONDA_INFO` was loaded successfully. Changed `error make` to
`print --stderr` and `return null` in `check-if-env-exists` for
potentially smoother failure modes.
5. **Minor Improvements:** Cleaned up PATH manipulation, improved the
completer function, added comments.
**Testing:**
This version has been tested successfully with:
* Mamba 2.1.0
* Nushell 0.103.0
* Activating environments by name (`activate myenv`) and by full path
(`activate /path/to/myenv`).
* Deactivating environments (`deactivate`).
It should also work correctly with standard Conda installations.
Micromamba support is based on the original script's logic and may
require further testing.
Fixes issues like those encountered during the debugging session leading
to this PR.
Run `build-completions-from-pwd` from fish-shell completions
Through needs-update/custom-completions/auto-generate/parse-fish.nu with
https://github.com/fish-shell/fish-shell
share/completions/
9d904e111345a64eb4ff05ecd8d7737f22cfc762
Selective on which files to take over for reviewability and certain
improvements
Run `build-completions-from-pwd` from fish-shell completions
Through needs-update/custom-completions/auto-generate/parse-fish.nu with
https://github.com/fish-shell/fish-shell
share/completions/
9d904e111345a64eb4ff05ecd8d7737f22cfc762
Selective on which files to take over for reviewability and certain
improvements
Resolves#414
* Syntax source
https://github.com/command-line-interface-pages/v2-tooling/tree/main/md-to-clip
---
I used the descriptions from the Fish completions on the referenced
page/docs.
```nushell
nu ❯ help md-to-clip
Converter from TlDr format to Command Line Interface Pages format.
https://github.com/command-line-interface-pages/v2-tooling/tree/main/md-to-clip
Usage:
> md-to-clip {flags} <file> ...(args)
Flags:
-h, --help: Display help
-v, --version: Display version
-a, --author: Display author
-e, --email: Display author email
--no-file-save: Whether to display conversion result in stdout instead of writing it to a file
--output-directory <path>: Directory where conversion result will be written
--special-placeholder-config <path>: Config with special placeholders
Parameters:
file <path>: Source tldr page to convert
...args <external-argument>: all other arguments to the command
```
Resolves#1078
Previous behavior: Navigating into a folder with a `Cargo.yml` prepends
the target folders to `PATH`. They never get removed. Navigating into
different cargo folders one after the other leads to repeated PATH
extensions.
New behavior: Navigating into a folder with a `Cargo.yml` prepends the
target folders to `PATH`. Leaving a folder with a `Cargo.yml` drops the
target folders from `PATH`.
There is no guarantee that they were added by the script when entering.
The PATH could have had the target entries before entering. However,
when using this hook, it seems reasonable to assume that this prepend
and drop behavior is desired. It also seems reasonable to assume that
build target folders would not be used for normal util operations.
Update `winget show` completions according to official docs at
https://learn.microsoft.com/en-us/windows/package-manager/winget/show
Sort flags like official documentation.
Remove multiple flags which seemingly come from `winget install`;
presumably a copy-paste error when originally implementing this command.
Adjust so it does not throw syntax errors and works for at least some
sampled `.fish` files.
Related #968, #258, #256
---
Sample `abook`:
```nushell
nu ❯ rm abook.nu -f; build-completion abook.fish abook.nu; open abook.nu
# Show usage
extern "abook" [
--add-email # Read email message from stdin and add the sender
--add-email-quiet # Same as --add-email. Without confirmation
--convert # Convert address book files
--informat # Input file format
--outformat # Output file format
--formats # Print available formats
...args
]
```
* Fix typo
* Add code fences
* Use `nushell` instead of `nu` code block language, so it renders
correctly on GitHub
* Use correct headline levels (only one instead of three top headlines)
* Add paragraph spacing where applicable
* Add trailing newline
PR #1076 titled 'Move custom-completion auto-generate scripts to
needs-update' added the README and target files,
but was missing the removal of the source files (moved files).
The files in `needs-update/custom-completions/auto-generate/` are
identical.
by dropping output parsing of non-stable unstructured output into
structured output.
---
winget-completions.nu defines more than custom completions: it defines
parsing for `winget show`, `winget source list`, `winget search`,
`winget list`.
`winget show` shows different user messages and rendered manifest
information.
#825 reports winget show breakage for `winget show` for packages
`carapace`, `Peppy.Osu!`, `flux.flux`.
The source yaml (for example
[rsteube.Carapace.locale.en-US.yaml][sourceyaml]) is in YAML format. The
command implementation tries to parse the rendered output and transform
it into yaml, but fails to do so. The logic is quite complicated and
error prone, with no guarantees on `winget show` output stability in
text or format.
Rather than trying to this the script, it seems safer to drop parsing
the output into a structure format. #825 indicates winget show has been
broken for a year.
If we want to support structured output from `winget show`, it would be
preferable to depend on `winget show` offering a structured output
option (which it currently does not offer), or at least not offer
error-prone parsing as a default part of *custom completions*. Users can
still parse the output themselves. Independent of this removal, users
may suggest alternative less error-prone or custom-completion-breaking
approaches.
[sourceyaml]:
2ec31577c4/manifests/r/rsteube/Carapace/1.3.0/rsteube.Carapace.locale.en-US.yamlResolves#825
BREAKING: Drops structured output from `winget show`
Tested with https://docs.aws.amazon.com/cli/latest/reference/s3/ls.html
example output
Note that the script has a placeholder parameter
`s3://your-bucket-and-path`. The script is moved into the `sourced`
folder like all the other ported scripts from the cool_oneliners folder
before it, but sourcing it as-is is not meaningful.
This ports the last file in `before_v0.60`, consequently resolving #221.
This comment was a WIP draft note.
The separate `git show` command call is not necessary because
`get-all-git-local-refs` through `for-each-ref` already includes the
commit title. So the comment can be dropped without further
consideration / is already resolved.
* Fix previous logic assuming single remote name `origin`
* Fix wrong Local vs Remote branch name descriptions
* Fix git branch output with multiple branches per line breaking
auto-completions
* Fix current branch not showing up in git checkout branch completions
* Fix remote branches not showing up when local branch with upstream
exists despite them being different refs
* Show more contextual information in completion descriptions
* Use consistent sorting between command completions; Local branches
before remote branches before files before commits, with sorting from
git kept intact
Change implementation to a more encapsulated and type-specific approach:
* Use for-each-ref instead of git branch with manual current branch
query and current and HEAD ref removal
* Separate local and remote branch logic for good case separation
* Use separate for-each-ref calls for early case separation
* Decorate local and remote branch information in their respective cases
instead of content-conditional
* Decorate with 'Branch, Local|Remote, Commit Sha1 Subject, upstream
[head|behind x]
* Use new consistent description format '{Type}' | '{Type}, Commit
{Sha1} Subject | '{Type}, {Subtype}, {Commit Sha1+Subject}, {upstream
name + track}
* Dissolves some spread out logic, dropping commands
get-all-git-branches and extract-remote-branches-nonlocal-short and
extract-mergable-sources
Influenced completions: `git checkout`, `git switch`, `git merge`
---
Screenshot:

Should resolve#1041
Screenshot from before, showing a wrong classification of a local branch
as remote branch:

Thanks to @Euphrasiologist for the prompt!
I found some bugs, and here are a few improvements.
1. Fix checking if currently in git repo (#1079)
2. Use `git branch --show-current` instead of `git rev-parse
--abbrev-ref HEAD` to get current branch
3. Refactor processing current status (relying on
https://git-scm.com/docs/git-status). Before, in some cases it leads to
unexpected behavior. (for example, when renaming or deleting files)
While using direnv with nushell, I noticed that my autocompletion for
external programs stopped working as soon as I entered a directory and
direnv loaded.
Turns out, direnv exports $PATH as a string, and nushell stores $PATH as
a table and expects it to be one. Worse, nu just silently fails any
operations with the $PATH (except for running programs) instead of
reporting an error.
This PR fixes that by adding a line in the direnv config.nu script that
parses that string into the appropriate table.
Testing it on my system (NixOS, nushell, direnv + lorri) it seems to
work perfectly fine and the $PATH works again.
First attempt at a full custom completion! Got all the base commands set
and documented. Most arguments are fleshed out, but I haven't figured
out a good solution for subcommands that have exclusive arguments, or
how to progressively show subcommands with their own set of externs.
I've put the completed-but-not-implemented work in a separate file, to
be incorporated later as I figure out the process to do so.
---------
Co-authored-by: Joshua Nussbaum <67082011+joshuanussbaum@users.noreply.github.com>