Commits

Richo Healey  committed 95e718e

Support for deletions

  • Participants
  • Parent commits d7b2ddf

Comments (0)

Files changed (4)

 
 module Twat
   VERSION_MAJOR = 0
-  VERSION_MINOR = 1
+  VERSION_MINOR = 2
   VERSION_PATCH = 0
 
   VERSION = "#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_PATCH}"

File lib/twat/actions.rb

       cf.save!
     end
 
+    def delete(opts)
+      if cf.delete(opts[:account])
+        cf.save!
+        puts "Successfully deleted"
+      else
+        puts "No such account"
+      end
+    end
 
     private
 

File lib/twat/argparse.rb

           options[:account] = acct.to_sym
           options[:action] = :add
         end
+        opts.on('-d', '--delete ACCOUNT', 'Delete ACCOUNT') do |acct|
+          options[:account] = acct.to_sym
+          options[:action] = :delete
+        end
         #opts.on( '-a' '--add ACCOUNT' ) do |acct|
         #end
         opts.on('-h', '--help', 'Display this screen') do

File lib/twat/config.rb

       config[key] = value
     end
 
+    def delete(key)
+      config.delete(key)
+    end
+
     def self.consumer_info
       {
         consumer_key: "jtI2q3Z4NIJAehBG4ntPIQ",