dup/cli.py

39 lines
1.0 KiB
Python
Raw Permalink Normal View History

2024-05-12 11:45:32 +02:00
import getopt
import sys
import os
import discord
argumentList = sys.argv[1:]
options = "hiu"
long_options = ["help", "install", "uninstall"]
def main():
if os.geteuid() == 0:
print("WARNING: This script is not meant to run as root as it installs discord to the user folder.")
i = input("Do you wish to proceed? (y/n)")
if str(i).upper() != "Y":
return exit()
try:
# Parsing argument
arguments, values = getopt.getopt(argumentList, options, long_options)
# checking each argument
for currentArgument, currentValue in arguments:
if currentArgument in ("-h", "--help"):
print ("Displaying Help")
elif currentArgument in ("-i", "--install"):
discord.install()
elif currentArgument in ("-u", "--uninstall"):
discord.uninstall()
except getopt.error as err:
# output error, and return with an error code
print (str(err))