Git Product home page Git Product logo

cowsay-python's Introduction

cowsay codecov Codacy Badge PyPI - Python Version Github
Downloads Downloads Downloads

Introduction

A python API / Command-line tool for the famous linux cowsay.
Take a look at CHANGELOG.md for the changes.

Brief History

cowsay for GNU/Linux was initially written in perl by Tony Monroe. More info here.

Installation

pip install cowsay

API Usage

>>> import cowsay

>>> cowsay.cow('Hello World')
 ___________
| Hello World |
  ===========
           \
            \
              ^__^
              (oo)\_______
              (__)\       )\/\
                  ||----w |
                  ||     ||


>>> print(cowsay.get_output_string('cow', 'Hello World'))
  ___________
| Hello World |
  ===========
           \
            \
              ^__^
              (oo)\_______
              (__)\       )\/\
                  ||----w |
                  ||     ||


>>> cowsay.cow('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris blandit rhoncus nibh. Mauris mi mauris, molestie vel metus sit amet, aliquam vulputate nibh.')
  _________________________________________________
 /                                                 \
| Lorem ipsum dolor sit amet, consectetur adipiscin |
| g elit. Mauris blandit rhoncus nibh. Mauris mi ma |
| uris, molestie vel metus sit amet, aliquam vulput |
| ate nibh.                                         |
 \                                                 /
  =================================================
                                                 \
                                                  \
                                                    ^__^
                                                    (oo)\_______
                                                    (__)\       )\/\
                                                        ||----w |
                                                        ||     ||


>>> my_fish = r'''
\
 \  
        /`路.赂
     /赂...赂`:路
 赂.路麓  赂   `路.赂.路麓)
: 漏 ):麓;      赂  {
 `路.赂 `路  赂.路麓\`路赂)
     `\\麓麓\赂.路麓
'''

>>> cowsay.draw('Sharks are my best friend', my_fish)
  _________________________
| Sharks are my best friend |
  =========================
                         \
                          \  
                                 /`路.赂
                              /赂...赂`:路
                          赂.路麓  赂   `路.赂.路麓)
                         : 漏 ):麓;      赂  {
                          `路.赂 `路  赂.路麓\`路赂)
                              `\\麓麓\赂.路麓

Command Line Usage

$ cowsay -t "Hello World"
  ___________
| Hello World |
  ===========
           \
            \
              ^__^
              (oo)\_______
              (__)\       )\/\
                  ||----w |
                  ||     ||


$ cowsay -t "Hello World" -c "tux"
  ___________
| Hello World |
  ===========
                \
                 \
                  \
                   .--.
                  |o_o |
                  |:_/ |
                 //   \ \
                (|     | )
               /'\_   _/`\
               \___)=(___/

More Characters

>>> cowsay.char_names
['beavis', 'cheese', 'cow', 'daemon', 'dragon', 'fox', 'ghostbusters', 'kitty',
'meow', 'miki', 'milk', 'octopus', 'pig', 'stegosaurus', 'stimpy', 'trex', 
'turkey', 'turtle', 'tux']


>>> cowsay.char_funcs
{'beavis': <function func at 0x104b734c0>, 
'cheese': <function func at 0x104d285e0>, 
...
'tux': <function func at 0x104d28f70>}


>>> len(cowsay.chars)
19

Contributing

Guide: CONTRIBUTING.md

cowsay-python's People

Contributors

cs01 avatar dependabot[bot] avatar gsornsen avatar gurashish1singh avatar juftin avatar marcusesa avatar oscar-defelice avatar scotthaleen avatar shockwavenn avatar sparrow242 avatar stefan-matic avatar vaasudevans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cowsay-python's Issues

Custom characters feature!

A cool feature that allows users to create their own custom characters and send them to get_output_string() and be able to see their messages being poped up by their custom-designed characters. Like a make such a thing:

my_worm = r'''
\
  \  _
    ("\
     ) )
    ( /
'''
print(cowsay.get_output_string(my_worm 'So much dust here..'))

Include methods that output cowsay as a string return value

I believe this project would benefit from providing some means of outputing cowsay as a string return value. For example, in my fork, cowsay.cow would return a string instead of printing to the console.

My fork: 24352a7

The reason I did that is so my discord bot can send cowsays in chats.

The ascii art is not alignd in Python command line?

I have an issue about cowsay 2.0 in python锛宼he ascii art is not alignd in Python command line. Like the picture below:

  • OS version: Microsoft Windows 10 version 1803
  • Python version:Python 3.7.2
  • cowsay version: cowsay.about() version ---> 2.0

pic_0129210255
pic_0129210307
pic_0129210319

PyPI version?

You granted me access to push updates to the cowsay PyPI package, and I uploaded v2.0 about 5 months ago. Lots of demos in https://github.com/pipxproject/pipx depend on cowsay. Recently it looks like v2.0 was erased. Should I stop relying on this version and just start a new one? cowsay is nice as a "hello world" package to test that tools are working, so hopefully it can remain with a valid console entry point.

Please support piping into cowsay!

It would be great if cowsay command-line tool supported piping into it, eg.

echo Hello, world! | cowsay

As a simple way to implement it, you could use a different command-line switch (eg. -c or --) for pipe input, or syntax like -t -

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google 鉂わ笍 Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.