[Nym3-commit] r417 - trunk/nymbaron/Client
laurent at conuropsis.org
laurent at conuropsis.org
Wed Nov 16 23:57:55 CET 2005
Author: laurent
Date: 2005-11-16 23:57:54 +0100 (Wed, 16 Nov 2005)
New Revision: 417
Modified:
trunk/nymbaron/Client/Main.py
Log:
Automatically load $HOME/.nymbaronrc in client.
Modified: trunk/nymbaron/Client/Main.py
===================================================================
--- trunk/nymbaron/Client/Main.py 2005-11-16 22:57:02 UTC (rev 416)
+++ trunk/nymbaron/Client/Main.py 2005-11-16 22:57:54 UTC (rev 417)
@@ -778,6 +778,13 @@
if len(args) < 2:
print usage_string
sys.exit(1)
+ # See if we have $HOME/.nymbaronrc, and make that the default
+ # config file.
+ try:
+ defaultrc = os.environ['HOME'] + '/.nymbaronrc'
+ os.stat(defaultrc)
+ except OSError:
+ defaultrc = None
if args[1] == "create":
parser = OptionParser(usage =
"""nymbaron create [options]
@@ -800,7 +807,7 @@
myusernamelist = []
if options.username:
myusernamelist = string.split(options.username, ":")
- config = Config.Config() # TODO load from file
+ config = Config.Config(filename = defaultrc)
setupAccount(config, ui, serverName = options.server,
usernamelist = myusernamelist,
emailAddress = options.email, nickname = options.nickname)
@@ -820,7 +827,7 @@
"from (defaults to stdin)")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
relayMessage(ui, config, options.nickname, options.to, options.input)
sys.exit(0)
@@ -845,7 +852,7 @@
"by list-syn")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
Summarize(ui, config, options.nickname, options.max, options.older)
sys.exit(0)
@@ -861,7 +868,7 @@
"of the account whose emails to delete")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
Delete(ui, config, options.nickname, args)
sys.exit(0)
@@ -876,7 +883,7 @@
"of the account whose emails to request")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
Get(ui, config, options.nickname, args)
sys.exit(0)
@@ -893,7 +900,7 @@
type = "int")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
SendSurb(ui, config, options.nickname, options.number)
sys.exit(0)
@@ -916,7 +923,7 @@
if (not options.idtag) and (not options.nickname):
ui.display("Must provide an idTag or a nickname")
sys.exit(1)
- config = Config.Config() # TODO load from file
+ config = Config.Config(filename = defaultrc)
if options.nickname: nick = options.nickname
else:
tm = Account.TagMap(config.path + os.sep + 'tagmap')
@@ -942,7 +949,7 @@
"of the account whose synopses to list")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
list_syn(ui, config, options.nickname)
sys.exit(0)
@@ -955,7 +962,7 @@
"of the account whose synopses to dump")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
list_syn(ui, config, options.nickname, summarize = False)
sys.exit(0)
@@ -968,7 +975,7 @@
"of the account whose mbox to list")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
list_mbox(ui, config, options.nickname)
sys.exit(0)
@@ -981,7 +988,7 @@
"of the account whose journal to list")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
list_journal(ui, config, options.nickname)
sys.exit(0)
@@ -996,7 +1003,7 @@
"of the account from which the user resends commands")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
resend_command(ui, config, options.nickname, args)
sys.exit(0)
@@ -1014,7 +1021,7 @@
"messages to, stdout if omitted")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
export(ui, config, options.nickname, options.output, args)
sys.exit(0)
@@ -1029,7 +1036,7 @@
"of the account whose emails to delete locally")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
ldelete(ui, config, options.nickname, args)
sys.exit(0)
@@ -1044,7 +1051,7 @@
"of the account whose summaries to delete locally")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
ldelete_syn(ui, config, options.nickname, args)
sys.exit(0)
@@ -1059,7 +1066,7 @@
"of the account whose journal items to delete")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
ldelete_journal(ui, config, options.nickname, args)
sys.exit(0)
@@ -1073,7 +1080,7 @@
" from, or stdin if omitted")
(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config() # TODO load from file
+ config = Config.Config(filename = defaultrc)
if options.file:
try:
f = open(options.file, "r")
@@ -1125,7 +1132,7 @@
# "of the account whose emails to request")
#(options, args) = parser.parse_args(args[2:])
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
(options, args) = parser.parse_args(args[2:])
list_accounts(ui, config)
sys.exit(0)
@@ -1135,7 +1142,7 @@
"""nymbaron remove-accounts [nickname1 [nickname2 [...]]
Remove the accounts designed by the given list of nicknames.""")
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
(options, args) = parser.parse_args(args[2:])
remove_accounts(ui, config, args)
sys.exit(0)
@@ -1145,7 +1152,7 @@
"""nymbaron passwd
Change the private keyring passphrase of the user.""")
ui = CLI()
- config = Config.Config()
+ config = Config.Config(filename = defaultrc)
(options, args) = parser.parse_args(args[2:])
passwd(ui, config)
sys.exit(0)
More information about the Nym3-commit
mailing list