Skip to content

Commit d5fd6ee

Browse files
committed
add somethings
1 parent c65790d commit d5fd6ee

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

binpythonfull.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
releases_ver = "offical"
2121
importlibs = "os"
2222
cloudrunver = "1.03"
23+
cmdver = "0.02"
2324
#Imported library name, please use "importlibs="<library name>" instead of "import <library name>"
2425
#Please note: The "importlibs" function does not support loading functions (such as from xxxx import xxxx, if necessary, please write it in the following location. However, please note that this operation may have the risk of error reporting, please report issues or solve it yourself
2526
#xxxxxxxxxxxxxx
@@ -298,6 +299,8 @@ def listfiles():
298299
print (file)
299300

300301
def binpython_cmd():
302+
global runpath
303+
runpath = os.path.dirname(os.path.realpath(sys.argv[0]))
301304
try:
302305
global cmd_username
303306
defaultprofile = open("binpython_filesystem/userdata/defaultloginuser", "r")
@@ -341,7 +344,7 @@ def do_adduser(self, arg):
341344
username = input("Username: ")
342345
print("create user...")
343346
try:
344-
os.makedirs(f"binpython_filesystem/userdata/home/{username}")
347+
os.makedirs(runpath + f"/binpython_filesystem/userdata/home/{username}")
345348
except(Exception, BaseException) as error:
346349
print("User already exits or system error")
347350
print(error)
@@ -365,17 +368,19 @@ def do_shell(self, arg):
365368
binpython_shell()
366369
def do_python(self, arg):
367370
'Run a Python script file (*.py) Usage: python <filename>.py'
371+
if arg == '':
372+
binpython_shell()
368373
f = open(arg, "r")
369374
exec(f.read())
370375
def do_seteditor(self, arg):
371376
'Set a default Python or Text file code editor usage: seteditor <editorname>. like: "seteditor code" (Open code via Visual Studio Code when using the "edit <filename>" command). "seteditor notepad" (Open the code through Notepad that comes with Windows)'
372377
scriptpath = os.path.dirname(os.path.realpath(sys.argv[0]))
373-
defaulteditor = open("defaulteditor.config", "w")
378+
defaulteditor = open(runpath + f"/binpython_filesystem/userdata/home/{cmd_username}/defaulteditor.config", "w")
374379
defaulteditor.write(arg)
375380
def do_edit(self, arg):
376381
'Before using this command, you must use "seteditor <editorname>" to set the editor (see the usage of this parameter for details), otherwise it cannot be called up. edit usage: edit <filename>'
377382
scriptpath = os.path.dirname(os.path.realpath(sys.argv[0]))
378-
defaulteditor = open("defaulteditor.config", "r")
383+
defaulteditor = open(runpath + f"/binpython_filesystem/userdata/home/{cmd_username}/defaulteditor.config", "r")
379384
os.system(defaulteditor.read() + ' ' + arg)
380385
def do_exit(self, arg):
381386
'exit shell'
@@ -406,8 +411,16 @@ def do_write(self, arg):
406411
writetext = open(arg, "w")
407412
arg1 = input(f"What you want to write to the target file {arg}: ")
408413
writetext.write(arg1)
409-
410-
414+
def do_ukraine(self, arg):
415+
'stand with ukraine'
416+
print("We stand with Ukraine")
417+
webbrowser.open("https://war.ukraine.ua/")
418+
def do_uname(self, arg):
419+
'version of CMD'
420+
print(f"BINPython CMD By: Edward Hsing VER:{cmdver} ")
421+
def do_user(self, arg):
422+
'Change User'
423+
os.chdir(runpath + f"/binpython_filesystem/userdata/home/{arg}")
411424

412425
if __name__ == '__main__':
413426
cmdshell().cmdloop()

0 commit comments

Comments
 (0)