Sha256: 8e6353be33a3fad06f7a09c7456adf3bb04369542af94bfd78574dbffec1ca91
Contents?: true
Size: 1.38 KB
Versions: 3
Compression:
Stored size: 1.38 KB
Contents
# frozen_string_literal: true require 'artii' require 'asciiart' require 'optparse' module Ascuchiii def self.words [ 'P A U L O', 'C U C H I', 'P A U L O C U C H I', 'L A G E S' ] end def self.images [ 'default-cuchi-with-hat.jpeg' ] end def self.url # It will be kinda tricky to make it work with images bundled together with the gem # so let's just use a static one hosted at the repo 'https://github.com/kammradt/ascuchiii/blob/master/lib/images' end def self.parse_img_args default_image_args = { width: 50, color: true } OptionParser.new do |parser| parser.on('-w [WIDTH]', '--width [WIDTH]', 'Cuchi image WIDTH. Default: 50. Ex ascuchiii -w 200', Integer) parser.on('-c [COLOR]', '--color [COLOR]', 'Should render with image with colors. Default: true. Ex: ascuchiii -c (with color/true) | ascuchiii -c false (without color/false)') do |color| # `color.nil?` verifies if the input is just `-X` (considered true). # If -X has an argument, convert it to bool default_image_args[:color] = color.nil? || color.to_s == 'true' end end.parse!(into: default_image_args) default_image_args end def self.show Artii::Base.new.asciify(words.sample) AsciiArt.new("#{url}/#{images.sample}?raw=true").to_ascii_art(parse_img_args) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ascuchiii-2.0 | lib/ascuchiii.rb |
ascuchiii-1.3 | lib/ascuchiii.rb |
ascuchiii-1.2 | lib/ascuchiii.rb |