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
bd24c1df
Commit
bd24c1df
authored
Nov 01, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #63 from mruwek/alias-fix-quotes
Properly split alias options wrapped in quotes
parents
8167470b
a41c4565
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
test/TestGetSubCommand.py
test/TestGetSubCommand.py
+9
-1
test/data/aliases.conf
test/data/aliases.conf
+1
-0
topydo/lib/Config.py
topydo/lib/Config.py
+2
-1
No files found.
test/TestGetSubCommand.py
View file @
bd24c1df
...
@@ -38,7 +38,7 @@ class GetSubcommandTest(TopydoTest):
...
@@ -38,7 +38,7 @@ class GetSubcommandTest(TopydoTest):
self
.
assertTrue
(
issubclass
(
real_cmd
,
AddCommand
))
self
.
assertTrue
(
issubclass
(
real_cmd
,
AddCommand
))
self
.
assertEqual
(
final_args
,
[
"help"
])
self
.
assertEqual
(
final_args
,
[
"help"
])
def
test_alias
(
self
):
def
test_alias
01
(
self
):
config
(
"test/data/aliases.conf"
)
config
(
"test/data/aliases.conf"
)
args
=
[
"foo"
]
args
=
[
"foo"
]
...
@@ -46,6 +46,14 @@ class GetSubcommandTest(TopydoTest):
...
@@ -46,6 +46,14 @@ class GetSubcommandTest(TopydoTest):
self
.
assertTrue
(
issubclass
(
real_cmd
,
DeleteCommand
))
self
.
assertTrue
(
issubclass
(
real_cmd
,
DeleteCommand
))
self
.
assertEqual
(
final_args
,
[
"-f"
,
"test"
])
self
.
assertEqual
(
final_args
,
[
"-f"
,
"test"
])
def
test_alias02
(
self
):
config
(
"test/data/aliases.conf"
)
args
=
[
"format"
]
real_cmd
,
final_args
=
get_subcommand
(
args
)
self
.
assertTrue
(
issubclass
(
real_cmd
,
ListCommand
))
self
.
assertEqual
(
final_args
,
[
"-F"
,
"|I| x c d {(}p{)} s k"
,
"-n"
,
"25"
])
def
test_default_cmd01
(
self
):
def
test_default_cmd01
(
self
):
args
=
[
"bar"
]
args
=
[
"bar"
]
real_cmd
,
final_args
=
get_subcommand
(
args
)
real_cmd
,
final_args
=
get_subcommand
(
args
)
...
...
test/data/aliases.conf
View file @
bd24c1df
[
aliases
]
[
aliases
]
foo
=
rm
-
f
test
foo
=
rm
-
f
test
baz
=
FooBar
baz
=
FooBar
format
=
ls
-
F
"|I| x c d {(}p{)} s k"
-
n
25
topydo/lib/Config.py
View file @
bd24c1df
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import
os
import
os
import
shlex
from
six
import
iteritems
from
six
import
iteritems
from
six.moves
import
configparser
from
six.moves
import
configparser
...
@@ -300,7 +301,7 @@ class _Config:
...
@@ -300,7 +301,7 @@ class _Config:
alias_dict
=
dict
()
alias_dict
=
dict
()
for
alias
,
meaning
in
aliases
:
for
alias
,
meaning
in
aliases
:
meaning
=
meaning
.
split
(
)
meaning
=
shlex
.
split
(
meaning
)
real_subcommand
=
meaning
[
0
]
real_subcommand
=
meaning
[
0
]
alias_args
=
meaning
[
1
:]
alias_args
=
meaning
[
1
:]
alias_dict
[
alias
]
=
(
real_subcommand
,
alias_args
)
alias_dict
[
alias
]
=
(
real_subcommand
,
alias_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