|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Bash completion for framework_tool |
| 4 | + |
| 5 | +_framework_tool() { |
| 6 | + local options |
| 7 | + options=( |
| 8 | + "-v" "--verbose" |
| 9 | + "-q" "--quiet" |
| 10 | + "--versions" |
| 11 | + "--version" |
| 12 | + "--features" |
| 13 | + "--esrt" |
| 14 | + "--device" |
| 15 | + "--compare-version" |
| 16 | + "--power" |
| 17 | + "--thermal" |
| 18 | + "--sensors" |
| 19 | + "--pdports" |
| 20 | + "--info" |
| 21 | + "--pd-info" |
| 22 | + "--dp-hdmi-info" |
| 23 | + "--dp-hdmi-update" |
| 24 | + "--audio-card-info" |
| 25 | + "--privacy" |
| 26 | + "--pd-bin" |
| 27 | + "--ec-bin" |
| 28 | + "--capsule" |
| 29 | + "--dump" |
| 30 | + "--ho2-capsule" |
| 31 | + "--dump-ec-flash" |
| 32 | + "--flash-ec" |
| 33 | + "--flash-ro-ec" |
| 34 | + "--flash-rw-ec" |
| 35 | + "--intrusion" |
| 36 | + "--inputmodules" |
| 37 | + "--input-deck-mode" |
| 38 | + "--charge-limit" |
| 39 | + "--get-gpio" |
| 40 | + "--fp-brightness" |
| 41 | + "--kblight" |
| 42 | + "--console" |
| 43 | + "--reboot-ec" |
| 44 | + "--hash" |
| 45 | + "--driver" |
| 46 | + "--pd-addrs" |
| 47 | + "--pd-ports" |
| 48 | + "--has-mec" |
| 49 | + "-t" "--test" |
| 50 | + "-h" "--help" |
| 51 | + ) |
| 52 | + |
| 53 | + local devices=("bios" "ec" "pd0" "pd1" "rtm01" "rtm23" "ac-left" "ac-right") |
| 54 | + local input_deck_modes=("auto" "off" "on") |
| 55 | + local console_modes=("recent" "follow") |
| 56 | + local drivers=("portio" "cros-ec" "windows") |
| 57 | + local has_mec_options=("true" "false") |
| 58 | + local brightness_options=("high" "medium" "low") |
| 59 | + |
| 60 | + local current_word prev_word |
| 61 | + current_word="${COMP_WORDS[COMP_CWORD]}" |
| 62 | + prev_word="${COMP_WORDS[COMP_CWORD-1]}" |
| 63 | + |
| 64 | + # Handle options |
| 65 | + if [[ $COMP_CWORD -eq 1 ]]; then |
| 66 | + COMPREPLY=( $(compgen -W "${options[*]}" -- "$current_word") ) |
| 67 | + elif [[ $prev_word == "--device" ]]; then |
| 68 | + COMPREPLY=( $(compgen -W "${devices[*]}" -- "$current_word") ) |
| 69 | + elif [[ $prev_word == "--input-deck-mode" ]]; then |
| 70 | + COMPREPLY=( $(compgen -W "${input_deck_modes[*]}" -- "$current_word") ) |
| 71 | + elif [[ $prev_word == "--console" ]]; then |
| 72 | + COMPREPLY=( $(compgen -W "${console_modes[*]}" -- "$current_word") ) |
| 73 | + elif [[ $prev_word == "--driver" ]]; then |
| 74 | + COMPREPLY=( $(compgen -W "${drivers[*]}" -- "$current_word") ) |
| 75 | + elif [[ $prev_word == "--has-mec" ]]; then |
| 76 | + COMPREPLY=( $(compgen -W "${has_mec_options[*]}" -- "$current_word") ) |
| 77 | + elif [[ $prev_word == "--fp-brightness" ]]; then |
| 78 | + COMPREPLY=( $(compgen -W "${brightness_options[*]}" -- "$current_word") ) |
| 79 | + fi |
| 80 | + |
| 81 | + return 0 |
| 82 | +} |
| 83 | + |
| 84 | +complete -F _framework_tool framework_tool |
0 commit comments