Skip to content

Commit 12f39bd

Browse files
committed
Version update: 0.5.0 -> 0.5.1
1 parent dacac3b commit 12f39bd

File tree

8 files changed

+130
-17
lines changed

8 files changed

+130
-17
lines changed

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2021 Totoro700
1+
Copyright 2020-2021 Totoro700
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,28 @@ Or you can do [Linux and Mac OS X steps](#Linux-and-Mac-OS-X)
4848

4949
You can also run `run.bat` to run PyTerm
5050

51-
# Folders
51+
## Folders
5252

5353
`bin/` - The binary files ( `.exe` )
5454

55-
`src/` - The main script files
55+
`src/` - The script files
5656

5757
`docs/` - The docs
5858

5959
`.github/` - The folder for GitHub Actions
6060

61+
## Files
62+
63+
`.gitignore` - File to tell Git what files to not push/commit
64+
65+
`run.bat` - Windows Batch file to run the `.exe` file in the `bin/` folder
66+
67+
`py_run.bat` - Windows Batch files to run the script ( `.py` )
68+
69+
`package.json` - Almost the same thing as the `package.json` for [npm](https://npmjs.org)
70+
71+
72+
6173
## Credits
6274

6375
Thanks to [@brentvollebregt](https://github.com/brentvollebregt) for [auto-py-to-exe](https://github.com/brentvollebregt/auto-py-to-exe)

bin/PyTerm.exe

566 Bytes
Binary file not shown.

change.log

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
1-
Version 0.5.0 change log
1+
Version 0.5.1 change log
22

3-
New commands:
3+
New commands/features:
44
Added py command in src/__main__.py for opening Python interpreter
55
Added move command to move a file
66
Added tree command to graphically display the directory structure of a drive or path
77
Added runPy to run a python files
8+
Added basic npm and pip commands
9+
- npm install
10+
- npm install -U
11+
- npm upgrade
12+
- npm update
13+
- pip install
14+
- pip update
15+
- pip upgrade
16+
- pip install -U
17+
Added statement if operating system is not recognized in runPy
18+
Added git clone command for cloning Git repositories
19+
Added package.xml for alternative to package.json
20+
Added an alternative command name to changePrompt: prompt
21+
[Windows] Added the title command to change the console title
822

923

1024
Updates/fixes:
11-
Fixed alignment issue in src/__main__.py (#1)
12-
Fixed typos in src/__main__.py (#2, #3)
13-
Updated parameters for math command (math -a)
25+
Fixed file being in use in mkfil command by closing the file
26+
Update help section for changePrompt
27+
Update diskpart:
28+
Open diskpart directly instead of opening cmd then opening diskpart

package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
{
22
"name": "PyTerm",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"description": "A simple Python terminal",
5+
"license": {
6+
"type": "MIT",
7+
"path": "./LICENSE.txt"
8+
},
59
"dependencies": {
10+
"python": ">=3",
611
"python-modules": [
712
"os",
813
"time",
@@ -15,10 +20,10 @@
1520
"webbrowser",
1621
"datetime",
1722
"tkinter",
18-
"sys"
23+
"sys",
24+
"ctypes"
1925
],
20-
"python": ">=3"
2126
},
2227
"main": "src/__main__.py",
2328
"change_log": "change.log"
24-
}
29+
}

package.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<Pkg name='PyTerm' type='pkg'>
3+
<Name type='name'>PyTerm</Name>
4+
<Version type='ver'>0.5.1</Version>
5+
<Description type='text'>A simple Python terminal!</Description>
6+
<License type='obj'>
7+
<Type type='name'>MIT</Type>
8+
<File type='path'>./LICENSE.txt</File>
9+
</License>
10+
<Dependencies type='obj'>
11+
<PythonVersion type='ver'>>=3.0.0</PythonVersion>
12+
<PythonModules type='list'>
13+
os,
14+
time,
15+
platform,
16+
subprocess,
17+
shutil,
18+
socket,
19+
getpass,
20+
multiprocessing,
21+
webbrowser,
22+
datetime,
23+
tkinter,
24+
sys,
25+
ctypes
26+
</PythonModules>
27+
</Dependencies>
28+
<Main type='path'>src/__main__.py</Main>
29+
<ChangeLog type='path'>change.log</ChangeLog>
30+
</Pkg>

py_run.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cd src
2+
py __main__.py

src/__main__.py

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# __main__.py
22
# Import
33
# os for file commands and others, time for wait second, platform for os command, multiprocessing for CPU count
4-
import os, time, platform, shutil, socket, getpass, multiprocessing, tkinter, sys
4+
import os, time, platform, shutil, socket, getpass, multiprocessing, tkinter, sys, ctypes
55
import webbrowser as web # Webbrowser for openLink command
66
import subprocess as sp # Subprocess for ping
77
import datetime as dt # Datetime for date and time
@@ -34,8 +34,8 @@ def ping(host): # Ping a server
3434
command = ['ping', param, '4', host] # Ping command
3535
return sp.call(command) == 0 # Return text
3636

37-
def fileExists(fileName): # Check if file or directory exists
38-
return os.path.exists(fileName)
37+
def fileExists(name):
38+
return os.path.exists(name)
3939

4040
def setupColor(): # Setup text and background color
4141
try:
@@ -136,12 +136,18 @@ def init():
136136
print('mkfil Creates a file')
137137
print('netstat Displays protocol statistics and current TCP/IP network connections')
138138
print('notepad [Windows] Opens Windows Notepad')
139+
print('npm install Install npm package')
140+
print('npm update Update npm package')
141+
print('npm upgrade Upgrade npm package')
139142
print('openBinFil Opens a binary file')
140143
print('openFil Opens a file')
141144
print('openLink Opens a link in your browser')
142145
print('openWindow Opens a window')
143146
print('ping Pings a server with an IP address')
147+
print('pip install Installs pip package')
148+
print('pip install -U Updates pip package')
144149
print('print Displays messages you enter')
150+
print('prompt Changes the prompt')
145151
print('py [Windows] Opens Python\'s interpreter in cmd in a new window')
146152
print('pyver Displays Python version')
147153
print('rename Renames a file')
@@ -155,6 +161,7 @@ def init():
155161
print('terminate Exits the program')
156162
print('TASKKILL Kill or stop a running process or application.')
157163
print('time Also shows date and time')
164+
print('title [Windows] Changes the console title')
158165
print('tree Graphically displays the directory structure of a drive or path\n')
159166
elif cmd == 'help -a' or cmd == 'help --alt': # Help
160167
print('changelog Shows PyTerm\'s change log (../change.log)')
@@ -186,13 +193,19 @@ def init():
186193
print('mkfil Creates a file')
187194
print('netstat Displays protocol statistics and current TCP/IP network connections')
188195
print('notepad [Windows] Opens Windows Notepad')
196+
print('npm install Install npm package')
197+
print('npm update Update npm package')
198+
print('npm upgrade Upgrade npm package')
189199
print('openBinFil Opens a binary file')
190200
print('openFil Opens a file')
191201
print('openLink Opens a link in your browser')
192202
print('openWindow Opens a window')
193203
print('systeminfo Shows information about you computer')
194204
print('ping Pings a server with an IP address')
195205
print('print Displays messages you enter')
206+
print('prompt Changes the prompt')
207+
print('pip install Installs pip package')
208+
print('pip install -U Updates pip package')
196209
print('py [Windows] Opens Python\'s interpreter in cmd in a new window')
197210
print('pyver Displays Python version')
198211
print('rename Renames a file')
@@ -205,6 +218,7 @@ def init():
205218
print('terminate Exits the program')
206219
print('TASKKILL Kill or stop a running process or application.')
207220
print('time Also shows date and time')
221+
print('title [Windows] Changes the console title')
208222
print('tree Graphically displays the directory structure of a drive or path\n')
209223
elif cmd == 'help -h' or cmd == 'help --help' or cmd == 'help /?':
210224
print('Usage: help [-a]\n\n\n\n')
@@ -476,7 +490,7 @@ def init():
476490
window = tkinter.Tk() # Setup variable
477491
window.title(windowName) # Set title
478492
window.mainloop() # Open
479-
elif cmd == 'changePrompt': # Change command prompt
493+
elif cmd == 'changePrompt' or cmd == 'prompt': # Change command prompt
480494
print('New prompt?') # Ask for new prompt
481495
prompt = input() # Get new prompt
482496
try: # Test code
@@ -593,7 +607,7 @@ def init():
593607
print(os.system('netstat'))
594608
elif cmd == 'diskpart': # Diskpart
595609
if __os__ == 'Windows': # Check if OS is Windows
596-
os.system('start cmd /c diskpart') # Open diskpart in cmd
610+
os.system('diskpart') # Open diskpart in cmd
597611
else:
598612
print('Error!, diskpart is only for Windows') # Not Windows
599613
elif cmd == 'TASKKILL': # Force kill a task
@@ -609,6 +623,8 @@ def init():
609623
os.system('start gnome-terminal python '+input())
610624
elif __os__ == 'Darwin': # For Mac OS
611625
os.system('start open -a Terminal python '+input())
626+
else:
627+
print('OS is not recognized!')
612628
except:
613629
print('Error! Please try again!')
614630
elif cmd == 'move': # Move file
@@ -627,6 +643,39 @@ def init():
627643
os.system('tree '+str(input())) # Output
628644
elif cmd == 'pyver': # Python version
629645
print('Python '+platform.python_version())
646+
elif cmd == 'npm install': # Install package via npm
647+
print('Package name?')
648+
pkgName = input()
649+
os.system('npm install '+pkgName)
650+
elif cmd == 'npm upgrade' or cmd == 'npm install -U' or cmd == 'npm update': # Update/upgrade package via npm
651+
print('Package name?')
652+
pkgName = input()
653+
os.system('npm install '+pkgName)
654+
elif cmd == 'pip install': # Install package via pip
655+
print('Package name?')
656+
pkgName = input()
657+
os.system('pip install '+pkgName)
658+
elif cmd == 'pip install -U' or cmd == 'pip update' or cmd == 'pip upgrade': # Update/upgrade package via pip
659+
print('Package name?')
660+
pkgName = input()
661+
os.system('pip install -U '+pkgName)
662+
elif cmd == 'git clone': # Clone Git repository using url
663+
print('Repository url?')
664+
repoURL= input('')
665+
print('Directory to clone it to?')
666+
repoPath = input('')
667+
print('Name to clone it as?')
668+
repoName = input('')
669+
try:
670+
os.system('cd '+repoPath+' & git clone '+repoURL+' '+repoName)
671+
except:
672+
print('Error! Please make sure the directory and repository url is valid!')
673+
elif cmd == 'title':
674+
if __os__ == 'Windows':
675+
print('New title -> ', end='')
676+
ctypes.windll.kernel32.SetConsoleTitleW(input())
677+
else:
678+
print('This function is only for Windows!')
630679
elif cmd == '' or cmd == None: # Empty input
631680
continue # Continue
632681
else: # Is not a command

0 commit comments

Comments
 (0)