2024-11-19 13:47:45 +02:00
|
|
|
# AGPL 3 or any later version
|
|
|
|
# (C) J.Y.Amihud ( Blender Dumbass )
|
|
|
|
|
|
|
|
# Basic sys to get through to different modules
|
2024-11-19 19:04:03 +02:00
|
|
|
import os
|
2024-11-19 13:47:45 +02:00
|
|
|
import sys
|
2024-11-20 14:40:56 +02:00
|
|
|
|
|
|
|
from modules.Common import *
|
|
|
|
|
2024-11-19 13:47:45 +02:00
|
|
|
if len(sys.argv) < 2 or "--help" in sys.argv:
|
|
|
|
from modules import Help
|
|
|
|
Help.Help()
|
|
|
|
|
|
|
|
elif "--set" in sys.argv:
|
|
|
|
from modules import Set
|
|
|
|
Set.Set()
|
|
|
|
|
2024-11-24 23:28:19 +02:00
|
|
|
elif "--account" in sys.argv:
|
|
|
|
from modules import Account
|
|
|
|
Account.Account()
|
|
|
|
|
2024-11-19 19:04:03 +02:00
|
|
|
elif "--config" in sys.argv:
|
|
|
|
from modules import Set
|
|
|
|
data = Set.Load() # Making sure
|
|
|
|
Set.Save(data) # that config.json exists
|
2024-11-27 18:53:14 +02:00
|
|
|
os.system(Set.Load().get("editor", "nano")+" "+Set.Folder()+"/config.json")
|
2024-11-19 19:04:03 +02:00
|
|
|
|
2024-11-19 13:47:45 +02:00
|
|
|
elif "--run" in sys.argv:
|
|
|
|
from modules import Run
|
2024-11-19 19:04:03 +02:00
|
|
|
|
|
|
|
elif "--folder" in sys.argv:
|
|
|
|
from modules import Set
|
|
|
|
os.system("xdg-open "+Set.Folder())
|
2024-11-20 14:40:56 +02:00
|
|
|
|
|
|
|
elif "--transfer" in sys.argv:
|
|
|
|
try:
|
2024-11-27 18:53:14 +02:00
|
|
|
folder = sys.argv[ sys.argv.index("--transfer") + 1]
|
2024-11-20 14:40:56 +02:00
|
|
|
if "--" in folder: 1/0 # Failing this for the error message.
|
|
|
|
from modules import Legacy
|
|
|
|
Legacy.Transfer(folder)
|
|
|
|
except Exception as e:
|
|
|
|
print(clr["bold"]+clr["tdrd"]+"Error:"+clr["norm"]+" Folder Wasn't Specified!", e)
|
|
|
|
print('Use: $ python3 run.py --transfer ~/Software/blenderdumbass_site/')
|
2024-11-27 18:53:14 +02:00
|
|
|
|
|
|
|
elif "--create" in sys.argv:
|
|
|
|
try:
|
|
|
|
name = sys.argv[ sys.argv.index("--create") + 1]
|
|
|
|
if "--" in name: 1/0 # Failing this for the error message.
|
|
|
|
from modules import Create
|
|
|
|
Create.Create(name)
|
|
|
|
except Exception as e:
|
|
|
|
print(clr["bold"]+clr["tdrd"]+"Error:"+clr["norm"]+" Name Wasn't Specified!", e)
|
|
|
|
print('Use: $ python3 run.py --create article/My_Article')
|
|
|
|
|
|
|
|
elif "--write" in sys.argv:
|
|
|
|
try:
|
|
|
|
name = sys.argv[ sys.argv.index("--write") + 1]
|
|
|
|
if "--" in name: 1/0 # Failing this for the error message.
|
|
|
|
from modules import Create
|
|
|
|
Create.Write(name)
|
|
|
|
except Exception as e:
|
|
|
|
print(clr["bold"]+clr["tdrd"]+"Error:"+clr["norm"]+" Name Wasn't Specified!", e)
|
|
|
|
print('Use: $ python3 run.py --write article/My_Article')
|
|
|
|
|
|
|
|
elif "--metadata" in sys.argv:
|
|
|
|
try:
|
|
|
|
name = sys.argv[ sys.argv.index("--metadata") + 1]
|
|
|
|
if "--" in name: 1/0 # Failing this for the error message.
|
|
|
|
from modules import Create
|
|
|
|
Create.Metadata(name)
|
|
|
|
except Exception as e:
|
|
|
|
print(clr["bold"]+clr["tdrd"]+"Error:"+clr["norm"]+" Name Wasn't Specified!", e)
|
|
|
|
print('Use: $ python3 run.py --metadata article/My_Article')
|
|
|
|
|
|
|
|
elif "--publish" in sys.argv:
|
|
|
|
try:
|
|
|
|
name = sys.argv[ sys.argv.index("--publish") + 1]
|
|
|
|
if "--" in name: 1/0 # Failing this for the error message.
|
|
|
|
from modules import Create
|
|
|
|
Create.Publish(name)
|
|
|
|
except Exception as e:
|
|
|
|
print(clr["bold"]+clr["tdrd"]+"Error:"+clr["norm"]+" Name Wasn't Specified!", e)
|
|
|
|
print('Use: $ python3 run.py --publish article/My_Article')
|