updated readme; futzed with documentation

This commit is contained in:
Catherine Oborski 2024-09-08 17:11:33 -05:00
parent 3dc997daba
commit e9e0ca45ce
6 changed files with 35 additions and 63 deletions

View file

@ -24,6 +24,22 @@ This project is just getting started and only has a couple of features implement
[![cOborski/zipssion](https://img.shields.io/static/v1?label=cOborski&message=zipssion&color=yellow&logo=github)](https://github.com/coborski/zipssion/)
## Planned Usage
`Usage:
main.py <file> [--quiet | --verbose] [--path=<path>] [--extention=<file extention>]
main.py (-h | --help)
main.py --version
main.py --quiet
main.py --verbose
Options:
-h --help show help text
--version show version
--quiet print less text
--verbose print more text
--path=<path> list of file paths [default: {'/'}]
--extention=<file extention> the file's extention (if known)`
## Credits, inspiration, and references
### Articles, guides, and resources

View file

@ -1,9 +0,0 @@
# to delete
import identify_file_type
from typer import Typer
app = Typer()
VERSION = "0.1.0-alpha"
app.add_typer(identify_file_type.app, name="identify_file_type")

View file

@ -14,7 +14,22 @@ app = Typer()
@app.command()
def identify(files: list[str] = Argument(..., help="File paths to identify")):
"""Identifies the file type of provided files with incorrect extensions."""
"""
Identifies the file type of provided files with incorrect extensions
A bit longer description.
Args:
files (list[str]): A list of file paths to identify
Returns:
type: description
Raises:
FileNotFoundError: the file does not exist
"""
for file_path in files:
try:
with open(file_path, "rb") as f:
@ -37,3 +52,5 @@ def identify(files: list[str] = Argument(..., help="File paths to identify")):
except FileNotFoundError:
log.error(f"Error: File not found: {file_path}")
# todo: return

View file

@ -14,7 +14,7 @@ def create_rich_logger():
for the rich.logging class definision
Args:
variable (type): description
none
Returns:
logger: a logger that can be formatted using rich

View file

@ -1,52 +0,0 @@
# to delete
import argparse
import pathlib
import shutil
import tempfile
import zipfile
parser = argparse.ArgumentParser()
parser.add_argument("filename")
args = parser.parse_args()
print(args.filename)
"""
def view_files_content(filename):
path = pathlib.Path(filename)
print(path)
zip_path = path.stem + ".zip"
print(zip_path)
if path.exists() and path.is_file():
shutil.copy(path, zip_path)
print(path.is_file())
file = zipfile.ZipFile(zip_path)
file.printdir()
view_files_content(args.filename)
"""
def view_zip_files_content(filename):
path = pathlib.Path(filename)
logger.debug("Path:" + str(path))
zip_path = path.stem + ".zip"
logger.debug("Zip Path:" + str(zip_path))
if path.exists() and path.is_file():
shutil.copy(path, zip_path)
logger.debug("Is the path a file?:" + "true")
file = zipfile.ZipFile(zip_path)
file.printdir()
# ENDIF
# ENDDEF