ivpn / desktop-app

Official IVPN Desktop app
https://www.ivpn.net/apps/
GNU General Public License v3.0
322 stars 49 forks source link

[Feature Request] Add a bash completion file #288

Closed jordan-ivpn closed 4 months ago

jordan-ivpn commented 1 year ago

Feature request

Description

Using the Tab key in a Terminal to auto-fill commands and sub-commands is convenient and a bash completion file offers this convenience for the Bash shell.

$ ivpn [Tab][Tab]
account      dns          login        status
antitracker  eaa          logout       wgkeys
autoconnect  exclude      logs         wifi
connect      firewall     servers      
disconnect   -h           splittun

$ ivpn c[Tab]

$ ivpn connect [Tab][Tab]
-antitracker       -exit_svr          -mtu
-antitracker_hard  -fastest           -o
-any               -filter_invert     -obfsproxy
-c                 -fw_off            -p
-cc                -h                 -port
-city              -ipv6tunnel        -protocol
-country           -l                 -show_ports
-country_code      -last              
-dns               -location

Describe the solution you'd like

First, generate a bash completion file: https://github.com/jordan-ivpn/bash-completion-generator-ivpn-cli/blob/main/bash-completion-generator-ivpn-cli.sh

$ bash-completion-generator-ivpn-cli.sh > ivpn.bash

Generator output is attached: ivpn-3.10.23.bash.txt

Next, add the generated file (named ivpn, plain text) to the DEB and RPM installers and have the file placed into:

/usr/share/bash-completion/completions/ivpn

Might have to source the file (source /usr/share/bash-completion/completions/ivpn) or perform a system-wide bash completion update for the new file to take effect.

I have checked this on Ubuntu, Arch, and OpenSuse systems. The bash completion path seems standardized.

Note: This becomes an ongoing task as part of the DEB and RPM packaging process either when the ivpn COMMANDS or SUB-COMMANDS change or every time a new package is created.

Thanks.

stenya commented 6 months ago

v3.13.5 Note: autocompletion is integrated only into DEB/RPM packages. The Snap and AUR installations do not have this functionality.

gorkapernas commented 6 months ago

Verified on v3.13.5, tested on Ubuntu 21.04 and Fedora 39, the bash completion file has been added to the DEB and RPM installers. Autocompletion works as described in the ticket.

stenya commented 4 months ago

v3.14.2 released