First cli commit
This commit is contained in:
3
CLI/Config.ini
Normal file
3
CLI/Config.ini
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[DEFAULT]
|
||||||
|
version = 1.12
|
||||||
|
|
||||||
44
CLI/Init.py
Normal file
44
CLI/Init.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import configparser
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
#declare default vars
|
||||||
|
version = 01.02
|
||||||
|
|
||||||
|
|
||||||
|
#declare files
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
configPath = Path("Config.ini")
|
||||||
|
|
||||||
|
|
||||||
|
def makeConfig():
|
||||||
|
config['DEFAULT'] = {'Version': version}
|
||||||
|
|
||||||
|
with open('Config.ini', 'w') as configfile:
|
||||||
|
config.write(configfile)
|
||||||
|
|
||||||
|
|
||||||
|
def loadConfig():
|
||||||
|
config.read(configPath)
|
||||||
|
version = config["DEFAULT"]["Version"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if configPath.exists():
|
||||||
|
print("The Config file exists.")
|
||||||
|
loadConfig()
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("The file Config does not exist. - Creating")
|
||||||
|
makeConfig()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print("Tiropit Launcher CLI - Release Branch")
|
||||||
|
print(f"===========================[{version}]")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user