Skip to content

Commit 629f508

Browse files
committed
# _PyFiTransfer_
> _**v0.2.0** Update Notes..._ --- ## Source Code - Added type checking to `main()`. - Now returns `NoReturn | None`. - Changed `fileType` variable type from `PathLike | str` to just `str`. - Fixes bug whe calling `Ex_1` exit method. - Added type checking type `NoReturn | None` to both exit methods `Ex_0` and `Ex_1`. --- ## README.md - Small formatting changes to README.md. - New screenshot added towards bottom of file. - Depicts entire process of program usage. --- Signed-off-by: schlopp96 <71921821+schlopp96@users.noreply.github.com>
1 parent 1d2087d commit 629f508

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# PyFiTransfer
22

3-
> **_Python File Transfer v0.1.0_**
3+
> **_Python File Transfer v0.2.0_**
44
55
## About
66

77
- **_PyFiTransfer_** is a simple program developed as a way to easily transfer files of a given extension-type from one directory to a destination directory.
88

9-
- Came about as a personal script for moving my game screenshots to my primary "pictures" folder easily without having to manually _copy-and-paste_ after every time playing a game.
9+
- Created as a solution for easily moving gaming screenshots to my primary "pictures" folder easily without having to manually _copy-and-paste_ after every time playing a game.
1010

1111
---
1212

@@ -23,7 +23,7 @@
2323
4. Enter the file-type of the files you wish to transfer (not including the "." that proceeds the file type).
2424

2525
- Example:
26-
- You would enter (without the quotations) `"exe"` when prompted for an `".exe"` file-type.
26+
- You would enter (without the quotations) `"exe"` when needing to migrate files with the `".exe"` extension.
2727

2828
5. If everything is correctly validated, a success message is returned to the console, alongside a list of files that were successfully transferred.
2929

@@ -33,6 +33,10 @@
3333

3434
---
3535

36+
![CLI Screenshot](img/Screenshot%202022-01-24%20010344.png)
37+
38+
---
39+
3640
## Contact
3741

3842
- If you have any questions, comments, or concerns that cannot be alleviated through the [project's GitHub repository](https://github.com/schlopp96/PyFiTransfer), please feel free to contact me through my email address:

img/Screenshot 2022-01-24 010344.png

121 KB
Loading

src/main.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@
77
from os.path import basename as base
88
from os.path import exists as isDir
99
from shutil import move as copyfile
10-
from typing import Any
10+
from typing import Any, NoReturn
1111

1212
from loadSequence import load
1313

1414

15-
def main():
15+
def main() -> NoReturn | None:
16+
"""Program method wrapper/execution order.
17+
18+
:return: [description]
19+
:rtype: [type]
20+
"""
1621
origin: str | PathLike = getOrigin()
1722
destination: str | PathLike = getDestination()
18-
fileType: str | PathLike = getFileType()
23+
fileType: str = getFileType()
1924
originClearance: bool = verify(origin)
2025
destinationClearance: bool = verify(destination)
2126

@@ -84,15 +89,14 @@ def transfer(origin, destination, fileType) -> Any:
8489
if not file.name.startswith('.') and file.name.endswith(
8590
f'.{fileType}') == True and file.is_file():
8691
files.append(file.name)
87-
8892
copyfile(file, (destination + "\\" + base(file)))
8993
load(
9094
'> Copying correct files',
9195
f'> {len(files)} files successfully copied to new location:\n{files}'
9296
)
9397

9498

95-
def Ex_0():
99+
def Ex_0() -> NoReturn | None:
96100
"""Exit program with success message.
97101
98102
:return: Exits program.
@@ -102,7 +106,7 @@ def Ex_0():
102106
return exit()
103107

104108

105-
def Ex_1(fileType: str):
109+
def Ex_1(fileType: str) -> NoReturn | None:
106110
"""Exit program with error message.
107111
108112
:param fileType: file-type of files not found

0 commit comments

Comments
 (0)