completion: add libinput analyze to zsh completions
authorPeter Hutterer <peter.hutterer@who-t.net>
Mon, 23 Mar 2020 06:54:02 +0000 (16:54 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 25 Mar 2020 05:52:56 +0000 (05:52 +0000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
completion/zsh/_libinput

index 0bd9021f9188cc92188df2c0063d5aed06fc9829..c25fb7a54fddc0f72d94dc95f3a7d6c171081386 100644 (file)
@@ -9,6 +9,7 @@
                "debug-gui:Show a GUI to visualize libinput's events"
                "debug-tablet:Show tablet axis and button values"
                "measure:Measure various properties of devices"
+               "analyze:Analyze device data"
                "record:Record the events from a device"
                "replay:Replay the events from a device"
        )
@@ -162,6 +163,33 @@ __all_seats()
                ':device:_files -W /dev/input/ -P /dev/input/'
 }
 
+(( $+functions[_libinput_analyze] )) || _libinput_analyze()
+{
+       local curcontext=$curcontext state line ret=1
+       local features
+       features=(
+               "per-slot-delta:analyze relative movement per touch per slot"
+       )
+
+       _arguments -C \
+               '--help[Print help and exit]' \
+               ':feature:->feature' \
+               '*:: :->option-or-argument'
+
+       case $state in
+               (feature)
+                       _describe -t features 'feature' features
+                       ;;
+               (option-or-argument)
+                       curcontext=${curcontext%:*:*}:libinput-analyze-$words[1]:
+                       if ! _call_function ret _libinput_analyze_$words[1]; then
+                               _message "unknown feature: $words[1]"
+                       fi
+                       ;;
+       esac
+       return ret
+}
+
 (( $+functions[_libinput_record] )) || _libinput_record()
 {
        _arguments \