Repository navigation
Expand file tree
/
Copy pathinstall_program.py
More file actions
91 lines (83 loc) · 2.54 KB
/
Copy pathinstall_program.py
File metadata and controls
91 lines (83 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import subprocess
from clear import clear
from ascii import greets, ascii_banner
apps = {
"1": ("Google Chrome", "Google.Chrome"),
"2": ("Steam", "Valve.Steam"),
"3": ("OBS Studio", "OBSProject.OBSStudio"),
"4": ("Discord", "Discord.Discord"),
"5": ("Tor Browser", "TorProject.TorBrowser"),
"6": ("Firefox", "Mozilla.Firefox"),
"7": ("Brave", "Brave.Brave"),
"8": ("Visual Studio Code", "Microsoft.VisualStudioCode"),
"9": ("Vim", "vim.vim"),
"10": ("Neovim", "Neovim.Neovim"),
"11": ("Spotify", "Spotify.Spotify"),
"12": ("VLC Player", "VideoLAN.VLC"),
"13": ("InkScape", "Inkscape.Inkscape"),
"14": ("Audacity", "Audacity.Audacity"),
"15": ("uTorrent", "BitTorrent.uTorrent"),
"16": ("Git", "Git.Git"),
"17": ("GIMP", "GIMP.GIMP"),
"18": ("Krita", "Krita.Krita"),
"19": ("WhatsApp", "WhatsApp.WhatsApp"),
"20": ("7Zip", "7zip.7zip")
}
def install_program(package_id):
print(f"Starting installation for {package_id}...")
command = ["winget", "install", "-e", "--id", package_id, "--silent", "--accept-source-agreements", "--accept-package-agreements"]
try:
result = subprocess.run(command, capture_output=True, text=True, check=True)
print(f"Successfully installed {package_id}!")
if result.stdout:
print(f"\nOutput: \n{result.stdout}")
if result.stderr:
print(f"\nWarnings: \n{result.stderr}")
input("Press ENTER to get back...")
except subprocess.CalledProcessError as e:
print(f"Failed to install {package_id}.")
print(f"\nReturn Code: \n{e.returncode}")
if e.stdout:
print(f"\nOutput: \n{e.stdout}")
if e.stderr:
print(f"\nError Output: \n{e.stderr}")
input("Press ENTER to get back...")
def app_selection():
app_selector = """
Choose an app to install:
[1] Google Chrome
[2] Steam
[3] OBS Studio
[4] Discord
[5] Tor Browser
[6] Firefox
[7] Brave
[8] Visual Studio Code
[9] Vim
[10] NeoVim
[11] Spotify
[12] VLC Player
[13] InkScape
[14] Audacity
[15] uTorrent
[16] Git
[17] GIMP
[18] Krita
[19] WhatsApp
[20] 7Zip
[0] Exit
"""
clear()
print(ascii_banner)
print(greets)
print(app_selector)
app_selected = input("Enter an option: ").strip().lower()
if app_selected == "0":
return
if app_selected in apps:
app_name, package_id = apps[app_selected]
print(f"Selected {app_name}")
install_program(package_id)
else:
print("Invalid option.")
print("Press ENTER to return...")