aboutsummaryrefslogtreecommitdiff
path: root/exe
diff options
context:
space:
mode:
authormms <git@sapka.me>2024-11-28 12:41:29 +0100
committermms <git@sapka.me>2024-11-28 12:41:29 +0100
commitedb47d1dbdacc439ddb1fae7ce7ffa1b4b5b7738 (patch)
treee7be84b775ad7725b1f278eb9472227147562623 /exe
parent1354fcfd222a922762999cd6a97dfe5845d4f835 (diff)
fix: properly set the executable in gemspecHEAD0.1.1master
bump required respec
Diffstat (limited to 'exe')
-rwxr-xr-xexe/chotto28
1 files changed, 28 insertions, 0 deletions
diff --git a/exe/chotto b/exe/chotto
new file mode 100755
index 0000000..0d6116f
--- /dev/null
+++ b/exe/chotto
@@ -0,0 +1,28 @@
+#!/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(options)
+ Chotto.configure do
+ config.only_new = options.fetch(:only_new, false)
+ end
+
+ config_file = File.read("#{XDG_HOME}/#{CONFIG_FILEPATH}")
+ instance_eval(config_file)
+ eval_rules(options)
+end
+
+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)