aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorOrestis Floros <orestisf1993@gmail.com>2018-03-14 12:11:53 +0200
committerOrestis Floros <orestisf1993@gmail.com>2018-03-14 12:12:44 +0200
commit9521f69e11e68a5fdc855c738f4cf500f5ccad7a (patch)
treecfd62c8747144733ecd61528aa8b1597e2faae3d /contrib
parent29dc14dda3abd6c401f5ab133afc7cba44e293ff (diff)
downloadi3-9521f69e11e68a5fdc855c738f4cf500f5ccad7a.tar.gz
i3-9521f69e11e68a5fdc855c738f4cf500f5ccad7a.zip
dump-asy.pl: Add POD usage
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/dump-asy.pl38
1 files changed, 31 insertions, 7 deletions
diff --git a/contrib/dump-asy.pl b/contrib/dump-asy.pl
index 9bb2db3a..54a1e490 100755
--- a/contrib/dump-asy.pl
+++ b/contrib/dump-asy.pl
@@ -1,22 +1,26 @@
#!/usr/bin/env perl
# vim:ts=4:sw=4:expandtab
-# renders the layout tree using asymptote
-#
-# ./dump-asy.pl
-# will render the entire tree
-# ./dump-asy.pl 'name'
-# will render the tree starting from the node with the specified name,
-# e.g. ./dump-asy.pl 2 will render workspace 2 and below
use strict;
use warnings;
use Data::Dumper;
+use Getopt::Long;
+use Pod::Usage;
use AnyEvent::I3;
use File::Temp;
use File::Basename;
use v5.10;
use IPC::Cmd qw[can_run];
+my %options = (
+ help => 0,
+);
+my $result = GetOptions(
+ "help|?" => \$options{help},
+);
+
+pod2usage(-verbose => 2, -exitcode => 0) if $options{help};
+
# prerequisites check so we can be specific about failures caused
# by not having these tools in the path
can_run('asy') or die 'Please install asymptote';
@@ -84,3 +88,23 @@ my $rep = "$tmp";
$rep =~ s/asy$/eps/;
my $tmp_dir = dirname($rep);
system("cd $tmp_dir && asy $tmp && gv --scale=-1000 --noresize --widgetless $rep && rm $rep");
+
+__END__
+
+=head1 NAME
+
+dump-asy.pl - Render the layout tree using asymptote
+
+=head1 SYNOPSIS
+
+dump-asy.pl [workspace]
+
+=head1 EXAMPLE
+
+Render the entire tree, run:
+
+ ./dump-asy.pl
+
+Render the tree starting from the node with the specified name, run:
+
+ ./dump-asy.pl 'name'