diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2020-11-23 15:44:42 +0000 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2020-11-23 15:44:42 +0000 |
commit | 1264269f3bf0825b89fac38e65e6989fdb9eba1b (patch) | |
tree | 015e49bbc2873a9f969d0a651d7bb1f7e593325c | |
parent | 1b3800a46bc789100db2cbab8df9560cbf15cb13 (diff) |
more work
-rw-r--r-- | tw_hooks/scratch.pl | 15 | ||||
-rw-r--r-- | tw_hooks/scratch_test.pl | 5 | ||||
-rw-r--r-- | tw_hooks/simple_test.t | 7 |
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"); |