Rev 40 | Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 39 | - | 1 | #! /usr/bin/env escript |
| 2 | # https://rosettacode.org/wiki/Walk_a_directory/Recursively |
||
| 3 | # TODO : de hele traversal nog schrijven, dit is alleen argument parsing |
||
| 4 | |||
| 5 | defmodule DezeModule do |
||
| 6 | |||
| 7 | def usage(progname, mesg) do |
||
| 8 | IO.puts "Usage: " <> progname <> " filefind" |
||
| 9 | IO.puts mesg |
||
| 10 | end |
||
| 11 | |||
| 12 | end |
||
| 13 | |||
| 14 | progname = System.cwd() |
||
| 15 | |||
| 16 | if length(System.argv) == 1 do |
||
| 17 | directory = Enum.at(System.argv(), 0) |
||
| 18 | if File.dir?(directory) |
||
| 19 | do |
||
| 20 | IO.puts "TODO: Now do the traversal" |
||
| 21 | else |
||
| 22 | DezeModule.usage(progname, "ERROR: Not a directory : " <> directory) |
||
| 23 | end |
||
| 24 | else |
||
| 25 | DezeModule.usage(progname, "ERROR: 1 argument expected") |
||
| 26 | end |