Last active
August 29, 2015 14:19
-
-
Save jonasstein/9bb9cdd292edde787f02 to your computer and use it in GitHub Desktop.
gentoo menu in python (qe) quickemerge script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import subprocess | |
# save the script to /usr/local/bin/qe.py | |
def my_cmd(thecommand): | |
return_code = subprocess.call(thecommand, shell=True) | |
def my_quit_fn(): | |
raise SystemExit | |
def invalid(): | |
print("Wrong key. Please try again.") | |
menu = {"1":("sync package list: ","eix-sync"), | |
"2":("clean: ","emerge --depclean && eclean distfiles"), | |
"3":("update:","emerge --update --newuse --keep-going @world"), | |
"4":("show logs:","elogv"), | |
"5":("read news:","eselect news read new"), | |
"q":("Quit ","echo bye!") | |
} | |
for key in sorted(menu.keys()): | |
print(key+": " + menu[key][0] + menu[key][1]) | |
ans = input("please select: ") | |
my_cmd(menu.get(ans,[None,invalid])[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment