LoLei / razer-cli

CLI for configuring Razer devices
GNU General Public License v3.0
89 stars 11 forks source link

[Patch] Improve readability of device capabilities #36

Closed GM-Script-Writer-62850 closed 3 years ago

GM-Script-Writer-62850 commented 3 years ago

https://github.com/LoLei/razer-cli/blob/master/razer_cli/razer_cli.py#L119-L120 Code Changes:

        if (args.list_devices_long):
            #print("   capabilities: {}".format(device.capabilities))
            print("   capabilities:")
            for i in device.capabilities:
                 print("      ",i,"=",device.capabilities[i])

Before:

$ .local/bin/razer-cli -ll
Found 1 Razer devices
Razer DeathAdder Elite:
   type: mouse
   DPI: (1100, 1100)
   max DPI: 16000
   polling rate: 1000
   serial: 321848H04401822
   firmware version: v1.6
   driver version: 2.9.0
   effects: ['logo_breath_single', 'logo_reactive', 'logo_static', 'scroll_breath_single', 'scroll_reactive', 'scroll_static']
   capabilities: {'name': True, 'type': True, 'firmware_version': True, 'serial': True, 'brightness': False, 'macro_logic': False, 'keyboard_layout': False, 'lighting': True, 'lighting_breath_single': False, 'lighting_breath_dual': False, 'lighting_breath_triple': False, 'lighting_breath_random': False, 'lighting_wave': False, 'lighting_reactive': False, 'lighting_none': False, 'lighting_spectrum': False, 'lighting_static': False, 'lighting_starlight_single': False, 'lighting_starlight_dual': False, 'lighting_starlight_random': False, 'lighting_ripple': False, 'lighting_ripple_random': False, 'lighting_pulsate': False, 'lighting_led_matrix': True, 'lighting_led_single': False, 'lighting_logo': True, 'lighting_logo_active': False, 'lighting_logo_blinking': False, 'lighting_logo_brightness': True, 'lighting_logo_pulsate': False, 'lighting_logo_spectrum': True, 'lighting_logo_static': True, 'lighting_logo_none': True, 'lighting_logo_reactive': True, 'lighting_logo_wave': False, 'lighting_logo_breath_single': True, 'lighting_logo_breath_dual': True, 'lighting_logo_breath_random': True, 'lighting_scroll': True, 'lighting_scroll_active': False, 'lighting_scroll_blinking': False, 'lighting_scroll_brightness': True, 'lighting_scroll_pulsate': False, 'lighting_scroll_spectrum': True, 'lighting_scroll_static': True, 'lighting_scroll_none': True, 'lighting_scroll_reactive': True, 'lighting_scroll_wave': False, 'lighting_scroll_breath_single': True, 'lighting_scroll_breath_dual': True, 'lighting_scroll_breath_random': True, 'lighting_left': False, 'lighting_left_active': False, 'lighting_left_brightness': False, 'lighting_left_spectrum': False, 'lighting_left_static': False, 'lighting_left_none': False, 'lighting_left_reactive': False, 'lighting_left_wave': False, 'lighting_left_breath_single': False, 'lighting_left_breath_dual': False, 'lighting_left_breath_random': False, 'lighting_right': False, 'lighting_right_active': False, 'lighting_right_brightness': False, 'lighting_right_spectrum': False, 'lighting_right_static': False, 'lighting_right_none': False, 'lighting_right_reactive': False, 'lighting_right_wave': False, 'lighting_right_breath_single': False, 'lighting_right_breath_dual': False, 'lighting_right_breath_random': False, 'lighting_backlight': False, 'lighting_backlight_active': False, 'lighting_profile_led_red': False, 'lighting_profile_led_green': False, 'lighting_profile_led_blue': False, 'poll_rate': True, 'dpi': True, 'available_dpi': False, 'battery': False}

After:

$ .local/bin/razer-cli -ll
Found 1 Razer devices
Razer DeathAdder Elite:
   type: mouse
   DPI: (1100, 1100)
   max DPI: 16000
   polling rate: 1000
   serial: 321848H04401822
   firmware version: v1.6
   driver version: 2.9.0
   effects: ['logo_breath_single', 'logo_reactive', 'logo_static', 'scroll_breath_single', 'scroll_reactive', 'scroll_static']
   capabilities: 
     name = True
     type = True
     firmware_version = True
     serial = True
     brightness = False
     macro_logic = False
     keyboard_layout = False
     lighting = True
     lighting_breath_single = False
     lighting_breath_dual = False
     lighting_breath_triple = False
     lighting_breath_random = False
     lighting_wave = False
     lighting_reactive = False
     lighting_none = False
     lighting_spectrum = False
     lighting_static = False
     lighting_starlight_single = False
     lighting_starlight_dual = False
     lighting_starlight_random = False
     lighting_ripple = False
     lighting_ripple_random = False
     lighting_pulsate = False
     lighting_led_matrix = True
     lighting_led_single = False
     lighting_logo = True
     lighting_logo_active = False
     lighting_logo_blinking = False
     lighting_logo_brightness = True
     lighting_logo_pulsate = False
     lighting_logo_spectrum = True
     lighting_logo_static = True
     lighting_logo_none = True
     lighting_logo_reactive = True
     lighting_logo_wave = False
     lighting_logo_breath_single = True
     lighting_logo_breath_dual = True
     lighting_logo_breath_random = True
     lighting_scroll = True
     lighting_scroll_active = False
     lighting_scroll_blinking = False
     lighting_scroll_brightness = True
     lighting_scroll_pulsate = False
     lighting_scroll_spectrum = True
     lighting_scroll_static = True
     lighting_scroll_none = True
     lighting_scroll_reactive = True
     lighting_scroll_wave = False
     lighting_scroll_breath_single = True
     lighting_scroll_breath_dual = True
     lighting_scroll_breath_random = True
     lighting_left = False
     lighting_left_active = False
     lighting_left_brightness = False
     lighting_left_spectrum = False
     lighting_left_static = False
     lighting_left_none = False
     lighting_left_reactive = False
     lighting_left_wave = False
     lighting_left_breath_single = False
     lighting_left_breath_dual = False
     lighting_left_breath_random = False
     lighting_right = False
     lighting_right_active = False
     lighting_right_brightness = False
     lighting_right_spectrum = False
     lighting_right_static = False
     lighting_right_none = False
     lighting_right_reactive = False
     lighting_right_wave = False
     lighting_right_breath_single = False
     lighting_right_breath_dual = False
     lighting_right_breath_random = False
     lighting_backlight = False
     lighting_backlight_active = False
     lighting_profile_led_red = False
     lighting_profile_led_green = False
     lighting_profile_led_blue = False
     poll_rate = True
     dpi = True
     available_dpi = False
     battery = False

maybe this should be a -llh option, not sure if just dumping the JSON as a string is for scripting or not

LoLei commented 3 years ago

Done in #37