`umount` tab completion doesn't handle relative directories or `~` arguments

Abierto
#12,513 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
Medio día
Aptitud para principiantes
52/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
fish, shell
Área
cli

Línea de trabajo

Empieza por share/completions/umount.fish y share/functions/__fish_print_mounted.fish; después, inspecciona cómo se pasa o interpreta el token de completion actual. Usa la salida de mount proporcionada y los pasos de reproducción en macOS para comprobar las rutas relativas y las rutas con ~. Se considera terminado cuando umount ofrece completions para ambas formas, manteniendo la completion de rutas absolutas.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Version information:

  • fish version 4.5.0
  • macos 15.7.4, Terminal.app
  • reproducible without third-party customizations ✅

When attempting to unmount a directory using umount, tab completion doesn't find relative paths such as ./mymount or paths starting with ~ such as ~/tmp/mymount.

The issue appears to be that umount completes absolute paths only, and does not have home directory ~ handling. share/completions/umount.fish calls __fish_print_mounted.fish:

complete -c umount -d "Mount point" -x -a '(__fish_print_mounted)'

which doesn't have any handling for the current completion token (which would be a clue that the user is looking for a relative path).

My use cases are being in the same directory as a mount point and wanting to umount it (relative path) or giving the path to the mount as ~/path/to/mount (absolute path using ~).


If you're looking for a way to reproduce this on macOS, you can create your own mount using https://github.com/marcelcotta/DarwinFUSE:

$ git clone https://github.com/marcelcotta/DarwinFUSE
$ cd DarwinFUSE
DarwinFUSE $ make examples
DarwinFUSE $ mkdir -p ~/tmp/mymount
DarwinFUSE $ ./examples/hello ~/tmp/mymount/
DarwinFUSE $ umount ~/tmp<TAB> # <- will flash indicating no completions

But it's a bit unnecessary since the completion is just string processing the mount output if you don't have an /etc/mtab (as is my case):

function __fish_print_mounted --description 'Print mounted devices'
    if test -r /etc/mtab
        ...
    else
        mount | string replace -r '^(\S+) \S+ (\S+) .*' '$1\n$2' | string replace -r '[\d.]*:/' / | string match '/*'
    end
end

Here's what the output of mount looks like for me, to make it easier to test an implementation without having to mount a file yourself:

$ mount
/dev/disk3s1s1 on / (apfs, sealed, local, read-only, journaled)
devfs on /dev (devfs, local, nobrowse)
/dev/disk3s6 on /System/Volumes/VM (apfs, local, noexec, journaled, noatime, nobrowse)
/dev/disk3s2 on /System/Volumes/Preboot (apfs, local, journaled, nobrowse)
/dev/disk3s4 on /System/Volumes/Update (apfs, local, journaled, nobrowse)
/dev/disk1s2 on /System/Volumes/xarts (apfs, local, noexec, journaled, noatime, nobrowse)
/dev/disk1s1 on /System/Volumes/iSCPreboot (apfs, local, journaled, nobrowse)
/dev/disk1s3 on /System/Volumes/Hardware (apfs, local, journaled, nobrowse)
/dev/disk3s5 on /System/Volumes/Data (apfs, local, journaled, nobrowse, protect, root data)
map auto_home on /System/Volumes/Data/home (autofs, automounted, nobrowse)
127.0.0.1:/ on /Users/razzi/tmp/mymount (nfs, nodev, nosuid, mounted by razzi)
Lenguaje dominante
Rust
Estrellas
34.4k
Forks
2.5k
Merge medio
1 d 15 h
PR fusionados (30 d)
7

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de fish-shell/fish-shell

Todos los issues de fish-shell/fish-shell

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.