aboutsummaryrefslogtreecommitdiffstats
path: root/becommands/set.py
diff options
context:
space:
mode:
Diffstat (limited to 'becommands/set.py')
-rw-r--r--becommands/set.py37
1 files changed, 19 insertions, 18 deletions
diff --git a/becommands/set.py b/becommands/set.py
index e359df1..287ceb4 100644
--- a/becommands/set.py
+++ b/becommands/set.py
@@ -15,43 +15,44 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Change tree settings"""
-from libbe import cmdutil
+from libbe import cmdutil, bugdir
+__desc__ = __doc__
+
def execute(args):
"""
- >>> from libbe import tests
>>> import os
- >>> dir = tests.simple_bug_dir()
- >>> os.chdir(dir.dir)
- >>> execute(["a"])
+ >>> bd = bugdir.simple_bug_dir()
+ >>> os.chdir(bd.root)
+ >>> execute(["target"])
None
- >>> execute(["a", "tomorrow"])
- >>> execute(["a"])
+ >>> execute(["target", "tomorrow"])
+ >>> execute(["target"])
tomorrow
- >>> execute(["a", "none"])
- >>> execute(["a"])
+ >>> execute(["target", "none"])
+ >>> execute(["target"])
None
- >>> tests.clean_up()
"""
options, args = get_parser().parse_args(args)
if len(args) > 2:
+ help()
raise cmdutil.UserError("Too many arguments.")
- tree = cmdutil.bug_tree()
+ bd = bugdir.BugDir(from_disk=True)
if len(args) == 0:
- keys = tree.settings.keys()
+ keys = bd.settings.keys()
keys.sort()
for key in keys:
- print "%16s: %s" % (key, tree.settings[key])
+ print "%16s: %s" % (key, bd.settings[key])
elif len(args) == 1:
- print tree.settings.get(args[0])
+ print bd.settings.get(args[0])
else:
if args[1] != "none":
- tree.settings[args[0]] = args[1]
+ bd.settings[args[0]] = args[1]
else:
- del tree.settings[args[0]]
- tree.save_settings()
+ del bd.settings[args[0]]
+ bd.save()
def get_parser():
- parser = cmdutil.CmdOptionParser("be set [name] [value]")
+ parser = cmdutil.CmdOptionParser("be set [NAME] [VALUE]")
return parser
longhelp="""