Skip to content

Commit

Permalink
Added a --list command to list defined networks
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamking committed May 3, 2013
1 parent 095e57f commit c60616c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions hjoin/hjoin.py
Expand Up @@ -31,6 +31,8 @@

USAGE = """
Usage: hjoin [network.channel|-private=network.nick] [--logger]
hjoin --list # List the defined networks
hjoin --stop # Stop the daemon, disconnect from all IRC networks
Network is one of the keys in the config file: "freenode", "oftc", etc.
There's no # in front of the channel
Expand Down Expand Up @@ -75,6 +77,14 @@ def main(argv=None):
stop_daemon()
return 0

if arg == "--list" or arg == "-l":
conf = load_config(os.getenv("HOME"))
print("Networks: ")
for key in conf.keys():
if not key.startswith('cmd_'):
print("\t"+key)
return 0

if "." not in arg: # Argument must be <network_name>.<channel_name>
print(USAGE)
return 1
Expand Down

0 comments on commit c60616c

Please sign in to comment.