Sha256: f62a52fa670d5b7fc86e919977851eeb38926c7ae585204b6831d3e6b62ffdf4
Contents?: true
Size: 1.51 KB
Versions: 2
Compression:
Stored size: 1.51 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] 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") arg :alias, :optional arg :value, :optional version Aka::VERSION use_log_level_option go! end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aka-0.5.2 | bin/aka |
aka-0.5.1 | bin/aka |