├── .gitignore ├── LICENSE ├── MANIFEST.in ├── README.md ├── makefile ├── man └── pycowsay.6 ├── pycowsay ├── __init__.py ├── __main__.py └── main.py └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | venv/ 3 | bin/ 4 | build/ 5 | develop-eggs/ 6 | dist/ 7 | eggs/ 8 | lib/ 9 | lib64/ 10 | parts/ 11 | sdist/ 12 | var/ 13 | *.egg-info/ 14 | .installed.cfg 15 | *.egg 16 | *.eggs 17 | .mypy_cache/ 18 | .vscode -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Chad Smith 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. -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | # Things to include in the built package (besides the packages defined in setup.py) 2 | include README.md 3 | include LICENSE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pycowsay 2 | A talking cow! 3 | 4 | ## Run 5 | Use [pipx](https://github.com/pipxproject/pipx) to run without permanently installing 6 | ``` 7 | pipx run pycowsay mooo 8 | ``` 9 | 10 | ``` 11 | >> pipx run pycowsay mooooo 12 | 13 | ------ 14 | < mooooo > 15 | ------ 16 | \ ^__^ 17 | \ (oo)\_______ 18 | (__)\ )\/\ 19 | ||----w | 20 | || || 21 | ``` 22 | 23 | ## Install 24 | Use [pipx](https://github.com/pipxproject/pipx) to install to isolated environment 25 | ``` 26 | pipx install pycowsay 27 | ``` 28 | or 29 | ``` 30 | pip install pycowsay 31 | ``` 32 | 33 | --- 34 | 35 | ``` 36 | >> pycowsay mooooo 37 | 38 | ------ 39 | < mooooo > 40 | ------ 41 | \ ^__^ 42 | \ (oo)\_______ 43 | (__)\ )\/\ 44 | ||----w | 45 | || || 46 | ``` -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | .PHONY: clean build publish 2 | 3 | build: clean 4 | python -m pip install --upgrade --quiet setuptools wheel twine 5 | python setup.py --quiet sdist bdist_wheel 6 | 7 | publish: build 8 | python -m twine check dist/* 9 | python -m twine upload dist/* 10 | 11 | clean: 12 | rm -r build dist *.egg-info || true -------------------------------------------------------------------------------- /man/pycowsay.6: -------------------------------------------------------------------------------- 1 | .TH PYCOWSAY 6 "12 October 2023" "0.0.0.1" 2 | .SH NAME 3 | pycowsay \- a talking cow 4 | .SH SYNOPSIS 5 | .SY pycowsay 6 | .OP \-\-help 7 | .OP \-\-version 8 | .RI [ message \&.\|.\|.]\& 9 | .YS 10 | .SH DESCRIPTION 11 | .B pycowsay 12 | generates an ASCII picture of a cow saying something provided by the user. The 13 | command-line arguments 14 | .I message 15 | are the cow's message. 16 | .SH OPTIONS 17 | .TP 18 | .BR \-\-help 19 | Print a help message and exit. 20 | .TP 21 | .BR \-\-version 22 | Display version information. 23 | .SH EXIT STATUS 24 | .B pycowsay 25 | always exits with status 0. 26 | .SH REPORTING BUGS 27 | Report bugs on 28 | .UR https://\:github.com/\:cs01/\:pycowsay/\:issues 29 | GitHub 30 | .UE . 31 | .SH COPYRIGHT 32 | Copyright (c) 2019-2023 Chad Smith. This program is distributed under the MIT 33 | license. See the file 34 | .I LICENSE 35 | distributed with this program for details. 36 | .SH SEE ALSO 37 | .BR cowsay (6) 38 | -------------------------------------------------------------------------------- /pycowsay/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cs01/pycowsay/b24b4d0fcf57f5d928c6c6811df8aebce0ba119a/pycowsay/__init__.py -------------------------------------------------------------------------------- /pycowsay/__main__.py: -------------------------------------------------------------------------------- 1 | from .main import main 2 | 3 | 4 | if __name__ == "__main__": 5 | main() 6 | -------------------------------------------------------------------------------- /pycowsay/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import sys 5 | from textwrap import dedent 6 | 7 | 8 | __version__ = "0.0.0.1" 9 | 10 | 11 | def main(): 12 | if "--version" in sys.argv[1:]: 13 | print(__version__) 14 | exit(0) 15 | elif "--help" in sys.argv[1:]: 16 | print("cowsay MESSAGE [MESSAGE]") 17 | exit(0) 18 | 19 | phrase = " ".join(sys.argv[1:]) 20 | topbar = "-" * len(phrase) 21 | bottombar = "-" * len(phrase) 22 | output = dedent( 23 | """ 24 | %s 25 | < %s > 26 | %s 27 | \ ^__^ 28 | \ (oo)\_______ 29 | (__)\ )\/\\ 30 | ||----w | 31 | || || 32 | """ 33 | % (topbar, phrase, bottombar) 34 | ) 35 | print(output) 36 | 37 | 38 | if __name__ == "__main__": 39 | main() 40 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | # For a fully annotated version of this file and what it does, see 5 | # https://github.com/pypa/sampleproject/blob/master/setup.py 6 | 7 | # To upload this file to PyPI you must build it then upload it: 8 | # python setup.py sdist bdist_wheel # build in 'dist' folder 9 | # python-m twine upload dist/* # 'twine' must be installed: 'pip install twine' 10 | 11 | 12 | import ast 13 | import io 14 | import re 15 | import os 16 | from setuptools import find_packages, setup 17 | 18 | DEPENDENCIES = [] 19 | EXCLUDE_FROM_PACKAGES = ["contrib", "docs", "tests*"] 20 | CURDIR = os.path.abspath(os.path.dirname(__file__)) 21 | 22 | with io.open(os.path.join(CURDIR, "README.md"), "r", encoding="utf-8") as f: 23 | README = f.read() 24 | 25 | 26 | def get_version(): 27 | main_file = os.path.join(CURDIR, "pycowsay", "main.py") 28 | _version_re = re.compile(r"__version__\s+=\s+(?P.*)") 29 | with open(main_file, "r", encoding="utf8") as f: 30 | match = _version_re.search(f.read()) 31 | version = match.group("version") if match is not None else '"unknown"' 32 | return str(ast.literal_eval(version)) 33 | 34 | 35 | setup( 36 | name="pycowsay", 37 | version=get_version(), 38 | author="Chad Smith", 39 | author_email="grassfedcode@gmail.com", 40 | description="", 41 | long_description=README, 42 | long_description_content_type="text/markdown", 43 | url="https://github.com/cs01/pycowsay", 44 | packages=find_packages(exclude=EXCLUDE_FROM_PACKAGES), 45 | include_package_data=True, 46 | keywords=[], 47 | scripts=[], 48 | entry_points={"console_scripts": ["pycowsay=pycowsay.main:main"]}, 49 | data_files=[("share/man/man6", ["man/pycowsay.6"])], 50 | zip_safe=False, 51 | install_requires=DEPENDENCIES, 52 | test_suite="tests.test_project", 53 | python_requires=">=3.6", 54 | # license and classifier list: 55 | # https://pypi.org/pypi?%3Aaction=list_classifiers 56 | license="License :: OSI Approved :: MIT License", 57 | classifiers=[ 58 | "Programming Language :: Python", 59 | # "Programming Language :: Python :: 3", 60 | # "Operating System :: OS Independent", 61 | # "Private :: Do Not Upload" 62 | ], 63 | ) --------------------------------------------------------------------------------