Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
62b77241
Commit
62b77241
authored
Jul 31, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to disable adding the creation date for 'add'.
Fixes #20.
parent
d2eba233
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
3 deletions
+33
-3
test/AddCommandTest.py
test/AddCommandTest.py
+10
-0
topydo.conf
topydo.conf
+3
-0
topydo/commands/AddCommand.py
topydo/commands/AddCommand.py
+2
-2
topydo/lib/Config.py
topydo/lib/Config.py
+18
-1
No files found.
test/AddCommandTest.py
View file @
62b77241
...
@@ -266,6 +266,16 @@ class AddCommandTest(CommandTest):
...
@@ -266,6 +266,16 @@ class AddCommandTest(CommandTest):
self
.
assertEqual
(
self
.
output
,
u
(
"| 1| {tod} Foo @fo
\
u00f3
b
\
u0105
r due:{tod} id:1
\
n
| 2| {tod} Bar +baz t:{tod} p:1
\
n
"
.
format
(
tod
=
self
.
today
)))
self
.
assertEqual
(
self
.
output
,
u
(
"| 1| {tod} Foo @fo
\
u00f3
b
\
u0105
r due:{tod} id:1
\
n
| 2| {tod} Bar +baz t:{tod} p:1
\
n
"
.
format
(
tod
=
self
.
today
)))
self
.
assertEqual
(
self
.
errors
,
""
)
self
.
assertEqual
(
self
.
errors
,
""
)
def
test_add_task_without_date
(
self
):
config
(
p_overrides
=
{(
'add'
,
'auto_creation_date'
):
'0'
})
args
=
[
"New todo"
]
command
=
AddCommand
.
AddCommand
(
args
,
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
self
.
assertEqual
(
self
.
todolist
.
todo
(
1
).
source
(),
"New todo"
)
self
.
assertEqual
(
self
.
errors
,
""
)
def
test_help
(
self
):
def
test_help
(
self
):
command
=
AddCommand
.
AddCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
=
AddCommand
.
AddCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
command
.
execute
()
...
...
topydo.conf
View file @
62b77241
...
@@ -7,6 +7,9 @@ default_command = ls
...
@@ -7,6 +7,9 @@ default_command = ls
colors
=
1
colors
=
1
identifiers
=
linenumber
;
or
:
text
identifiers
=
linenumber
;
or
:
text
[
add
]
auto_creation_date
=
1
[
ls
]
[
ls
]
hide_tags
=
id
,
p
,
ical
hide_tags
=
id
,
p
,
ical
indent
=
0
indent
=
0
...
...
topydo/commands/AddCommand.py
View file @
62b77241
...
@@ -47,7 +47,6 @@ class AddCommand(Command):
...
@@ -47,7 +47,6 @@ class AddCommand(Command):
self
.
args
=
args
self
.
args
=
args
def
get_todos_from_file
(
self
):
def
get_todos_from_file
(
self
):
if
self
.
from_file
==
'-'
:
if
self
.
from_file
==
'-'
:
f
=
stdin
f
=
stdin
...
@@ -107,7 +106,8 @@ class AddCommand(Command):
...
@@ -107,7 +106,8 @@ class AddCommand(Command):
add_dependencies
(
'before'
)
add_dependencies
(
'before'
)
add_dependencies
(
'after'
)
add_dependencies
(
'after'
)
p_todo
.
set_creation_date
(
date
.
today
())
if
config
().
auto_creation_date
():
p_todo
.
set_creation_date
(
date
.
today
())
todo_text
=
_preprocess_input_todo
(
p_todo_text
)
todo_text
=
_preprocess_input_todo
(
p_todo_text
)
todo
=
self
.
todolist
.
add
(
todo_text
)
todo
=
self
.
todolist
.
add
(
todo_text
)
...
...
topydo/lib/Config.py
View file @
62b77241
...
@@ -38,7 +38,15 @@ class _Config:
...
@@ -38,7 +38,15 @@ class _Config:
(such as todo.txt location passed with -t). The key is a tuple of
(such as todo.txt location passed with -t). The key is a tuple of
(section, option), the value is the option's value.
(section, option), the value is the option's value.
"""
"""
self
.
sections
=
[
'topydo'
,
'tags'
,
'sort'
,
'ls'
,
'dep'
,
'colorscheme'
]
self
.
sections
=
[
'add'
,
'colorscheme'
,
'dep'
,
'ls'
,
'sort'
,
'tags'
,
'topydo'
,
]
self
.
defaults
=
{
self
.
defaults
=
{
# topydo
# topydo
...
@@ -48,6 +56,9 @@ class _Config:
...
@@ -48,6 +56,9 @@ class _Config:
'archive_filename'
:
'done.txt'
,
'archive_filename'
:
'done.txt'
,
'identifiers'
:
'linenumber'
,
'identifiers'
:
'linenumber'
,
# add
'auto_creation_date'
:
'1'
,
# ls
# ls
'hide_tags'
:
'id,p,ical'
,
'hide_tags'
:
'id,p,ical'
,
'indent'
:
0
,
'indent'
:
0
,
...
@@ -233,6 +244,12 @@ class _Config:
...
@@ -233,6 +244,12 @@ class _Config:
except
ValueError
:
except
ValueError
:
return
int
(
self
.
defaults
[
'link_color'
])
return
int
(
self
.
defaults
[
'link_color'
])
def
auto_creation_date
(
self
):
try
:
return
self
.
cp
.
getboolean
(
'add'
,
'auto_creation_date'
)
except
ValueError
:
return
self
.
defaults
[
'auto_creation_date'
]
==
'1'
def
config
(
p_path
=
None
,
p_overrides
=
None
):
def
config
(
p_path
=
None
,
p_overrides
=
None
):
"""
"""
Retrieve the config instance.
Retrieve the config instance.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment