Code Monkey home page Code Monkey logo

nincat's Introduction

             .,-:;//;:=,                
          . :H@@@MM@M#H/.,+%;,          
       ,/X+ +M@@M@MM%=,-%HMMM@X/,       
     -+@MM; $M@@MH+-,;XMMMM@MMMM@+-     
    ;@M@@M- XM@X;, -+XXXXXHHH@M@M#@/.   
  ,%MM@@MH ,@%=            .---=-=:=,.  
  =@#@@@MX .,              -%HX$$%%%+;  
 =-./@M@M$                  .;@MMMM@MM: 
 X@/ -$MM/                    .+MM@@@M$ 
,@M@H: :@:                    . =X#@@@@-
,@@@MMX, .                    /H- ;@M@M=
.H@@@@M@+,                    @MM+..%#$.
 /MMMM@MMH/.                  XM@MH; =; 
  /%+%$XHH@$=              , .H@@@@MX,  
   .=--------.           -%H.,@@@@@MX,  
   .%MM@@@HHHXX$$$%+- .:$MMX =M@@MM%.   
     =XMMM@MM@MM#H;,-+HMM@M+ /MMMX=     
       ,:+$+-,/H#MMMMMMMMM@= =,         
             =++%%%%+/:-.               

$ echo 'An useless but fun way to show text-based art!'

Let's revive the ASCII art!

Nincat is community-driven project that loads an ASCII art centred in your terminal.


Features:

  • Fast as it can be and lightweight.
  • Self adapt with the terminal size to print only ASCII arts that fit.
  • Supports any external program such as lolcat.
  • Supports HEX colour foreground/background arts and 256 colours, 88 colours, 16 colours.
  • Skip empty ASCII art files.
  • You can select an art directly (by option).
  • List all ASCII art's paths (by option).
  • Print the name of printed art (by option).
  • Modular folder containing the ASCII arts.

Installing

By Github

Click in Code in this repository and then Download ZIP. Extract it using your favourite tool and then in your terminal:

> cd PUT_HERE_THE_PATH_OF_NINCAT
> nincat random

By Git

From your terminal, you can clone in your preferred folder:

> git clone 'https://github.com/ninecath/nincat'
> cd nincat
> use ./nincat.nu
> nincat random

Tips

Loading when your terminal emulator open.

That is, when your shell is loaded. There are many shells out there, a very famous one is bash.

Anyway, all you need to do is add one line in your shell-r that runs nincat, then you'll be able to load it when the terminal opens :)

To verify what shell-rc you should have, run $env.SHELL or echo $SHELL (POSIX) in your terminal.

  • For zsh the rc is put in ~/.zshrc;
  • For bash the rc is put in ~/.bashrc;
  • For fish the config is put in ~/.config/fish/config.fish;
  • For nu the config is put in ~/.config/nushell/config.nu.
> nincat random

Creating ASCII/ANSI/TEXT-BASED art.

Tools that can be used to make easier this type of art can be found on Internet, here's a few of them:

Colours*

Give a look at this site for 256, 88, 16 colours in your ASCII arts. And obviously, you should utilize \033 instead of \e.

For RGB colours, I'd recommend this lecture-commentary.


Preview of one ASCII art with lolcat.

Contributing/Adding ASCII arts:

File names are made in this format: <name-of-art>. The spaces are important since we use them to rule out what arts should be printed.

The art files are put in the /assets/. You can make a separate folder to add your own arts. Of course, update the list after with:

$ nincat setup

Please, do not fill all the lines with spaces to close all columns. A good and simple example should be: And do not use tabs, instead you should use spaces.

# Your wonderful username/name and/or extra information about authority (author).
   (   )
: ) o_o ( :

Please, contribute!

It would be lovely that for every art you add, you add it here, too! Remember to put your name in the first line, so your contribution is never forgotten :)

  • By Github's Pull Request (recommended)

Clone this project, add your art in a file in either manually with Github or with git, then send a pull request here comparing both branches.

  • By Github's Issue

Create a new issue in the New art type of issue and put your art there.


Dependencies:

  • nushell

Acknowledgements:

You can find alternatives in the web, here are some with their initial commits:


GPL3 License

nincat's People

Contributors

beyondmagic avatar codesofrishi avatar dam-buty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

dam-buty

nincat's Issues

grep: invalid option -- P

On MacOS, every time I run the command, it gives an error message like this (while still working, just a little bit annoying to see warning).

image

Webpage to create arts for nincat

It's hard to create arts with lots of escape characters in the terminal.

The solution is to build a site to create arts for no colours, 16, 88, 256 and RGB, just with the colours and then when the user wants, it would share the output code.

Two options with this, either a:

terminal app.
very simple JS + HTML site, preferably, without any framework.

I'll pin this because it's very important to help creating new arts.

TO-DO v5.0

  • --add RETREATED: Add art from file directly from nincat script and removes fix_arts script.
    • It is better let the user solve this actually, as it is just the creation of a single file...
  • --random --center print the art at the center of the terminal screen.
  • --random --left RETREATED: print the art at the left of the terminal screen. Makes this the default.
    • As default, by choosing no option, it will just print on the left.
  • --random --right print the art at the right of the terminal screen.
  • --view $1 --match RETREATED: enhancement to select file matching the same name. If multiple, just warns and exit.
    • Replaced by nincat --view "$(nincat --list | grep 'query')"
  • --view $1 --raw print the first line as well.
  • Resolve unnecessary escape handling at the last character of the very last line when finished with \. Could be fixed at the sed call of print_file function or adding a new space there before adding the reset colouring.
  • RETREATED: Remove NOTES numbers to instead hash so that adding new code isn't tiresome.
    • No idea how to organize shell code better than this.
  • --random --raw instead of --random --see and print the first line as well.

All of those features can be added without any loss to performance or speed.

ANSI characters displayed as strings

  • bash 5.1.12
  • terminator 2.1.1:
  • xterm-256color

Steps to Reproduce the Problem

Run nincat --random --center in terminal or in .bashrc . ANSI special characters are displayed as string such as \033[1m.

Log

image

> printf "C: $(tput cols)\nR: $(tput lines)\n"
C: 84
R: 26

TO-DO v6.0

  • Arts that need an external program such as lolcat now need to specify a prefix on the folder name.

All of those features can be added without any loss to performance or speed.

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.