updated readme; futzed with documentation
This commit is contained in:
parent
3dc997daba
commit
e9e0ca45ce
6 changed files with 35 additions and 63 deletions
|
|
@ -24,6 +24,22 @@ This project is just getting started and only has a couple of features implement
|
|||
|
||||
[](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
|
||||
|
|
@ -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")
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Loading…
Reference in a new issue