[+] Aliases
This commit is contained in:
@@ -44,17 +44,6 @@ suffixes = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def cli(fmt: str | None = None):
|
|
||||||
agupa = argparse.ArgumentParser("formtool", "ffmpeg shortcuts")
|
|
||||||
if fmt is None:
|
|
||||||
agupa.add_argument('format', choices=defaults.keys(), help="Compression format to use.")
|
|
||||||
agupa.add_argument('files', nargs='+', help="One or more files to compress.")
|
|
||||||
agupa.add_argument('--keep', action='store_true', help="Keep original files after compression.")
|
|
||||||
args, passthrough = agupa.parse_known_args()
|
|
||||||
|
|
||||||
main(fmt or args.format, args.files, args.keep, passthrough)
|
|
||||||
|
|
||||||
|
|
||||||
def main(fmt: str, files: list[str], keep: bool, passthrough: list[str]):
|
def main(fmt: str, files: list[str], keep: bool, passthrough: list[str]):
|
||||||
# Process each file provided on the command line
|
# Process each file provided on the command line
|
||||||
for inf in files:
|
for inf in files:
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import argparse
|
||||||
|
|
||||||
|
from .__main__ import defaults, main
|
||||||
|
|
||||||
|
|
||||||
|
def cli(fmt: str | None = None):
|
||||||
|
agupa = argparse.ArgumentParser("formtool", "ffmpeg shortcuts")
|
||||||
|
if fmt is None:
|
||||||
|
agupa.add_argument('format', choices=defaults.keys(), help="Compression format to use.")
|
||||||
|
agupa.add_argument('files', nargs='+', help="One or more files to compress.")
|
||||||
|
agupa.add_argument('--keep', action='store_true', help="Keep original files after compression.")
|
||||||
|
args, passthrough = agupa.parse_known_args()
|
||||||
|
|
||||||
|
main(fmt or args.format, args.files, args.keep, passthrough)
|
||||||
|
|
||||||
|
|
||||||
|
def av1():
|
||||||
|
cli('av1')
|
||||||
|
|
||||||
|
|
||||||
|
def x264():
|
||||||
|
cli('x264')
|
||||||
|
|
||||||
|
|
||||||
|
def mp3():
|
||||||
|
cli('mp3')
|
||||||
|
|
||||||
|
|
||||||
|
def opus():
|
||||||
|
cli('opus')
|
||||||
|
|
||||||
|
|
||||||
|
def flac():
|
||||||
|
cli('flac')
|
||||||
+6
-1
@@ -9,4 +9,9 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
formtool = "formtool.__main__:cli"
|
formtool = "formtool.cli:cli"
|
||||||
|
fav1 = "formtool.av1:main"
|
||||||
|
fx264 = "formtool.x264:main"
|
||||||
|
fmp3 = "formtool.mp3:main"
|
||||||
|
fopus = "formtool.opus:main"
|
||||||
|
fflac = "formtool.flac:main"
|
||||||
|
|||||||
Reference in New Issue
Block a user