Sha256: e24189804956578b3438dbf615e1ba520cc8c993567dcbfdb53bc33993ade209
Contents?: true
Size: 860 Bytes
Versions: 45
Compression:
Stored size: 860 Bytes
Contents
#! /usr/bin/env ruby script = ARGV[0] if script.nil? puts "\e[94mThis is a tool for discorb. Currently these tools are available:\e[m" discorb_path = $:.find { |path| File.directory?(path + "/discorb") } scripts = {} Dir.glob(discorb_path + "/discorb/exe/*.rb") do |script| name = File.basename(script, ".rb") description = File.read(script).match(/# description: (.+)/)&.[](1) || "No description" scripts[name] = description end max_length = scripts.keys.map { |key| key.length }.max scripts.sort.each do |name, description| puts "\e[90m#{name.rjust(max_length)}\e[m - #{description}" end puts "\e[94m\nTo run a tool, type:\e[m\n" + "\e[34m discorb [script]\e[m" exit 1 end begin require "discorb/exe/#{script}" rescue LoadError puts "\e[91mThis tool is not available: \e[90m#{script}\e[m" exit 1 end
Version data entries
45 entries across 45 versions & 1 rubygems