aboutsummaryrefslogtreecommitdiff
path: root/start.rb
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2019-08-04 02:21:22 +0200
committerKatharina Fey <kookie@spacekookie.de>2019-08-04 02:21:22 +0200
commit7fd0a464821aa9ad9ef0d5a16d0bedecdf83c542 (patch)
tree709326434d2ec2f1cd1f872f04899852401b2dc8 /start.rb
parentc951ce7fa7aafc01997599e8ebd694c5a1178a09 (diff)
First functional version
Has a few problems: - Doesn't properly indent entries - Only processes _first_ open account - Doesn't catch enough errors - CLI parsing sucks
Diffstat (limited to 'start.rb')
-rw-r--r--start.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/start.rb b/start.rb
new file mode 100644
index 0000000..3ec3c48
--- /dev/null
+++ b/start.rb
@@ -0,0 +1,25 @@
+"""
+This file is part of cassiopeia and licensed
+under the GNU Public License 3.0 (or later)
+
+cassiopeia-start - start working on an account
+
+This file is included and run from cass(1)
+"""
+
+require "time"
+require_relative "time_util"
+
+def start(account, round, file = [])
+ rel = file.select { |i| i[:title].to_s.include? account }
+
+ # This is a kind of fuzzy find
+ account = rel[0][:title].to_s[0..-2]
+
+ # Check if there's any ling jobs
+ jobs = rel.select { |i| i[:stop] == nil }.length
+ STDERR.puts \
+ "[Warn]: #{jobs} dangling jobs for account #{account}" if jobs > 0
+
+ "#{account}: #{round ? Time.now.round : Time.now} - "
+end