pyfigtool 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pyfigtool/__init__.py ADDED
@@ -0,0 +1,6 @@
1
+ """pyfigtool - ASCII art text generator."""
2
+
3
+ from .core import render, list_fonts
4
+
5
+ __version__ = "0.1.0"
6
+ __all__ = ["render", "list_fonts", "__version__"]
pyfigtool/cli.py ADDED
@@ -0,0 +1,57 @@
1
+ """Command-line interface for pyfigtool."""
2
+
3
+ import argparse
4
+ import sys
5
+
6
+ import pyfiglet
7
+
8
+ from .core import render, list_fonts
9
+ from . import __version__
10
+
11
+
12
+ def main(argv=None):
13
+ parser = argparse.ArgumentParser(
14
+ prog="pyfigtool",
15
+ description="Render text as ASCII art using pyfiglet.",
16
+ )
17
+ parser.add_argument("text", nargs="?", help="Text to render")
18
+ parser.add_argument(
19
+ "-f", "--font", default="standard",
20
+ help="Font name (default: standard)",
21
+ )
22
+ parser.add_argument(
23
+ "-w", "--width", type=int, default=80,
24
+ help="Output width (default: 80)",
25
+ )
26
+ parser.add_argument(
27
+ "--list-fonts", action="store_true",
28
+ help="List all available fonts and exit",
29
+ )
30
+ parser.add_argument(
31
+ "-v", "--version", action="version",
32
+ version=f"pyfigtool {__version__}",
33
+ )
34
+
35
+ args = parser.parse_args(argv)
36
+
37
+ if args.list_fonts:
38
+ for name in list_fonts():
39
+ print(name)
40
+ return 0
41
+
42
+ if not args.text:
43
+ parser.print_help()
44
+ return 1
45
+
46
+ try:
47
+ print(render(args.text, font=args.font, width=args.width))
48
+ except pyfiglet.FontNotFound:
49
+ print(f"Error: font '{args.font}' not found.", file=sys.stderr)
50
+ print("Use --list-fonts to see available fonts.", file=sys.stderr)
51
+ return 2
52
+
53
+ return 0
54
+
55
+
56
+ if __name__ == "__main__":
57
+ sys.exit(main())
pyfigtool/core.py ADDED
@@ -0,0 +1,14 @@
1
+ """Core rendering logic."""
2
+
3
+ import pyfiglet
4
+
5
+
6
+ def render(text: str, font: str = "standard", width: int = 80) -> str:
7
+ """Render text as ASCII art."""
8
+ fig = pyfiglet.Figlet(font=font, width=width)
9
+ return fig.renderText(text)
10
+
11
+
12
+ def list_fonts() -> list[str]:
13
+ """Return all available pyfiglet font names."""
14
+ return sorted(pyfiglet.FigletFont.getFonts())
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.5
2
+ Name: pyfigtool
3
+ Version: 0.1.0
4
+ Summary: A tiny CLI wrapper around pyfiglet for ASCII art text
5
+ Project-URL: Homepage, https://example.com/pyfigtool
6
+ Author-email: Your Name <you@example.com>
7
+ License: MIT
8
+ License-File: LICENSE
9
+ Keywords: art,ascii,cli,figlet
10
+ Classifier: Environment :: Console
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Text Processing
14
+ Requires-Python: >=3.9
15
+ Requires-Dist: pyfiglet>=1.0.0
16
+ Description-Content-Type: text/markdown
17
+
18
+ # pyfigtool
19
+
20
+ A tiny CLI wrapper around [pyfiglet](https://github.com/pwaller/pyfiglet).
21
+
22
+ ## Install
23
+
24
+ ```bash
25
+ pip install pyfigtool
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ```bash
31
+ pyfigtool "Hello"
32
+ pyfigtool "Hi" -f slant
33
+ pyfigtool --list-fonts
34
+ ```
35
+
36
+ ## License
37
+
38
+ MIT
@@ -0,0 +1,8 @@
1
+ pyfigtool/__init__.py,sha256=BjMWlUaSHiqD-t9OzAiuNaJyAwXy1VSuwJgxocc4p98,155
2
+ pyfigtool/cli.py,sha256=thWGrMPfiqPhSDnlpuilfLULCWP2TvoIPe6qCeYqN4M,1407
3
+ pyfigtool/core.py,sha256=pJ_pwCOgPmzV6L569B3W1zsBP_iRlQWnr_9syFU9zKg,371
4
+ pyfigtool-0.1.0.dist-info/METADATA,sha256=PsTiBP6FcSY7vt_5Fiyf5IkI4ga1KDOeQZBqUVgLjyM,783
5
+ pyfigtool-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
6
+ pyfigtool-0.1.0.dist-info/entry_points.txt,sha256=oGqsVQhvcE0Be4zgvc66XfWGWw94DgjY1WFBbBWRPfU,49
7
+ pyfigtool-0.1.0.dist-info/licenses/LICENSE,sha256=jV1IuZ-d1Gf8i5HJCWgUOVj39UolbZlMd83zWynbgdI,1076
8
+ pyfigtool-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pyfigtool = pyfigtool.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 张明轩(MingXuan)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.