aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authormms <git@sapka.me>2024-11-19 21:50:07 +0100
committermms <git@sapka.me>2024-11-19 21:50:07 +0100
commit64ab548e16fdc8fa862e2b432464f3d67f5d9db8 (patch)
tree75c8e273d47eb54af67da5c6299876601f054e93 /bin
parent8004fd7f9fc91ce9ec02b1b8e8eac639b17d0eb8 (diff)
feat: allow for --new param
Diffstat (limited to 'bin')
-rwxr-xr-xbin/chotto16
1 files changed, 13 insertions, 3 deletions
diff --git a/bin/chotto b/bin/chotto
index 61cfc75..1998af5 100755
--- a/bin/chotto
+++ b/bin/chotto
@@ -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)