-
Notifications
You must be signed in to change notification settings - Fork 17
/
alsactl.sh
42 lines (36 loc) · 1.05 KB
/
alsactl.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
_patch_help() {
if [[ $# -eq 1 ]]; then
$@ --help | \
sed \
-e '/^\s*-/ s/ #=# / k=v /' \
-e '/^\s*-/ s/ # / value /' \
-e '/^Available commands:/,/^\s*$/ {s/\s\+\(<\S\+>\)/ \1/;}' \
fi
}
_patch_table() {
table="$( \
_patch_table_detect_value_type \
)"
if [[ "$*" == "alsactl" ]]; then
echo "$table" | \
_patch_table_add_metadata 'inherit-flag-options'
elif [[ "$*" == "alsactl store" ]] \
|| [[ "$*" == "alsactl restore" ]] \
|| [[ "$*" == "alsactl nrestore" ]] \
|| [[ "$*" == "alsactl init" ]] \
|| [[ "$*" == "alsactl daemon" ]] \
|| [[ "$*" == "alsactl rdaemon" ]] \
|| [[ "$*" == "alsactl monitor" ]] \
|| [[ "$*" == "alsactl clean" ]] \
; then
echo "$table" | \
_patch_table_edit_arguments \
';;' \
'card;[`_choice_card`]' \
else
echo "$table"
fi
}
_choice_card() {
aplay -l | grep '^card [0-9]\+' | sed 's/card \([0-9]\+\): \(.\+\) \[.*\].*/\1\t\2/'
}