Commits

Trammell Hudson committed 6bc457e

Command line parameters

  • Participants
  • Parent commits 1ae174e

Comments (0)

Files changed (1)

 use warnings;
 use strict;
 use Math::Trig;
+use Getopt::Long;
 
 my $units = "mm"; # mm = 1, inches = 1000 / 25.4
 my $thickness = 6;
 my $tab_width = 20;
 my $kerf = 0.1;
 
+my $usage = <<"";
+Usage: boxer [options] > box.svg
+Options:
+	-h | -? | --help	This help
+	-t | --thickness N	Material thickness in mm
+	-H | --height N		Height of the box, in mm
+	-e | --edge N		Outside edge length, in mm
+	-n | --sides N		Number of sides (for polygonal boxes)
+
+
+GetOptions(
+	'h|?|help'		=> sub { print $usage; exit 0 },
+	't|thickness=f'		=> \$thickness,
+	'H|height=f'		=> \$height,
+	'e|edge=f'		=> \$edge,
+	'n|sides=i'		=> \$sides,
+) or die $usage;
+
 
 # Compute the height of the interior triangle
 my $interior_angle = 360.0 / $sides;