Identity filename completion for ssh-add would be nice

Bug #376546 reported by Juhamatti Niemelä
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)
Confirmed
Wishlist
Unassigned

Bug Description

Binary package hint: bash-completion

Bash could complete filename parameter for ssh-add by using file listing from ~/.ssh/* excluding .pub and ssh config files.

Attached file contains function to implement this feature, if it's copied to /etc/bash_completion.d.

Tags: patch
Revision history for this message
Juhamatti Niemelä (iiska) wrote :
summary: - Identity filename completion for ssh-add would be nice
+ [wishlist] Identity filename completion for ssh-add would be nice
tags: added: wishlist
Revision history for this message
Clint Byrum (clint-fewbar) wrote : Re: [wishlist] Identity filename completion for ssh-add would be nice

Hello Juhamatti, thanks for submitting this feature request back in 2009.

I've marked it as confirmed.

Feedback on the patch:

1) you do not need to do --color=none when piping to a nother command. ls knows when its output is not a TTY to not to use any terminal control.

2) instead of trying to guess the names to filter out, you can make use of the file command...

$ file .ssh/*
.ssh/config: ASCII text
.ssh/id_rsa: PEM RSA private key
.ssh/id_rsa.pub: OpenSSH RSA public key
.ssh/known_hosts: ASCII text, with very long lines
.ssh/known_hosts.old: ASCII text, with very long lines

3) the cmdline switches would be good too

4) ssh-add takes arbitrary file arguments, so make sure to detect when a path is already there, and utilize that instead of substituting ~/.ssh

Changed in bash-completion (Ubuntu):
status: New → Confirmed
importance: Undecided → Wishlist
tags: added: patch
removed: wishlist
summary: - [wishlist] Identity filename completion for ssh-add would be nice
+ Identity filename completion for ssh-add would be nice
Revision history for this message
Daniel Black (daniel-black) wrote :

meets the criteria above. I've used grep rather than filemagic for efficiency.

Revision history for this message
Daniel Black (daniel-black) wrote :
Revision history for this message
Peter Cordes (peter-cordes) wrote :

upstream still has a naive _parse_help based handler for ssh-add :/

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.