• Stars
    star
    14
  • Rank 1,392,668 (Top 29 %)
  • Language
    Crystal
  • License
    MIT License
  • Created almost 4 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tiny tool to make your CLI output 🌈 coloured

climate.cr CI Releases License

Small helper utility to make your CLI program output 🌈 coloured by means of configurable markup styles. Think of it as your CLI-mate :)

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      climate:
        github: Sija/climate.cr
  2. Run shards install

Usage

require "climate"

message = "Usage: {#{PROGRAM_NAME}} <required-arg> [optional-arg]"

# you can call `Climate.parse` method directly
puts Climate.parse(message)

# or use a `String#climatize` extension
puts message.climatize

Defaults

Default styles are:

  • <> colored in green (keeping delimiters)
  • [] colored in yellow (keeping delimiters)
  • {} colored in blue (hiding delimiters)
  • !¡ colored in red (hiding delimiters)

Configuration

You can change the global settings with a #configure block:

Climate.configure do |settings|
  # use defaults
  settings.use_defaults!

  # and/or configure your own styles
  settings.styles << Climate::Style.new(
    delimiters: {'?', '¿'},
    keep_delimiters: false,
    colors: {
      fore: :magenta,
      back: :default,
    },
    decoration: :bold
  )
end

For the colors and decoration reference values see documentation for the Colorize module (which Climate uses under the hood).

Contributing

  1. Fork it (https://github.com/Sija/climate.cr/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

More Repositories

1

garb

A Ruby wrapper for the Google Analytics API
Ruby
147
star
2

raven.cr

Raven is a Crystal client for Sentry
Crystal
120
star
3

debug.cr

Debug macro for Crystal
Crystal
92
star
4

ipaddress.cr

A Crystal library to handle IPv4 and IPv6 addresses in a modern and productive way.
Crystal
43
star
5

retriable.cr

Retriable.cr is a simple DSL to retry failed code blocks
Crystal
38
star
6

any_hash.cr

Better JSON::Any for Crystal
Crystal
33
star
7

blurhash.cr

A pure Crystal implementation of BlurHash algorithm
Crystal
22
star
8

backtracer.cr

Crystal shard aiming to assist with parsing backtraces into a structured form.
Crystal
16
star
9

ksuid.cr

Crystal implementation of K-Sortable Globally Unique IDs
Crystal
16
star
10

crystal-dash-docset

Dash docset generator for Crystal
Shell
16
star
11

gphoto2.cr

Crystal shard wrapping libgphoto2
Crystal
15
star
12

serialport.cr

Crystal bindings for libserialport: cross-platform library for accessing serial ports.
Crystal
12
star
13

base62.cr

Base62 encoder/decoder for Crystal
Crystal
10
star
14

crystal-environment

Crystal::Environment
Crystal
7
star
15

gphoto2-web

Web API for libgphoto2
Crystal
6
star
16

gitbook2pdf

CLI utility to turn a published GitBook website into a collection of PDFs for offline reading
JavaScript
3
star
17

Gizmo

Quick'n'easy file based content management system
PHP
2
star
18

jsonl.cr

Crystal shard for handling JSONL (JSON Lines) parsing
Crystal
1
star
19

Sija

1
star
20

coffeeshop

Unfinished Coffee powered, Express based framework for Node.js
CoffeeScript
1
star
21

kPilot.w3

Web backend for kPilot Konnekt IM plugin.
PHP
1
star
22

markdown

PSR-0 compliant Markdown library
PHP
1
star
23

seedling

Rails 3 plugin for a database-independent YAML seeds import/export.
Ruby
1
star
24

MazeSolver

Maze solver written in PHP 5.
PHP
1
star
25

kZmieniacz

kZmieniacz to wtyczka dla komunikatora Konnekt pozwalająca zmieniać status opisowy jednocześnie we wszystkich wykorzystywanych sieciach.
C++
1
star
26

photoindex

Ancient, self-contained php gallery script.
PHP
1
star
27

resque-dry

Ruby
1
star
28

swift

Never finished C++ templating engine.
C++
1
star
29

kulturadaru

PHP
1
star
30

smartypants

PSR-0 compliant Smartypants library
PHP
1
star
31

kAway

Away system for the Konnekt IM
C++
1
star
32

git-rewrite-author

CLI tool for rewriting author/committer history of a git repository
Crystal
1
star
33

QRKit

QR Reader in Objective C ported from zxing
C++
1
star
34

thumb-cutter

Blazingly fast thumb cutting and image juggling middleware for any node/express.js kitchen sink
JavaScript
1
star
35

sunspot_resque

Sunspot-Resque Session Proxy
Ruby
1
star
36

jquery.clamp

JavaScript with CSS "overflow: ellipsis" line clamping, as jQuery plugin and standalone AMD module
CoffeeScript
1
star