summary refs log tree commit diff stats
path: root/draco.pl
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-11-20 10:21:58 +0530
committerAndinus <andinus@nand.sh>2020-11-20 10:21:58 +0530
commit56e880f5028d9f1892d1af28007ab6a7108ad977 (patch)
treec4197d49ad23775394753d76b2a11c32ae241d1c /draco.pl
parent61266c6e9a39a75875531dfb24852b6e9eef6f1a (diff)
downloaddraco-56e880f5028d9f1892d1af28007ab6a7108ad977.tar.gz
Add debug option, bump version to v0.1.3 v0.1.3
Diffstat (limited to 'draco.pl')
-rwxr-xr-xdraco.pl9
1 files changed, 6 insertions, 3 deletions
diff --git a/draco.pl b/draco.pl
index 37e4654..ac67ee9 100755
--- a/draco.pl
+++ b/draco.pl
@@ -15,13 +15,14 @@ my $lb = Unicode::LineBreak->new(ColMax => 76); # Default is 76.
 # Printing UTF-8 to STDOUT.
 binmode(STDOUT, "encoding(UTF-8)");
 
-my $VERSION = "v0.1.2";
-
-die "usage: draco [-v] <url>\n" unless scalar @ARGV;
+die "usage: draco [-dv] <url>\n" unless scalar @ARGV;
 
+my $DEBUG;
+my $VERSION = "v0.1.3";
 # Dispatch table to be parsed before url.
 my %dispatch = (
     '-v'  => sub { print "Draco $VERSION\n"; exit; },
+    '-d'  => sub { $DEBUG = 1; print STDERR "draco: debug on.\n"; },
 );
 if (exists $dispatch{$ARGV[0]}) {
     # shift @ARGV to get $url in next shift.
@@ -35,11 +36,13 @@ my $json_url = "${url}.json";
 my $http = HTTP::Tiny->new( verify_SSL => 1 );
 
 # Fetch the post.
+print STDERR "draco: fetching `$json_url'.\n" if $DEBUG;
 my $response = $http->get($json_url);
 die "Unexpected response - $response->{status}: $response->{reason}"
     unless $response->{success};
 
 # Decode json.
+print STDERR "draco: decoding json response.\n" if $DEBUG;
 my $json_data = decode_json($response->{content});
 
 # $post contains post data
21-11-03 16:42:30 +0530 committer Andinus <andinus@nand.sh> 2021-11-03 16:42:30 +0530 Document iteration grids' href='/andinus/fornax/commit/README?id=846b64b766f7eccdd3696603bf44b54231f03fa6'>846b64b ^
6acf653 ^

846b64b ^
6acf653 ^
58a57ab



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93