Skip to content

Commit 3f09ab7

Browse files
committed
Version update: 0.4.3 -> 0.4.4
1 parent 7ab67dd commit 3f09ab7

10 files changed

Lines changed: 67 additions & 28 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__pycache__/
2+
3+
user_data/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A simple Python terminal!
44

5-
![](https://img.shields.io/badge/Version-v0.4.3-green)
5+
![](https://img.shields.io/badge/Version-v0.4.4-green)
66

77
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/Totoro700/PyTerm)
88

bin/PyTerm.exe

297 Bytes
Binary file not shown.

change.log

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
Version 0.4.3 change log
1+
Version 0.4.4 change log
2+
3+
Added notepad command for opening Windows Notepad
4+
Shorten lines on date/time command
5+
Added .gitignore
6+
Fixed bug: deleting folders/directories/files that are being used by another program
27

3-
Added version command

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ When you first startup PyTerm you should see something like this:
4141
```
4242
@------------------------------------------------------------------------------------@
4343
| |
44-
| |PyTerm v0.4.3| |
44+
| |PyTerm v0.4.4| |
4545
| |
4646
@------------------------------------------------------------------------------------@
4747
>
@@ -63,4 +63,4 @@ If you want to exit, type `exit` or `terminate`, it should close once you press
6363

6464

6565

66-
PyTerm is written in Python and some Batch ( `.cmd`, `.bat` )
66+
PyTerm is written in Python and some Batch ( `.bat` )

docs/package_commands/license.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# license
2+
3+
The `license` command shows PyTerm's license file (should be in `../LICENSE.txt`)

docs/system_commands/notepad.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# notepad
2+
3+
The `notepad` opens Microsoft Windows Notepad, it is only for Windows OS. It opens Notepad by using the python `subprocess` ( `subprocess.Popen` )

docs/system_commands/version.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ The `version` (also `ver` ) command shows PyTerm's version:
44

55
```
66
> ver
7-
PyTerm v0.4.3
7+
PyTerm v0.4.4
88
> version
9-
PyTerm v0.4.3
9+
PyTerm v0.4.4
1010
```
1111

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "PyTerm",
3-
"version": "0.4.3",
3+
"version": "0.4.4",
44
"description": "A simple Python terminal",
55
"dependencies": {
66
"python-modules": [

src/__main__.py

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@
77
from time import gmtime, strftime
88
# webbrowser for openLink command, and datetime for date and time
99

10+
__cache__ = 0 # Set cache to 0
11+
prompt = '' # Setup prompt variable
12+
__os__ = platform.system() # Get operating system name and store it in a variable
13+
null = None # Create new variable with value of None
14+
1015
# Print version and title as function
1116
def title():
1217
print('@------------------------------------------------------------------------------------@')
1318
print('| |')
14-
print('| |PyTerm v0.4.3| |')
19+
print('| |PyTerm v0.4.4| |')
1520
print('| |')
1621
print('@------------------------------------------------------------------------------------@')
1722

1823
def clear(): # Clear screen
19-
if __os__ == 'nt': # Windows
24+
if __os__ == 'Windows': # Windows
2025
os.system('cls')
2126
else: # Linux and Mac OS X
2227
os.system('clear')
@@ -39,9 +44,6 @@ def setupColor():
3944
except:
4045
os.system('color 0A')
4146

42-
__cache__ = 0 # Set cache to 0
43-
prompt = '' # Setup prompt variable
44-
__os__ = os.name # Get operating system name and store it in a variable
4547

4648
def cache():
4749
try:
@@ -104,6 +106,7 @@ def init():
104106
print(prompt+' ', end='') # Input prompt without line break ( \n )
105107
cmd = input('') # Collect input
106108
if cmd == 'help':
109+
print('changelog Shows PyTerm\'s change log (../change.log)')
107110
print('color Changes the text and the background color')
108111
print('copy Copies a file')
109112
print('curDir Displays the current directory')
@@ -121,13 +124,15 @@ def init():
121124
print('info -c Clear stored info')
122125
print('info -g Get stored info')
123126
print('ip Displays your computer\'s IP address')
127+
print('licenes Shows PyTerm\'s license (../LICENSE.txt)')
124128
print('md Creates a directory')
125129
print('math -a Adds two numbers together')
126130
print('math -s Subtracts two numbers')
127131
print('math -m Multiplies two numbers')
128132
print('math -d Divides two numbers')
129133
print('mkdir Creates a directory')
130134
print('mkfil Creates a file')
135+
print('notepad Opens Windows Notepad')
131136
print('openBinFil Opens a binary file')
132137
print('openFil Opens a file')
133138
print('openLink Opens a link in your browser')
@@ -145,6 +150,7 @@ def init():
145150
print('terminate Exits the program')
146151
print('time Also shows date and time\n')
147152
elif cmd == 'help -a' or cmd == 'help --alt': # Help
153+
print('changelog Shows PyTerm\'s change log (../change.log)')
148154
print('color Changes the text and the background color')
149155
print('copy Copies a file')
150156
print('curDir Displays the current directory')
@@ -159,13 +165,15 @@ def init():
159165
print('find Finds a specific text in a file')
160166
print('help Displays this help message')
161167
print('ip Displays your computer\'s IP address')
168+
print('licenes Shows PyTerm\'s license (../LICENSE.txt)')
162169
print('math -a Adds two numbers together')
163170
print('math -s Subtracts two numbers')
164171
print('math -m Multiplies two numbers')
165172
print('math -d Divides two numbers')
166173
print('md Creates a directory')
167174
print('mkdir Creates a directory')
168175
print('mkfil Creates a file')
176+
print('notepad Opens Windows Notepad')
169177
print('openBinFil Opens a binary file')
170178
print('openFil Opens a file')
171179
print('openLink Opens a link in your browser')
@@ -226,8 +234,11 @@ def init():
226234
toDel = input('') # Collect directory or file name
227235
try: # Try if to delete the file
228236
if fileExists(toDel): # See if file exsits
229-
os.remove(toDel)
230-
print('Successfully deleted '+toDel)
237+
try:
238+
os.remove(toDel)
239+
print('Successfully deleted '+toDel)
240+
except:
241+
print('Error! Please make sure that the file in not in us by another program!')
231242
else:
232243
print('The file does not exist!')
233244
except: # The user might have typed a folder name or the access is deined
@@ -290,8 +301,7 @@ def init():
290301
print(' -o or --overwrite Overwrites all the stored info with the new info')
291302
print(' -c or --clear Clears stored info\n\n')
292303
elif cmd == 'time' or cmd == 'date': # Display date and time
293-
time = dt.datetime.now() # Get date and time
294-
print(time) # Print date and time
304+
print(dt.datetime.now()) # Print date and time
295305
elif cmd == 'openLink': # Open link in browser
296306
print('Link?')
297307
fopenLink(input('')) # Get input and open it in browser
@@ -360,14 +370,17 @@ def init():
360370
elif cmd == 'find': # Find text in a file
361371
print('Full file or directory path to find text?')
362372
toFind = input('') # Get file
363-
print('Text to find?')
364-
toFindTxt = input('') # Get text to find
365-
try:
366-
f = open(toFind, 'r') # Open file
367-
toFindStr = f.read() # Read from file
368-
print('First appearance of the word '+toFindTxt+' is found at character '+str(toFindStr.find(toFindTxt))) # Print results
369-
except:
370-
print('Error! Please try again') # Error
373+
if fileExists(toFind):
374+
print('Text to find?')
375+
toFindTxt = input('') # Get text to find
376+
try:
377+
f = open(toFind, 'r') # Open file
378+
toFindStr = f.read() # Read from file
379+
print('First appearance of the word '+toFindTxt+' is found at character '+str(toFindStr.find(toFindTxt))) # Print results
380+
except:
381+
print('Error! Please try again') # Error
382+
else:
383+
print('File does not exist!')
371384
elif cmd == 'color': # Switch color
372385
print('Color?') # Ask color
373386
print('0 = Black 8 = Gray') # Show colors
@@ -404,7 +417,10 @@ def init():
404417
print('Directory of the folder to delete? Example: C:\\Users\\exampleUser\\Documents\\New_Folder')
405418
toDelDir = input('') # Get directory
406419
if fileExists(toDelDir): # Check if directory exists
407-
os.rmdir(toDelDir) # Remove directory
420+
try:
421+
os.rmdir(toDelDir) # Remove directory
422+
except:
423+
print('Error! Please make sure that directory/folder is not being used by another program!')
408424
else:
409425
print('Not a valid directory of a folder!') # Error
410426
elif cmd == 'rename': # Rename file
@@ -537,8 +553,18 @@ def init():
537553
print(' -m or --multiply Multiplies two numbers')
538554
print(' -d or --divide Divides two numbers\n\n')
539555
elif cmd == 'ver' or cmd == 'version':
540-
print('PyTerm v0.4.3')
541-
elif cmd == '': # Empty input
556+
print('PyTerm v0.4.4')
557+
elif cmd == 'notepad':
558+
if __os__ == 'Windows':
559+
subprocess.Popen('notepad.exe')
560+
else:
561+
print('Sorry, notepad is only for Windows!')
562+
elif cmd == 'license':
563+
if fileExists('../LICENSE.txt'):
564+
print(open('../LICENSE.txt', 'r').read())
565+
else:
566+
print('Could not find license!')
567+
elif cmd == '' or cmd == null: # Empty input
542568
continue # Continue
543569
else: # Is not a command
544570
print('Python '+platform.python_version()+' -> PyTerm -> "'+cmd+'" is not a command!') # Error

0 commit comments

Comments
 (0)