pyfigtool 0.1.0__tar.gz
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-0.1.0/LICENSE +21 -0
- pyfigtool-0.1.0/PKG-INFO +38 -0
- pyfigtool-0.1.0/README.md +21 -0
- pyfigtool-0.1.0/pyproject.toml +30 -0
- pyfigtool-0.1.0/src/pyfigtool/__init__.py +6 -0
- pyfigtool-0.1.0/src/pyfigtool/cli.py +57 -0
- pyfigtool-0.1.0/src/pyfigtool/core.py +14 -0
pyfigtool-0.1.0/LICENSE
ADDED
|
@@ -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.
|
pyfigtool-0.1.0/PKG-INFO
ADDED
|
@@ -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,21 @@
|
|
|
1
|
+
# pyfigtool
|
|
2
|
+
|
|
3
|
+
A tiny CLI wrapper around [pyfiglet](https://github.com/pwaller/pyfiglet).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install pyfigtool
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pyfigtool "Hello"
|
|
15
|
+
pyfigtool "Hi" -f slant
|
|
16
|
+
pyfigtool --list-fonts
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## License
|
|
20
|
+
|
|
21
|
+
MIT
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pyfigtool"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A tiny CLI wrapper around pyfiglet for ASCII art text"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Your Name", email = "you@example.com" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["ascii", "figlet", "art", "cli"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Environment :: Console",
|
|
20
|
+
"Topic :: Text Processing",
|
|
21
|
+
]
|
|
22
|
+
dependencies = [
|
|
23
|
+
"pyfiglet>=1.0.0",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
pyfigtool = "pyfigtool.cli:main"
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://example.com/pyfigtool"
|
|
@@ -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())
|
|
@@ -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())
|