+# the command line help
+sub print_help() {
+ my $line = '-' x length ($xl::s{about_title}) . "\n";
+ print $line;
+ print $xl::s{about_title} . "\n";
+ print $xl::s{about_version} . " $VERSION\n";
+ print $line;
+ print _("Syntax:\n");
+ print _(" clawsker [options]\n");
+ print _("Options:\n");
+ print _(" --help Prints this help screen.\n");
+ print _(" --alternate-config-dir <dir> Uses <dir> as Claws Mail config dir.\n");
+ print _(" --clawsrc <file> Uses <file> as full resource name.\n");
+}
+
+# parse the command line
+sub parse_command_line() {
+ my $arg = 0;
+ while (defined($ARGV[$arg])) {
+ for ($ARGV[$arg]) {
+ /--help/ && do {
+ &print_help;
+ exit 0;
+ };
+ /--alternate-config-dir/ && do {
+ ++$arg;
+ die "$xl::s{e_error}$xl::s{e_requireddir}\n"
+ unless defined($ARGV[$arg]);
+ die "$xl::s{e_error}$xl::s{e_notadir}\n"
+ unless -d $ARGV[$arg];
+ $CONFIGDIR = $ARGV[$arg];
+ last;
+ };
+ /--clawsrc/ && do {
+ ++$arg;
+ die "$xl::s{e_error}$xl::s{e_requiredfile}\n"
+ unless defined($ARGV[$arg]);
+ die "$xl::s{e_error}$xl::s{e_notafile}\n"
+ unless -f $ARGV[$arg];
+ &set_rc_filename ($ARGV[$arg]);
+ last;
+ };
+ /.*/ && die $xl::s{e_error}
+ . _("unknown option '{opt}'.\n", opt => $ARGV[$arg]);
+ }
+ ++$arg;
+ }
+}
+