TamtamHero / fw-fanctrl

A simple systemd service to better control Framework Laptop's fan(s)
BSD 3-Clause "New" or "Revised" License
186 stars 35 forks source link

Add choice to print fan speed percentage #78

Closed Speenah closed 3 weeks ago

Speenah commented 3 weeks ago

Adds an option to print the current fan speed percentage:

$ fw-fanctrl print speed
23%

Turns out adding the percentage was pretty trivial since the FanController holds this state. Printing the current RPM is slightly more complex since it needs to be retrieved from the hardware controller, and can be ambiguous on how to handle the case of multiple fans. But just getting the percentage satisfies my original use case

Closes #74

Speenah commented 3 weeks ago

Sure! Would that be to edit the help argument on the printCommand.add_argument? I'm looking at the docs for choices and I'm not seeing a way to specify a description for each choice

leopoldhub commented 3 weeks ago

Yes, sadly there is no other option than editing the global help. The parser already have the RawTextHelpFormatter formatter class, so you should be able to use \n to create new lines.

Speenah commented 3 weeks ago

With c08e559 the output looks like this

positional arguments:
  {current,list,speed}  current - The current strategy
                        list - List available strategies
                        speed - The current fan speed percentage