From 64ab548e16fdc8fa862e2b432464f3d67f5d9db8 Mon Sep 17 00:00:00 2001 From: mms Date: Tue, 19 Nov 2024 21:50:07 +0100 Subject: feat: allow for --new param --- bin/chotto | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'bin') 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) -- cgit v1.2.3