Sha256: b8f64177f44444e069e99f1111ffa241c9043a1ff69ce2e2ad18e06abf480e54
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
#!/usr/bin/env ruby require 'optparse' require 'methadone' require 'aka' require 'fileutils' class App include Methadone::Main include Methadone::CLILogging include Aka main do |aliasString,value| al = AliasList.new options.each do |key, value| debug("#{key} : #{value}") end al.backup if options[:backup] al.list if options[:list] al.showAll if options[:L] if options[:show] if aliasString == nil fatal("Needs an alias string to show the related command!") exit 64 end al.show aliasString end if options[:delete] al.empty elsif options[:add] if aliasString == nil || value == nil fatal("Both an alias and a value are required!") exit 64 end al.add(aliasString,value) elsif options[:remove] if aliasString == nil fatal("Alias is required for the remove operation!") exit 64 end al.remove(aliasString) end end # supplemental methods here # Declare command-line interface here description "Manage your aliases without editing dot files." on("-a", "--add", "Add a new alias") on("-l", "--list", "List all current aliases") on("-r", "--remove", "Remove the specified alias") on("-s", "--show", "Show what the specified alias does") on("-b", "--backup", "Create a backup copy of your alias file") on("-d", "--delete", "Delete all keys from your alias file") on("-L", "--list-all","Display all aliases and their associated commands.") arg :alias, :optional arg :value, :optional version Aka::VERSION use_log_level_option go! end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aka-0.5.4 | bin/aka |