Add --version flag to CLI (#177)

* Add --version flag to determine current app version.
* Alphabetise cli flags.
This commit is contained in:
Marco Vermeulen 2021-02-14 09:49:07 +00:00 committed by GitHub
parent 984cf657a6
commit ae86bbb86a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 6 deletions

View File

@ -15,14 +15,15 @@ from auto_cpufreq.core import *
# cli
@click.command()
@click.option("--monitor", is_flag=True, help="Monitor and see suggestions for CPU optimizations")
@click.option("--live", is_flag=True, help="Monitor and make (temp.) suggested CPU optimizations")
@click.option("--install/--remove", default=True, help="Install/remove daemon for (permanent) automatic CPU optimizations")
@click.option("--stats", is_flag=True, help="View live stats of CPU optimizations made by daemon")
@click.option("--log", is_flag=True, help="Deprecated flag replaced by --stats")
@click.option("--daemon", is_flag=True, hidden=True)
@click.option("--debug", is_flag=True, help="Show debug info (include when submitting bugs)")
def main(monitor, live, install, stats, log, daemon, debug):
@click.option("--install/--remove", default=True, help="Install/remove daemon for (permanent) automatic CPU optimizations")
@click.option("--live", is_flag=True, help="Monitor and make (temp.) suggested CPU optimizations")
@click.option("--log", is_flag=True, help="Deprecated flag replaced by --stats")
@click.option("--monitor", is_flag=True, help="Monitor and see suggestions for CPU optimizations")
@click.option("--stats", is_flag=True, help="View live stats of CPU optimizations made by daemon")
@click.option("--version", is_flag=True, help="Show currently installed version")
def main(daemon, debug, install, live, log, monitor, stats, version):
if len(sys.argv) == 1:
print("\n" + "-" * 32 + " auto-cpufreq " + "-" * 33 + "\n")
print("Automatic CPU speed & power optimizer for Linux")
@ -110,6 +111,11 @@ def main(monitor, live, install, stats, log, daemon, debug):
get_current_gov()
get_turbo()
footer()
elif version:
footer()
distro_info()
app_version()
footer()
elif install:
if os.getenv('PKG_MARKER') == "SNAP":
root_check()