2009-02-04 21:23:49 +01:00
|
|
|
# -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
|
|
|
|
# ex: ts=8 sw=8 noet filetype=sh
|
|
|
|
#
|
2009-04-18 13:31:59 +03:00
|
|
|
# bash completion for smartctl(8)
|
2009-02-04 21:23:49 +01:00
|
|
|
|
|
|
|
have smartctl && {
|
|
|
|
_smartctl_quietmode()
|
|
|
|
{
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
COMPREPLY=( $( compgen -W 'errorsonly silent noserial' -- "$cur" ) )
|
2009-02-04 21:23:49 +01:00
|
|
|
}
|
|
|
|
_smartctl_device()
|
|
|
|
{
|
2009-04-18 13:21:53 +03:00
|
|
|
local i opts='ata scsi sat marvell hpt cciss'
|
|
|
|
for (( i=0; i <= 31; i++ )) ; do
|
|
|
|
opts="$opts 3ware,$i"
|
|
|
|
done
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
|
2009-02-04 21:23:49 +01:00
|
|
|
}
|
|
|
|
_smartctl_tolerance()
|
|
|
|
{
|
2009-04-18 13:11:25 +03:00
|
|
|
COMPREPLY=( $( compgen -W 'normal conservative permissive \
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
verypermissive' -- "$cur" ) )
|
2009-02-04 21:23:49 +01:00
|
|
|
}
|
|
|
|
_smartctl_badsum()
|
|
|
|
{
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
COMPREPLY=( $( compgen -W 'warn exit ignore' -- "$cur" ) )
|
2009-02-04 21:23:49 +01:00
|
|
|
}
|
|
|
|
_smartctl_report()
|
|
|
|
{
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- "$cur" ) )
|
2009-02-04 21:23:49 +01:00
|
|
|
}
|
2009-04-18 13:16:58 +03:00
|
|
|
_smartctl_powermode()
|
|
|
|
{
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
COMPREPLY=( $( compgen -W 'never sleep standby idle' -- "$cur" ) )
|
2009-04-18 13:16:58 +03:00
|
|
|
}
|
2009-02-04 21:23:49 +01:00
|
|
|
_smartctl_feature()
|
|
|
|
{
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
|
2009-02-04 21:23:49 +01:00
|
|
|
}
|
|
|
|
_smartctl_log()
|
|
|
|
{
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
COMPREPLY=( $( compgen -W 'error selftest selective directory' -- "$cur" ) )
|
2009-02-04 21:23:49 +01:00
|
|
|
}
|
|
|
|
_smartctl_vendorattribute()
|
|
|
|
{
|
|
|
|
COMPREPLY=( $( compgen -W 'help 9,minutes 9,seconds 9,halfminutes \
|
|
|
|
9,temp 192,emergencyretractcyclect 193,loadunload \
|
|
|
|
194,10xCelsius 194,unknown 198,offlinescanuncsectorct \
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
200,writeerrorcount 201,detectedtacount 220,temp' -- "$cur" ) )
|
2009-02-04 21:23:49 +01:00
|
|
|
}
|
|
|
|
_smartctl_firmwarebug()
|
|
|
|
{
|
2009-04-18 13:31:59 +03:00
|
|
|
COMPREPLY=( $( compgen -W 'none samsung samsung2 samsung3 swapid' \
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
-- "$cur" ) )
|
2009-02-04 21:23:49 +01:00
|
|
|
}
|
|
|
|
_smartctl_presets()
|
|
|
|
{
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
COMPREPLY=( $( compgen -W 'use ignore show showall' -- "$cur" ) )
|
2009-02-04 21:23:49 +01:00
|
|
|
}
|
|
|
|
_smartctl_test()
|
|
|
|
{
|
2009-04-18 13:34:07 +03:00
|
|
|
COMPREPLY=( $( compgen -W 'offline short long conveyance select \
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
afterselect,on afterselect,off pending scttempint' -- "$cur" ) )
|
2009-02-04 21:23:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_smartctl()
|
|
|
|
{
|
2009-04-18 13:15:07 +03:00
|
|
|
local cur prev split=false
|
2009-02-04 21:23:49 +01:00
|
|
|
|
|
|
|
COMPREPLY=()
|
2009-02-04 21:33:43 +01:00
|
|
|
cur=`_get_cword`
|
2009-02-04 21:23:49 +01:00
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
|
|
|
2009-04-18 13:15:07 +03:00
|
|
|
_split_longopt && split=true
|
|
|
|
|
2009-02-04 21:23:49 +01:00
|
|
|
case "$prev" in
|
2009-04-18 13:15:07 +03:00
|
|
|
-q|--quietmode)
|
2009-02-04 21:23:49 +01:00
|
|
|
_smartctl_quietmode
|
|
|
|
;;
|
2009-04-18 13:15:07 +03:00
|
|
|
-d|--device)
|
2009-02-04 21:23:49 +01:00
|
|
|
_smartctl_device
|
|
|
|
return 0
|
|
|
|
;;
|
2009-04-18 13:15:07 +03:00
|
|
|
-t|--tolerance)
|
2009-02-04 21:23:49 +01:00
|
|
|
_smartctl_tolerance
|
|
|
|
return 0
|
|
|
|
;;
|
2009-04-18 13:15:07 +03:00
|
|
|
-b|--badsum)
|
2009-02-04 21:23:49 +01:00
|
|
|
_smartctl_badsum
|
|
|
|
return 0
|
|
|
|
;;
|
2009-04-18 13:15:07 +03:00
|
|
|
-r|--report)
|
2009-02-04 21:23:49 +01:00
|
|
|
_smartctl_report
|
|
|
|
return 0
|
|
|
|
;;
|
2009-04-18 13:15:07 +03:00
|
|
|
-n|--nocheck)
|
|
|
|
_smartctl_powermode
|
2009-02-04 21:23:49 +01:00
|
|
|
return 0
|
|
|
|
;;
|
2009-04-18 13:15:07 +03:00
|
|
|
-s|--smart|-o|--offlineauto|-S|--saveauto)
|
2009-02-04 21:23:49 +01:00
|
|
|
_smartctl_feature
|
|
|
|
return 0
|
|
|
|
;;
|
2009-04-18 13:15:07 +03:00
|
|
|
-l|--log)
|
2009-02-04 21:23:49 +01:00
|
|
|
_smartctl_log
|
|
|
|
return 0
|
|
|
|
;;
|
2009-04-18 13:15:07 +03:00
|
|
|
-v|--vendorattribute)
|
2009-02-04 21:23:49 +01:00
|
|
|
_smartctl_vendorattribute
|
|
|
|
return 0
|
|
|
|
;;
|
2009-04-18 13:15:07 +03:00
|
|
|
-F|--firmwarebug)
|
2009-02-04 21:23:49 +01:00
|
|
|
_smartctl_firmwarebug
|
|
|
|
return 0
|
|
|
|
;;
|
2009-04-18 13:15:07 +03:00
|
|
|
-P|--presets)
|
2009-02-04 21:23:49 +01:00
|
|
|
_smartctl_presets
|
|
|
|
return 0
|
|
|
|
;;
|
2009-04-18 13:15:07 +03:00
|
|
|
-t|--test)
|
2009-02-04 21:23:49 +01:00
|
|
|
_smartctl_test
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2009-04-18 13:15:07 +03:00
|
|
|
$split && return 0
|
2009-02-04 21:23:49 +01:00
|
|
|
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-h --help --usage -V --version \
|
|
|
|
--copyright --license-i --info -a --all -q \
|
2009-04-18 13:15:07 +03:00
|
|
|
--quietmode -d --device -T --tolerance -b --badsum \
|
2009-04-18 13:16:58 +03:00
|
|
|
-r --report -n --nocheck -s --smart -o --offlineauto \
|
|
|
|
-S --saveauto -H --health -c --capabilities -A \
|
2009-04-18 13:15:07 +03:00
|
|
|
--attributes -l --log -v --vendorattribute -F \
|
|
|
|
--firmwarebug -P --presets -t --test -C \
|
Quote unquoted $cur to prevent globbing.
Closes Alioth #311614
Globbing might occur if $cur contains one of these globbing characters: * ? [ ]
The bug becomes apparent:
On Cygwin if the glob-string contains backslashes as well, causing a warning (Cygwin >= 1.7):
MS-DOS style path detected: ...
Preferred POSIX equivalent is: ...
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
On Linux, using strace, you can see bash-completion doing an unnecessary `open' system call.
Steps to reproduce on Linux using `strace':
Environment: Linux, bash-completion-1.0
1. Start bash with bash-completion loaded and find out PID ($$):
$ echo $$
MYPID
2. In a second bash shell, `strace' the above PID:
$ strace -e trace=open -f -o strace.log -p MYPID
3. Within the first bash shell, type:
$ cur="?"; _kernel_versions
4. In the second bash shell, type ^C to quick `strace'.
5. Check `strace.log', here you can see bash accessing
something it shouldn't:
...
open(".", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
...
6. The above call to `open' disappears if $cur in _kernel_versions gets
quoted, and you repeat the steps above:
_kernel_versions()
{
COMPREPLY=( $( compgen -W '$( command ls /lib/modules )' -- "$cur" ) )
}
2009-09-25 09:36:29 +02:00
|
|
|
--captive -X --abort' -- "$cur" ) )
|
2009-02-04 21:23:49 +01:00
|
|
|
else
|
|
|
|
cur=${cur:=/dev/}
|
|
|
|
_filedir
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
complete -F _smartctl smartctl
|
|
|
|
}
|