Commits

shl...@b384bcd7-cfd4-0310-aca0-d78b80f7b91b  committed 0f9de00

Add the --version / --man / --help flags.

  • Participants
  • Parent commits f6a1fe5

Comments (0)

Files changed (2)

File black-hole-solitaire/Games-Solitaire-BlackHole-Solver/lib/Games/Solitaire/BlackHole/Solver/App.pm

 use warnings;
 
 use Getopt::Long;
+use Pod::Usage;
 
 =head1 NAME
 
 {
     my $output_fn;
 
-    if (!GetOptions(
+    my ($help, $man, $version);
+
+    GetOptions(
         "o|output=s" => \$output_fn,
-    ))
+        'help|h|?' => \$help,
+        'man' => \$man,
+        'version' => \$version,
+    ) or pod2usage(2);
+
+    pod2usage(1) if $help;
+    pod2usage(-exitstatus => 0, -verbose => 2) if $man;
+
+    if ($version)
     {
-        die "Invalid command line options given";
+        print "black-hole-solve version $VERSION\n";
+        exit(0);
     }
+
     my $filename = shift(@ARGV);
 
     my $output_handle;

File black-hole-solitaire/Games-Solitaire-BlackHole-Solver/t/01-run.t

 
     unlink($sol_fn);
 }
+