Skip to content

Commit

Permalink
Update auto completion to suggest stoptions where relevant
Browse files Browse the repository at this point in the history
  • Loading branch information
dabiged authored and iustin committed Jan 7, 2025
1 parent aa6539b commit 32fba27
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mt-st.bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -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=()

Expand All @@ -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
Expand Down

0 comments on commit 32fba27

Please sign in to comment.