dotnet / dotnet/command-line-api

Completions don't work for symlinked executables

Ouverte
#2,201 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Area-Completions bug
Langage dominant
C#
Étoiles
3.7k
Forks
428
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

It's pretty common to "install" executables on Linux by symlinking them into `$XDG_BIN_DIR`, e.g. `ln --symbolic "$XDG_DATA_HOME/go/bin/go" "$XDG_BIN_DIR/go"`

I tried something similar with a dotnet CLI I created using System.CommandLine, but I couldn't get completions to work. I tracked it down to [this line](https://github.com/dotnet/command-line-api/blob/7058640c8f0c472c399bc063e14410a04cbe5ffd/src/System.CommandLine.Suggest/dotnet-suggest-shim.zsh#LL12C11-L12C11)

```
# Get full path to script because dotnet-suggest needs it
# NOTE: this requires a command registered with dotnet-suggest be
# on the PATH
full_path=`which ${words[1]}` # zsh arrays are 1-indexed
```

Switching this to `full_path=$(realpath $(which ${words[1]}))` fixed the issue.

Would be nice for the official shims (or dotnet-suggest itself if the fix is more appropriate there) to support symlinked executables.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez dans src/System.CommandLine.Suggest/dotnet-suggest-shim.zsh, au niveau de l’affectation liée de full_path, et comparez la manière dont il résout un exécutable appelé directement avec un exécutable lié par un lien symbolique. Reproduisez la complétion pour une commande installée via un lien symbolique, puis vérifiez que le shim officiel ou dotnet-suggest gère correctement le chemin de l’exécutable résolu.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp, zsh
Domaine
cli
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.