Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

dinosay is a humble, simple, nice and paleolithic alternative to cowsay.

License

NotificationsYou must be signed in to change notification settings

MatteoGuadrini/dinosay

Repository files navigation

dinosay

Codacy BadgeCircleCI

dinosay is a humble, simple, nice and paleolithic alternative tocowsay.

How did the idea come about?

The idea came from my two children.To make them learn the syllables and then how to assemble them to form words,I used cowsay on my terminal, so that they learned while having fun.One day, they asked me: "Dad, isn't there a way to make a dinosaur talk too?" (both are dinosaur fans, like me).So I usedcowsay -f ~/dinosaur.cow, but I made a very simple one.The next day, I thought about how to reproduce it in python (my primary programming language) and opened this project.

Differences

dinosay is an alternative and not a replacement. The library is not meant to be cowsay's rewrite.If you are looking for this then you need to go topycowsay.

Features

dinosay implements most of the functionality of cowsay, adding freedom in the individual elements.For example, you can add thetongue element or replace the eyes by specifying theeye parameter.If you have suggestions or new implementations, or you are an ASCII designer and would like your template to be addedto the dinosaur library, open anissue using thedinosay-enhancement issue template,attaching your creation if possible. Below you will find instructions for building your template.

Installation

Unlike its cousin cowsay,dinosay is written in python.

dinosay can be used on the command line or as a python module, to give a dinosaur touch!

For install package, see below:

$pip install dinosay# for python enviroment$dnf coprenable matteoguadrini/dinosay$dnf install python-dinosay -y# for Red Hat, CentOS, Mageia and fedora$wget https://github.com/MatteoGuadrini/dinosay/releases/download/<version>/dinosay-<version>-1.noarch.rpm -O dinosay.rpm$yast -i dinosay.rpm# for SLES and OpenSUSE$apt-get install alien# for debian based and ubuntu based, see here$alien -i dinosay.rpm$git clone https://github.com/MatteoGuadrini/dinosay.git&&cd dinosay$python setup.py install# for other

Command line

From the command line,dinosay looks like this:

$dinosay --helpusage: dinosay [-h] [--version] (-d DINOSAUR | -r | -f FILE | -l) [-c COLOR] [-b BEHAVIOR] [-i]               [-t] [-e EYE] [-w WRAP]               [message]print messages via ASCII dinosaurspositional arguments:  message               message to printoptional arguments:  -h, --help            show this help message and exit  --version, -v         show program's version number and exit  -d DINOSAUR, --dinosaur DINOSAUR                        dinosaur to print  -r, --random          random dinosaur to print  -f FILE, --file FILE  file containing ASCII to print  -l, --list            list of all dinosaurs and parts  -c COLOR, --color COLOR                        color dinosaur  -b BEHAVIOR, --behavior BEHAVIOR                        behavior of dinosaur  -i, --idea            idea's speech bubble  -t, --tongue          shape of the tongue  -e EYE, --eye EYE     shape of the eye  -w WRAP, --wrap WRAP  length of the message _____     __     __   __     ______     ______     ______     __  __/\  __-.  /\ \   /\ "-.\ \   /\  __ \   /\  ___\   /\  __ \   /\ \_\ \\ \ \/\ \ \ \ \  \ \ \-.  \  \ \ \/\ \  \ \___  \  \ \  __ \  \ \____ \ \ \____-  \ \_\  \ \_\\"\_\  \ \_____\  \/\_____\  \ \_\ \_\  \/\_____\  \/____/   \/_/   \/_/ \/_/   \/_____/   \/_____/   \/_/\/_/   \/_____/$dinolistDINOSAY list elements and dinosaurs===================================DINOSAURS - ALIAS:          BEHAVIOR:      EYE:                 COLORS:- tyrannosaurus - trex      - normal       - classic:  O O      - purple- dimetrodon - dim          - happy        - borg:     = =      - cyan- ankylosaur - anky         - joking       - stoned:   * *      - darkcyan- hypsilophodon - hypsi     - lazy         - glass:    0-0      - blue- stegosaurus - stego       - tired        - hypno:    @ @      - green- deinonychus - deino       - nerd         - rage:     ° °      - yellow- pterodactyl - ptero       - cyborg       - ko:       x x      - red- archaeopteryx - archa     - dead         - happy:    ^ ^      - default- maiasaur - maia           - trance       - closed:   - -- pleisiosaur - plei        - stoned- brachiosaur - brachio- corythosaur - cory- parasaurolophus - para- triceratops - trice

Python module

Instead, using it as a python module, we'll do it like this:

fromdinosayimportdinoprint,DINO_TYPEmsg="Hi, I'm dinosay!"dinoprint(msg,DINO_TYPE['tyrannosaurus'])

Or like this:

fromdinosayimportdinostring,DINO_ALIASmsg="Hi, I'm dinosay!"returndinostring(message,DINO_ALIAS['brachio'],'happy')

Custom template

If you want to build a custom template to parse to cowsay'sfile parameter, then you should follow these guidelines.

The template will have to use ASCII characters, and can use some substitution variables.The variables are included in this table:

NameDescription
$comicVariable indicating the positioning of the message to be printed. IMPORTANT! if it is missing, the message will NOT be printed.
$eyesVariable indicating the substitution characters of the eyes. The pattern must be the following:character-space-character.
$eyeSame as$eyes but only prints the first character, so it represents a single eye.
$tongueVariable indicating language substitution characters. It can be single, or multiple, for example\_\.

Simple template example

This is a simple template:

$cat<<EOF >> /tmp/trex.ascii                             $comic                                        O_                                       /  >                                      -  >   ^\                                     /   >  ^ /                                    ($eye)  > ^ /   / / /       _____                        |            \\|//      /  __ \                      _/      /     / _/     /  /  | |                    /       /     / /   _/  |___/ /                  _/      ------_/ / ==_|  \____/                 _/       /  ______/     \   \                 __/           |\      |   \_          ____/              / \      _       \    \________/                  |\  \----/_V        \_                              / \_______ V          \__                /       \ /          V             \               \        \              \______         \_       \                     \__________\_      \                        /    /    \_    |                       |   _/       \   |                      /  _/          \  |                     |  /            |  |                     \  \__          |   \__                     /\____=\       /\_____=\EOF$dinosay -f /tmp/trex.ascii -e happy"I'm a crazy dinosaur"

Open source

dinosay is a open source project. Any contribute, It's welcome.

A great thanks.

For donations, press this

For me

paypal

ForTelethon

The Telethon Foundation is a non-profit organization recognized by the Ministry of University and Scientific and Technological Research.They were born in 1990 to respond to the appeal of patients suffering from rare diseases.Come today, we are organized to dare to listen to them and answers, every day of the year.

Telethon

Adopt the future

Acknowledgments

Thanks to Mark Lutz for writing theLearning Python andProgramming Python books that make up my python foundation.

Thanks to Kenneth Reitz and Tanya Schlusser for writing theThe Hitchhiker’s Guide to Python books.

Thanks to Dane Hillard for writing thePractices of the Python Pro books.

Special thanks go to my wife, who understood the hours of absence for this development.Thanks to my children, for the daily inspiration they give me and to make me realize, that life must be simple.

Thanks Python!


[8]ページ先頭

©2009-2025 Movatter.jp