diff options
author | mms <git@sapka.me> | 2024-11-19 21:50:07 +0100 |
---|---|---|
committer | mms <git@sapka.me> | 2024-11-19 21:50:07 +0100 |
commit | 64ab548e16fdc8fa862e2b432464f3d67f5d9db8 (patch) | |
tree | 75c8e273d47eb54af67da5c6299876601f054e93 /bin | |
parent | 8004fd7f9fc91ce9ec02b1b8e8eac639b17d0eb8 (diff) |
feat: allow for --new param
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/chotto | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -1,14 +1,24 @@ #!/usr/bin/env ruby # frozen_string_literal: true +require 'optparse' require_relative '../lib/chotto' CONFIG_FILEPATH = 'chotto/config.rb' XDG_HOME = ENV.fetch('XDG_CONFIG_HOME', "#{Dir.home}/.config") -def start_chotto +def start_chotto(options) config_file = File.read("#{XDG_HOME}/#{CONFIG_FILEPATH}") instance_eval(config_file) - eval_rules + eval_rules(options) end -start_chotto +options = {} +OptionParser.new do |opts| + opts.banner = 'Usage: chotto [options]' + + opts.on('-n', '--new', 'Run only for new mesages') do |v| + options[:only_new] = v + end +end.parse! + +start_chotto(options) |