Sha256: faafa0c828c84ed83cd0a1a20888021b345d0363ba65b62cb0cc04ca9a365a92
Contents?: true
Size: 1.61 KB
Versions: 9
Compression:
Stored size: 1.61 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__)) require 'paint' require 'color' require 'pedrozath-mercenary' require 'coltrane/commands' if ENV['COLORTERM'] == 'truecolor' Paint.mode = 0xFFFFFF else Paint.mode = 0 puts "This terminal doesn't seem to support true color. " \ "Try something like iTerm2 (for macOS), VTE or Konsole (for linux) or Hyper" \ " (for Windows) and you'll see the true magic!" end Mercenary.program(:Coltrane) do |p| p.version Coltrane::VERSION p.description <<~DESC A music querying interface by Pedro Maciel (pedro@pedromaciel.com) Check the chat room for project help/discussion/contribution: https://coltrane-ruby.herokuapp.com DESC p.syntax 'coltrane <subcommand> [options]' Coltrane::Commands::Command.subclasses.each do |command| command.mercenary_init(p) end p.command(:about) do |c| c.description 'Shows this screen' c.action { puts p } end p.command(:shell) do |c| c.description 'Starts an interactive shell' c.action do system File.expand_path('../../bin', __FILE__) + "/coltrane-interactive" end end p.command(:help) do |c| c.description 'May give you some help.' c.syntax 'help <command> [subcommand, sub-subcommand, ...]' c.action do |(*command_path), _options| if command_path.empty? puts p else puts begin command_path.reduce(p) do |memo, key| memo.commands.delete(key.to_sym) end || "\n Sorry, command found." end end end end p.default_command(:shell) end
Version data entries
9 entries across 9 versions & 1 rubygems