Permalink
Browse files

add listing of the words

  • Loading branch information...
1 parent cdb1cbb commit c57c8d085b9dc821c654b9b76bd3866d07530d3b @szabgab szabgab committed Feb 8, 2013
Showing with 21 additions and 3 deletions.
  1. +21 −3 index.pl
View
@@ -1,8 +1,13 @@
#!/usr/bin/env perl6
use v6;
-sub MAIN() {
- my $outfile = "index.ini";
+my $index_file = "index.data";
+multi sub MAIN() {
+ say "Usage: $*PROGRAM_NAME index to index the docs";
+ say "Usage: $*PROGRAM_NAME list to list the names";
+}
+
+multi sub MAIN('index') {
my %words;
for dir('lib') -> $file {
my $pod = substr($file.Str, 0 , $file.Str.chars -4);
@@ -20,8 +25,21 @@ ()
}
}
}
- my $out = open('index.data', :w);
+ my $out = open($index_file, :w);
$out.print(%words.perl);
$out.close;
}
+multi sub MAIN('list') {
+ if $index_file.IO ~~ :e {
+ my %data = eval slurp $index_file;
+ for %data.keys.sort -> $name {
+ say $name
+ # my $newdoc = %data{$docee}[0][0] ~ "." ~ %data{$docee}[0][1];
+ # return MAIN($newdoc, :f);
+ }
+ } else {
+ say "First run $*PROGRAM_NAME index to create the index";
+ exit;
+ }
+}

0 comments on commit c57c8d0

Please sign in to comment.