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
ffdd292f
Commit
ffdd292f
authored
Feb 09, 2017
by
Jacek Sowiński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce new method for getting command shortname
parent
83d1005a
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
82 additions
and
2 deletions
+82
-2
test/test_add_command.py
test/test_add_command.py
+5
-0
test/test_append_command.py
test/test_append_command.py
+5
-0
test/test_delete_command.py
test/test_delete_command.py
+5
-0
test/test_dep_command.py
test/test_dep_command.py
+5
-0
test/test_depri_command.py
test/test_depri_command.py
+5
-0
test/test_do_command.py
test/test_do_command.py
+5
-0
test/test_edit_command.py
test/test_edit_command.py
+5
-0
test/test_list_command.py
test/test_list_command.py
+5
-0
test/test_list_context_command.py
test/test_list_context_command.py
+5
-0
test/test_list_project_command.py
test/test_list_project_command.py
+5
-0
test/test_postpone_command.py
test/test_postpone_command.py
+5
-0
test/test_priority_command.py
test/test_priority_command.py
+5
-0
test/test_revert_command.py
test/test_revert_command.py
+5
-0
test/test_sort_command.py
test/test_sort_command.py
+5
-0
test/test_tag_command.py
test/test_tag_command.py
+5
-0
topydo/lib/Command.py
topydo/lib/Command.py
+5
-0
topydo/ui/CLIApplicationBase.py
topydo/ui/CLIApplicationBase.py
+1
-1
topydo/ui/columns/Transaction.py
topydo/ui/columns/Transaction.py
+1
-1
No files found.
test/test_add_command.py
View file @
ffdd292f
...
...
@@ -405,6 +405,11 @@ class AddCommandTest(CommandTest):
"| 1| x 2015-01-01 {} Already completed
\
n
"
.
format
(
self
.
today
))
self
.
assertEqual
(
self
.
errors
,
""
)
def
test_add_name
(
self
):
name
=
AddCommand
.
AddCommand
.
name
()
self
.
assertEqual
(
name
,
'add'
)
def
test_help
(
self
):
command
=
AddCommand
.
AddCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
...
...
test/test_append_command.py
View file @
ffdd292f
...
...
@@ -102,6 +102,11 @@ class AppendCommandTest(CommandTest):
"| 2| Qux due:%s t:%s p:1 p:2
\
n
"
%
(
self
.
today
,
self
.
today
))
self
.
assertEqual
(
self
.
errors
,
""
)
def
test_append_name
(
self
):
name
=
AppendCommand
.
name
()
self
.
assertEqual
(
name
,
'append'
)
def
test_help
(
self
):
command
=
AppendCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
test/test_delete_command.py
View file @
ffdd292f
...
...
@@ -243,6 +243,11 @@ class DeleteCommandTest(CommandTest):
self
.
assertFalse
(
self
.
output
)
self
.
assertEqual
(
self
.
errors
,
command
.
usage
()
+
"
\
n
"
)
def
test_delete_name
(
self
):
name
=
DeleteCommand
.
name
()
self
.
assertEqual
(
name
,
'delete'
)
def
test_help
(
self
):
command
=
DeleteCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
test/test_dep_command.py
View file @
ffdd292f
...
...
@@ -360,6 +360,11 @@ node [ shape="none" margin="0" fontsize="9" fontname="Helvetica" ]
self
.
assertEqual
(
self
.
errors
,
command
.
usage
()
+
"
\
n
"
)
self
.
assertFalse
(
self
.
todolist
.
dirty
)
def
test_dep_name
(
self
):
name
=
DepCommand
.
name
()
self
.
assertEqual
(
name
,
'dep'
)
def
test_help
(
self
):
command
=
DepCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
test/test_depri_command.py
View file @
ffdd292f
...
...
@@ -167,6 +167,11 @@ class DepriCommandTest(CommandTest):
self
.
assertFalse
(
self
.
output
)
self
.
assertEqual
(
self
.
errors
,
command
.
usage
()
+
"
\
n
"
)
def
test_depri_name
(
self
):
name
=
DepriCommand
.
name
()
self
.
assertEqual
(
name
,
'depri'
)
def
test_help
(
self
):
command
=
DepriCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
test/test_do_command.py
View file @
ffdd292f
...
...
@@ -454,6 +454,11 @@ class DoCommandTest(CommandTest):
self
.
assertFalse
(
self
.
output
)
self
.
assertEqual
(
self
.
errors
,
command
.
usage
()
+
"
\
n
"
)
def
test_do_name
(
self
):
name
=
DoCommand
.
name
()
self
.
assertEqual
(
name
,
'do'
)
def
test_help
(
self
):
command
=
DoCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
test/test_edit_command.py
View file @
ffdd292f
...
...
@@ -196,6 +196,11 @@ class EditCommandTest(CommandTest):
self
.
assertEqual
(
self
.
todolist
.
print_todos
(),
result
)
mock_call
.
assert_called_once_with
([
editor
,
todotxt
])
def
test_edit_name
(
self
):
name
=
EditCommand
.
name
()
self
.
assertEqual
(
name
,
'edit'
)
def
test_help
(
self
):
command
=
EditCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
,
None
)
...
...
test/test_list_command.py
View file @
ffdd292f
...
...
@@ -420,6 +420,11 @@ class ListCommandTest(CommandTest):
self
.
assertEqual
(
self
.
output
,
"| 1| (C) 2015-11-05 Foo @Context2 Not@Context +Project1 Not+Project
\
n
"
)
self
.
assertEqual
(
self
.
errors
,
""
)
def
test_list_name
(
self
):
name
=
ListCommand
.
name
()
self
.
assertEqual
(
name
,
'list'
)
def
test_help
(
self
):
command
=
ListCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
test/test_list_context_command.py
View file @
ffdd292f
...
...
@@ -38,6 +38,11 @@ class ListContextCommandTest(CommandTest):
self
.
assertEqual
(
self
.
output
,
"Context1
\
n
Context2
\
n
"
)
self
.
assertFalse
(
self
.
errors
)
def
test_listcontext_name
(
self
):
name
=
ListContextCommand
.
name
()
self
.
assertEqual
(
name
,
'listcontext'
)
def
test_help
(
self
):
command
=
ListContextCommand
([
"help"
],
None
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
test/test_list_project_command.py
View file @
ffdd292f
...
...
@@ -38,6 +38,11 @@ class ListProjectCommandTest(CommandTest):
self
.
assertEqual
(
self
.
output
,
"Project1
\
n
Project2
\
n
"
)
self
.
assertFalse
(
self
.
errors
)
def
test_listproject_name
(
self
):
name
=
ListProjectCommand
.
name
()
self
.
assertEqual
(
name
,
'listproject'
)
def
test_help
(
self
):
command
=
ListProjectCommand
([
"help"
],
None
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
test/test_postpone_command.py
View file @
ffdd292f
...
...
@@ -314,6 +314,11 @@ class PostponeCommandTest(CommandTest):
self
.
assertEqual
(
self
.
output
,
result
)
self
.
assertEqual
(
self
.
errors
,
""
)
def
test_postpone_name
(
self
):
name
=
PostponeCommand
.
name
()
self
.
assertEqual
(
name
,
'postpone'
)
def
test_help
(
self
):
command
=
PostponeCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
...
...
test/test_priority_command.py
View file @
ffdd292f
...
...
@@ -249,6 +249,11 @@ class PriorityCommandTest(CommandTest):
self
.
assertFalse
(
self
.
output
)
self
.
assertEqual
(
self
.
errors
,
command
.
usage
()
+
"
\
n
"
)
def
test_priority_name
(
self
):
name
=
PriorityCommand
.
name
()
self
.
assertEqual
(
name
,
'priority'
)
def
test_help
(
self
):
command
=
PriorityCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
...
...
test/test_revert_command.py
View file @
ffdd292f
...
...
@@ -318,6 +318,11 @@ class RevertCommandTest(CommandTest):
self
.
assertEqual
(
config
().
backup_count
(),
5
)
def
test_revert_name
(
self
):
name
=
RevertCommand
.
name
()
self
.
assertEqual
(
name
,
'revert'
)
def
test_help
(
self
):
command
=
RevertCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
test/test_sort_command.py
View file @
ffdd292f
...
...
@@ -53,6 +53,11 @@ class SortCommandTest(CommandTest):
self
.
assertEqual
(
todo1
.
source
(),
todo2
.
source
())
def
test_sort_name
(
self
):
name
=
SortCommand
.
name
()
self
.
assertEqual
(
name
,
'sort'
)
def
test_help
(
self
):
command
=
SortCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
test/test_tag_command.py
View file @
ffdd292f
...
...
@@ -288,6 +288,11 @@ class TagCommandTest(CommandTest):
self
.
assertEqual
(
self
.
output
,
""
)
self
.
assertEqual
(
self
.
errors
,
command
.
usage
()
+
"
\
n
"
)
def
test_tag_name
(
self
):
name
=
TagCommand
.
name
()
self
.
assertEqual
(
name
,
'tag'
)
def
test_help
(
self
):
command
=
TagCommand
([
"help"
],
self
.
todolist
,
self
.
out
,
self
.
error
)
command
.
execute
()
...
...
topydo/lib/Command.py
View file @
ffdd292f
...
...
@@ -85,6 +85,11 @@ class Command(object):
return
result
@
classmethod
def
name
(
cls
):
"""" Returns short-name of the command. """
return
cls
.
__name__
[:
-
7
].
lower
()
# strip 'Command'
def
usage
(
self
):
""" Returns a one-line synopsis for this command. """
raise
NotImplementedError
...
...
topydo/ui/CLIApplicationBase.py
View file @
ffdd292f
...
...
@@ -249,7 +249,7 @@ class CLIApplicationBase(object):
def
_backup
(
self
,
p_command
,
p_args
=
[],
p_label
=
None
):
if
config
().
backup_count
()
>
0
and
p_command
and
not
self
.
is_read_only
(
p_command
):
call
=
[
p_command
.
__module__
.
lower
()[
16
:
-
7
]]
+
p_args
# strip "topydo.commands" and "Command"
call
=
[
p_command
.
name
()]
+
p_args
from
topydo.lib.ChangeSet
import
ChangeSet
label
=
p_label
if
p_label
else
call
...
...
topydo/ui/columns/Transaction.py
View file @
ffdd292f
...
...
@@ -27,7 +27,7 @@ class Transaction(object):
self
.
_cmd
=
lambda
op
:
p_subcommand
(
op
,
*
p_env_args
)
self
.
_todo_ids
=
p_todo_ids
self
.
_operations
=
[]
self
.
_cmd_name
=
p_subcommand
.
__module__
.
lower
()[
16
:
-
7
]
self
.
_cmd_name
=
p_subcommand
.
name
()
self
.
label
=
[]
def
prepare
(
self
,
p_args
):
...
...
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