Sha256: 51572f850e5547e4f72f999737340cbfb9aee1f22cc9bf549bb49dd125d1e0dd
Contents?: true
Size: 1.88 KB
Versions: 2
Compression:
Stored size: 1.88 KB
Contents
#!/usr/bin/env ruby require 'optparse' require 'methadone' require 'aka' require 'fileutils' require 'yaml' class App include Methadone::Main include Methadone::CLILogging include Aka main do |aliasString,value| al = AliasList.new options["alias-file"] #options.each do |key, value| # debug("#{key} : #{value}") #end al.backup if options[:backup] al.list if options[:list] al.showAll if options[:L] al.change_defaults 'random', options[:D] if options[:D] 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 commands.") on("--alias-file FILENAME","Create and use a new alias file.") #on("-D NEW", "Create a random default value for testing purposes.") defaults_from_config_file '.aka' 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.6.0 | bin/aka |
aka-0.5.8 | bin/aka |