#socket = self.request[1]
irker.handle(data)
+def usage():
+ sys.stdout.write("""
+Usage:
+ irkerd [-d debuglevel] [-l logfile] [-n nick] [-p password] [-V] [-h]
+
+Options
+ -d set debug level
+ -l set logfile
+ -n set nick-style
+ -p set nickserv password
+ -V return irkerd version
+ -h print this help dialog
+""")
+
if __name__ == '__main__':
debuglvl = 0
namestyle = "irker%03d"
password = None
logfile = None
- (options, arguments) = getopt.getopt(sys.argv[1:], "d:l:n:p:V")
+ try:
+ (options, arguments) = getopt.getopt(sys.argv[1:], "d:l:n:p:Vh")
+ except getopt.GetoptError as e:
+ sys.stderr.write("%s" % e)
+ usage()
+ sys.exit(1)
for (opt, val) in options:
if opt == '-d': # Enable debug/progress messages
debuglvl = int(val)
elif opt == '-V': # Emit version and exit
sys.stdout.write("irkerd version %s\n" % version)
sys.exit(0)
+ elif opt == '-h':
+ usage()
+ sys.exit(0)
fallback = re.search("%.*d", namestyle)
irker = Irker(debuglevel=debuglvl)
irker.debug(1, "irkerd version %s" % version)
<arg>-n <replaceable>nick</replaceable></arg>
<arg>-p <replaceable>password</replaceable></arg>
<arg>-V</arg>
+ <arg>-h</arg>
</cmdsynopsis>
</refsynopsisdiv>
<listitem><para>Write the program version to stdout and
terminate.</para></listitem>
</varlistentry>
+<varlistentry>
+<term>-h</term>
+<listitem><para>Print usage instructions and
+terminate.</para></listitem>
+</varlistentry>
</variablelist>
</refsect1>