aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tw_hooks/scratch.pl15
-rw-r--r--tw_hooks/scratch_test.pl5
-rw-r--r--tw_hooks/simple_test.t7
3 files changed, 25 insertions, 2 deletions
diff --git a/tw_hooks/scratch.pl b/tw_hooks/scratch.pl
index bb3443f..8aa5e5b 100644
--- a/tw_hooks/scratch.pl
+++ b/tw_hooks/scratch.pl
@@ -34,13 +34,24 @@ if ($decoded_task->{scheduled} and (scalar grep {$_ eq "dft" } @{$tags})) {
my $time = $scheduled_dt->hms();
# Convert it into Remind format
my $remind_line = "REM $date $month $year AT $time $original_description";
- print $remind_line;
+
+ # Log into remote server
+
+ my $host = "192.168.122.184";
+ my $user = "lemon";
+
+ my $ssh = Net::OpenSSH->new($host, user => $user);
+ $ssh->error and die "Couldn't establish SSH connection: " . $ssh->error;
+
+ $ssh->system({stdin_data => $remind_line}, "cat >> ~/.reminders/work.rem") or die "Cannot append text: " . $ssh->error;
+
+ print $decoded_task;
+
} else {
print encode_json $decoded_task;
}
-# Log into remote server
# Check for presece or remind file
# If it is there, back it up
# Append the Remind formatted line to the original remind file
diff --git a/tw_hooks/scratch_test.pl b/tw_hooks/scratch_test.pl
new file mode 100644
index 0000000..7473b19
--- /dev/null
+++ b/tw_hooks/scratch_test.pl
@@ -0,0 +1,5 @@
+use strict;
+use warnings;
+
+use Test::Simple tests => 2;
+
diff --git a/tw_hooks/simple_test.t b/tw_hooks/simple_test.t
new file mode 100644
index 0000000..5306a9b
--- /dev/null
+++ b/tw_hooks/simple_test.t
@@ -0,0 +1,7 @@
+use strict;
+use warnings;
+
+use Test::Simple tests => 2;
+
+ok(2+2==4, "Addition of two numbers");
+ok(6-4==3, "Subtraction of two numbers");