diff --git a/MarkovBot/Config.pm b/MarkovBot/Config.pm index ff80f2a..9781a09 100644 --- a/MarkovBot/Config.pm +++ b/MarkovBot/Config.pm @@ -13,9 +13,16 @@ sub config( $ ) { # config(var) # returns config value + my $file = "$Bin/config.yml"; + for (0..$#ARGV) { + if ($ARGV[$_] eq "-f") { + $file = $ARGV[$_+1]; + } + } + my $var = shift; - my $yaml = YAML::Tiny->read( "$Bin/config.yml" ); + my $yaml = YAML::Tiny->read( $file ); return $yaml->[0]->{$var}; } diff --git a/README.md b/README.md index f685c5a..a7c605b 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,11 @@ Now, just run `perl MarkovBot.pl`. < shithead-ng> Pong! ``` +## Command line options +```text +-f: specify a YAML config file for shithead-ng to use. Defaults to /path/to/shithead-ng/config.yml. +``` + ## Exporting the brainfile ```bash