Commit 84421e39 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Move list_limit to a ls section, move paths to topydo section.

parent d115d38b
; See https://github.com/bram85/topydo/wiki/How-to-use for more info
[topydo]
default_action = ls
default_command = ls
; filename = todo.txt
; archive_filename = done.txt
colors = 1
highlight_projects_contexts = 1
list_limit = 25
[paths]
; filename = todo.txt
; archive_filename = done.txt
[ls]
list_limit = 25
[tags]
tag_start = t
......
......@@ -20,10 +20,10 @@ from Config import config
class ConfigTest(unittest.TestCase):
def test_config1(self):
self.assertEquals(config("data/config1").default_action(), 'do')
self.assertEquals(config("data/config1").default_command(), 'do')
def test_config2(self):
self.assertNotEquals(config("").default_action(), 'do')
self.assertNotEquals(config("").default_command(), 'do')
def test_config3(self):
self.assertTrue(config("data/config2").ignore_weekends())
[topydo]
default_action = do
default_command = do
......@@ -113,7 +113,7 @@ class CLIApplication(object):
try:
subcommand = sys.argv[1]
except IndexError:
subcommand = config().default_action()
subcommand = config().default_command()
subcommand_map = {
'add': AddCommand,
......@@ -141,7 +141,7 @@ class CLIApplication(object):
args = arguments()
if not subcommand in subcommand_map:
subcommand = config().default_action()
subcommand = config().default_command()
args = arguments(1)
command = subcommand_map[subcommand](args, self.todolist,
......
......@@ -27,19 +27,19 @@ class ConfigError(Exception):
class _Config:
def __init__(self, p_path=None):
self.sections = ['topydo', 'tags', 'sort', 'paths']
self.sections = ['topydo', 'tags', 'sort', 'ls']
self.defaults = {
# topydo
'default_action': 'ls',
'default_command': 'ls',
'colors': '1',
'highlight_projects_contexts': '1',
'list_limit': '25',
# paths
'filename' : 'todo.txt',
'archive_filename' : 'done.txt',
# ls
'list_limit': '25',
# tags
'tag_start': 't',
'tag_due': 'due',
......@@ -68,8 +68,8 @@ class _Config:
def _home_config_path(self):
return os.path.join(os.getenv('HOME'), '.topydo')
def default_action(self):
return self.cp.get('topydo', 'default_action')
def default_command(self):
return self.cp.get('topydo', 'default_command')
def colors(self):
try:
......@@ -84,14 +84,14 @@ class _Config:
return self.defaults['highlight_projects_contexts'] == '1'
def todotxt(self):
return self.cp.get('paths', 'filename')
return self.cp.get('topydo', 'filename')
def archive(self):
return self.cp.get('paths', 'archive_filename')
return self.cp.get('topydo', 'archive_filename')
def list_limit(self):
try:
return self.cp.getint('topydo', 'list_limit')
return self.cp.getint('ls', 'list_limit')
except ValueError:
return int(self.defaults['list_limit'])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment