lib/augury/cli.rb in augury-1.0.3 vs lib/augury/cli.rb in augury-1.1.0

- old
+ new

@@ -14,11 +14,11 @@ desc: 'The maximum number of columns that will be written on a line. DEFAULT: 72' option :append, type: :boolean, aliases: '-a', - desc: 'If set, the target path will be appended to instead of overwritten' + desc: 'If set, the target path will be appended to instead of overwritten. DEFAULT: false' option :count, type: :numeric, aliases: '-c', desc: 'The number of tweets to get. Set to 0 to get all. DEFAULT: 200' @@ -36,15 +36,25 @@ option :links, type: :boolean, aliases: '-l', desc: 'Include tweets with links in them. DEFAULT: false' + option :remove_links, + type: :boolean, + aliases: '--remove-links', + desc: 'Remove links from tweets. DEFAULT: false' + option :attribution, type: :boolean, aliases: '-A', desc: 'Add an author attribution to each fortune. DEFAULT: false' + option :apply_transforms, + type: :boolean, + aliases: '-t', + desc: 'Apply transforms from config file. DEFAULT: false' + def generate(username, *path) path = File.expand_path(path[0] || username) augury = Augury::Fortune.new(username, path, options) augury.twitter_setup augury.retrieve_tweets @@ -61,23 +71,21 @@ def options original_options = super defaults = Thor::CoreExt::HashWithIndifferentAccess.new( { width: 72, - append: false, count: 200, - retweets: false, - replies: false, - links: false, - attribution: false, }, ) config_path = File.expand_path(ENV.fetch('AUGURY_CFG_PATH', '~/.augury.yml')) if File.file?(config_path) config_options = Thor::CoreExt::HashWithIndifferentAccess.new(YAML.load_file(config_path) || {}) defaults = defaults.merge(config_options) end + + # Enforce implied options + defaults[:links] = true if original_options[:remove_links] || defaults[:remove_links] Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options)) end end end