scop / bash-completion

Programmable completion functions for bash
GNU General Public License v2.0
2.88k stars 380 forks source link

[cryptsetup] luksErase is not completed #758

Open ghost opened 2 years ago

ghost commented 2 years ago

Describe the bug

When I press the tab key in cryptsetup luks, luksErase is not completed.

To reproduce

  1. Type cryptsetup luksE

Expected behavior

luksErase appears as a candidate for completion.

Versions (please complete the following information)

Additional context

Debug trace

akinomyoga commented 2 years ago

This is because just the list hardcoded in completions/cryptsetup is not up to date:

https://github.com/scop/bash-completion/blob/9cde158077ba70edecf2898696692a52d844d858/completions/cryptsetup#L43-L46

The upstream option parser is found here:

https://gitlab.com/cryptsetup/cryptsetup/-/blob/main/src/cryptsetup.c#L3155-3208 https://gitlab.com/cryptsetup/cryptsetup/-/blob/main/src/cryptsetup.c#L2831-2867 https://gitlab.com/cryptsetup/cryptsetup/-/blob/main/src/cryptsetup_args.h#L28-53

The differences are

--- a.txt^I2022-06-14 17:51:57.795545785 +0900
+++ b.txt^I2022-06-14 17:52:12.900602154 +0900
@@ -1,20 +1,41 @@
 benchmark
+bitlkClose
+bitlkDump
+bitlkOpen
 close
+config
+convert
+create
 erase
 isLuks
+loopaesClose
+loopaesOpen
 luksAddKey
 luksChangeKey
+luksClose
+luksConfig
+luksConvertKey
 luksDump
+luksErase
 luksFormat
 luksHeaderBackup
 luksHeaderRestore
 luksKillSlot
+luksOpen
 luksRemoveKey
 luksResume
 luksSuspend
 luksUUID
 open
+plainClose
+plainOpen
+reencrypt
+refresh
+remove
 repair
 resize
 status
+tcryptClose
 tcryptDump
+tcryptOpen
+token