From 32fba27f78abb16a4f639f858f3026baf2416f7a Mon Sep 17 00:00:00 2001 From: Chris Dinneen Date: Mon, 6 Jan 2025 17:03:44 +0800 Subject: [PATCH] Update auto completion to suggest stoptions where relevant --- mt-st.bash_completion | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mt-st.bash_completion b/mt-st.bash_completion index e768656..12b5c6e 100644 --- a/mt-st.bash_completion +++ b/mt-st.bash_completion @@ -7,6 +7,7 @@ _mt () { #possible commands commands="weof wset eof fsf fsfm bsf bsfm fsr bsr fss bss rewind offline rewoffl eject retension eod seod seek tell status erase setblk lock unlock load compression setdensity drvbuffer stwrthreshold stoptions stsetoptions stclearoptions defblksize defdensity defdrvbuffer defcompression stsetcln sttimeout stlongtimeout densities setpartition mkpartition partseek asf stshowoptions" + stoptions="buffer-writes async-writes read-ahead debug two-fms fast-eod no-wait weof-no-wait auto-lock def-writes can-bsr no-blklimits can-partitions scsi2logical sili sysv" COMPREPLY=() @@ -22,8 +23,19 @@ _mt () { COMPREPLY=($(compgen -W "$devs" -- "$cur")) return ;; + stsetoptions) + # show list of stoptions + COMPREPLY=($(compgen -W "$stoptions" -- "$cur")) + return + ;; esac + # if "$prev" is a substring of "$stoptions" show more "$stoptions" + if [[ "$stoptions" == *"$prev"* ]]; then + COMPREPLY=($(compgen -W "$stoptions" -- "$cur")) + return + fi + if [[ $cur == -* ]]; then COMPREPLY=($(compgen -W '-f -v' -- "$cur")) return