author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Mon, 03 Jul 2017 22:51:43 +0300 | |
changeset 864 | d96d5b0e8d4f |
parent 734 | da0dc50393b6 |
permissions | -rw-r--r-- |
646
b3ada0aa23ed
Bash completion for Firefox.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
1 |
# -*- mode: sh; sh-shell-file: bash -*- |
b3ada0aa23ed
Bash completion for Firefox.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
2 |
|
b3ada0aa23ed
Bash completion for Firefox.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
3 |
_firefox() |
b3ada0aa23ed
Bash completion for Firefox.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
4 |
{ |
734 | 5 |
local _opts="--sync --g-fatal-warnings -h -help -migration -ProfileManager \ |
646
b3ada0aa23ed
Bash completion for Firefox.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
6 |
-no-remote -new-instance -safe-mode -jsconsole -browser -new-window -new-tab -preferences -search \ |
b3ada0aa23ed
Bash completion for Firefox.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
7 |
-recording -recording-output -setDefaultBrowser" |
734 | 8 |
local cur prev |
9 |
cur=${COMP_WORDS[COMP_CWORD]} |
|
10 |
[[ $COMP_CWORD != 0 ]] && prev=${COMP_WORDS[COMP_CWORD-1]} |
|
11 |
case "$prev" in |
|
12 |
-P) |
|
13 |
local profile=~/.mozilla/firefox/profiles.ini |
|
14 |
if [[ ! -f $profile ]]; then |
|
15 |
return; |
|
16 |
fi |
|
17 |
local names=( $(sed -n '/^Name=/{s/^Name=//;p;}' $profile) ) |
|
18 |
COMPREPLY=( $(compgen -W '${names[@]}' -- "$cur") ) |
|
19 |
return ;; |
|
20 |
esac |
|
21 |
COMPREPLY=( $(compgen -W '$_opts' -- $cur) ) |
|
22 |
return 0 |
|
646
b3ada0aa23ed
Bash completion for Firefox.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
23 |
} && |
734 | 24 |
complete -F _firefox firefox iceweasel |