fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Fabian HomborgReformat2e55e3454

master
10.8 KiB95 linesraw
1# bluetoothctl enables to manage bluetooth devices and controllers.
2
3set -l cmds list show select devices paired-devices system-alias reset-alias power pairable discoverable discoverable-timeout agent default-agent advertise set-alias scan info pair cancel-pairing trust untrust block unblock remove connect disconnect scan.uuids scan.service scan.manufacturer scan.data scan.discoverable scan.discoverable-timeout scan.tx-power scan.name scan.appearance scan.duration scan.timeout scan.secondary scan.clear gatt.list-attributes gatt.select-attribute gatt.attribute-info gatt.read gatt.write gatt.acquire-write gatt.release-write gatt.acquire-notify gatt.release-notify gatt.notify gatt.clone gatt.register-application gatt.unregister-application gatt.register-service gatt.unregister-service gatt.register-includes gatt.unregister-includes gatt.register-characteristic gatt.unregister-characteristic gatt.register-descriptor gatt.unregister-descriptor advertise.uuids advertise.service advertise.manufacturer advertise.data advertise.discoverable advertise.discoverable-timeout advertise.tx-power advertise.name advertise.appearance advertise.duration advertise.timeout advertise.secondary advertise.clear
4
5function __fish_list_bluetoothctl_devices
6    # Output of `bluetoothctl devices`:
7    # Device 01:23:34:56:89:AB Name1
8    # Device 01:23:34:56:89:AC Name2
9    bluetoothctl devices 2>/dev/null | string replace -r "^Device " "" | string replace " " \t
10end
11
12function __fish_list_bluetoothctl_controllers
13    # Output of `bluetoothctl list`:
14    # Controller 01:23:34:56:89:AB Name1 [default]
15    # Controller 01:23:34:56:89:AC Name2
16    bluetoothctl list 2>/dev/null | string replace -r "^Controller " "" | string replace " " \t
17end
18
19complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a list -d "List available controllers"
20complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a show -d "Controller information"
21complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a select -d "Select default controller"
22complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a devices -d "List available devices"
23complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a paired-devices -d "List paired devices"
24complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a system-alias -d "Set controller alias"
25complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a reset-alias -d "Reset controller alias"
26complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a power -d "Set controller power"
27complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a pairable -d "Set controller pairable mode"
28complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a discoverable -d "Set controller discoverable mode"
29complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a discoverable-timeout -d "Set discoverable timeout"
30complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a agent -d "Enable/disable agent with given capability"
31complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a default-agent -d "Set agent as the default one"
32complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a advertise -d "Enable/disable advertising with given type"
33complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a set-alias -d "Set device alias"
34complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a scan -d "Scan for devices"
35complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a info -d "Device information"
36complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a pair -d "Pair with device"
37complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a cancel-pairing -d "Cancel pairing with device"
38complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a trust -d "Trust device"
39complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a untrust -d "Untrust device"
40complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a block -d "Block device"
41complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a unblock -d "Unblock device"
42complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a remove -d "Remove device"
43complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a connect -d "Connect device"
44complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a disconnect -d "Disconnect device"
45complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a scan.uuids -d "Set/Get advertise uuids"
46complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a scan.service -d "Set/Get advertise service data"
47complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a scan.manufacturer -d "Set/Get advertise manufacturer data"
48complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a scan.data -d "Set/Get advertise data"
49complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a scan.discoverable -d "Set/Get advertise discoverable"
50complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a scan.discoverable-timeout -d "Set/Get advertise discoverable timeout"
51complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a scan.tx-power -d "Show/Enable/Disable TX power to be advertised"
52complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a scan.name -d "Configure local name to be advertised"
53complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a scan.appearance -d "Configure custom appearance to be advertised"
54complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a scan.duration -d "Set/Get advertise duration"
55complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a scan.timeout -d "Set/Get advertise timeout"
56complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a scan.secondary -d "Set/Get advertise secondary channel"
57complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a scan.clear -d "Clear advertise config"
58complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.list-attributes -d "List attributes"
59complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.select-attribute -d "Select attribute"
60complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.attribute-info -d "Select attribute"
61complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.read -d "Read attribute value"
62complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.write -d "Write attribute value"
63complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.acquire-write -d "Acquire Write file descriptor"
64complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.release-write -d "Release Write file descriptor"
65complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.acquire-notify -d "Acquire Notify file descriptor"
66complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.release-notify -d "Release Notify file descriptor"
67complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.notify -d "Notify attribute value"
68complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.clone -d "Clone a device or attribute"
69complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.register-application -d "Register profile to connect"
70complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.unregister-application -d "Unregister profile"
71complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.register-service -d "Register application service"
72complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.unregister-service -d "Unregister application service"
73complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.register-includes -d "Register as Included service in"
74complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.unregister-includes -d "Unregister Included service"
75complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.register-characteristic -d "Register application characteristic"
76complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.unregister-characteristic -d "Unregister application characteristic"
77complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.register-descriptor -d "Register application descriptor"
78complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a gatt.unregister-descriptor -d "Unregister application descriptor"
79complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a advertise.uuids -d "Set/Get advertise uuids"
80complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a advertise.service -d "Set/Get advertise service data"
81complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a advertise.manufacturer -d "Set/Get advertise manufacturer data"
82complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a advertise.data -d "Set/Get advertise data"
83complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a advertise.discoverable -d "Set/Get advertise discoverable"
84complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a advertise.discoverable-timeout -d "Set/Get advertise discoverable timeout"
85complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a advertise.tx-power -d "Show/Enable/Disable TX power to be advertised"
86complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a advertise.name -d "Configure local name to be advertised"
87complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a advertise.appearance -d "Configure custom appearance to be advertised"
88complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a advertise.duration -d "Set/Get advertise duration"
89complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a advertise.timeout -d "Set/Get advertise timeout"
90complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a advertise.secondary -d "Set/Get advertise secondary channel"
91complete -f -c bluetoothctl -n "not __fish_seen_subcommand_from $cmds" -a advertise.clear -d "Clear advertise config"
92
93complete -f -c bluetoothctl -n "__fish_seen_subcommand_from pair trust untrust block unblock connect disconnect" -a "(__fish_list_bluetoothctl_devices)"
94complete -f -c bluetoothctl -n "__fish_seen_subcommand_from show select" -a "(__fish_list_bluetoothctl_controllers)"
95complete -f -c bluetoothctl -n "__fish_seen_subcommand_from power pairable discoverable agent advertize" -a "on off"