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
0c711a24
Commit
0c711a24
authored
May 22, 2015
by
Bram Schoenmakers
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mruwek-prompt-command' into prompt
parents
e3b461e9
1af86643
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
11 deletions
+58
-11
setup.py
setup.py
+1
-1
topydo/cli/CLI.py
topydo/cli/CLI.py
+1
-3
topydo/cli/CLIApplicationBase.py
topydo/cli/CLIApplicationBase.py
+9
-3
topydo/cli/Prompt.py
topydo/cli/Prompt.py
+3
-4
topydo/cli/UILoader.py
topydo/cli/UILoader.py
+44
-0
No files found.
setup.py
View file @
0c711a24
...
...
@@ -17,7 +17,7 @@ setup(
'edit-cmd-tests'
:
[
'mock'
],
},
entry_points
=
{
'console_scripts'
:
[
'topydo = topydo.cli.
CLI
:main'
],
'console_scripts'
:
[
'topydo = topydo.cli.
UILoader
:main'
],
},
classifiers
=
[
"Development Status :: 4 - Beta"
,
...
...
topydo/cli/CLI.py
View file @
0c711a24
...
...
@@ -36,9 +36,7 @@ from topydo.lib import TodoList
class
CLIApplication
(
CLIApplicationBase
):
"""
Class that represents the Command Line Interface of Topydo.
Handles input/output of the various subcommands.
Class that represents the (original) Command Line Interface of Topydo.
"""
def
__init__
(
self
):
super
(
CLIApplication
,
self
).
__init__
()
...
...
topydo/cli/CLIApplicationBase.py
View file @
0c711a24
...
...
@@ -14,13 +14,18 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
""" Entry file for the Python todo.txt CLI. """
"""
Contains a base class for a CLI implementation of topydo and functions for the
I/O on the command-line.
"""
import
getopt
import
sys
from
six
import
PY2
from
six.moves
import
input
MAIN_OPTS
=
"c:d:ht:v"
def
usage
():
""" Prints the command-line usage of topydo. """
...
...
@@ -100,7 +105,8 @@ from topydo.lib.Utils import escape_ansi
class
CLIApplicationBase
(
object
):
"""
Base class for Command Line Interfaces (CLI) for topydo.
Base class for a Command Line Interfaces (CLI) for topydo. Examples are the
original CLI and the Prompt interface.
Handles input/output of the various subcommands.
"""
...
...
@@ -124,7 +130,7 @@ class CLIApplicationBase(object):
args
=
[
arg
.
decode
(
'utf-8'
)
for
arg
in
args
]
try
:
opts
,
args
=
getopt
.
getopt
(
args
,
"c:d:ht:v"
)
opts
,
args
=
getopt
.
getopt
(
args
,
MAIN_OPTS
)
except
getopt
.
GetoptError
as
e
:
error
(
str
(
e
))
sys
.
exit
(
1
)
...
...
topydo/cli/Prompt.py
View file @
0c711a24
...
...
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
""" Entry file for the
Python todo.txt CLI
. """
""" Entry file for the
topydo Prompt interface (CLI)
. """
import
sys
...
...
@@ -41,9 +41,8 @@ from topydo.lib import TodoList
class
PromptApplication
(
CLIApplicationBase
):
"""
Class that represents the Command Line Interface of Topydo.
Handles input/output of the various subcommand.
This class implements a variant of topydo's CLI showing a shell and
offering auto-completion thanks to the prompt toolkit.
"""
def
__init__
(
self
):
super
(
PromptApplication
,
self
).
__init__
()
...
...
topydo/cli/UILoader.py
0 → 100644
View file @
0c711a24
# Topydo - A todo.txt client written in Python.
# Copyright (C) 2014 - 2015 Bram Schoenmakers <me@bramschoenmakers.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
""" Entry file for the Python todo.txt CLI. """
import
sys
import
getopt
from
topydo.cli.CLIApplicationBase
import
MAIN_OPTS
from
topydo.cli.CLI
import
CLIApplication
from
topydo.cli.Prompt
import
PromptApplication
def
main
():
""" Main entry point of the CLI. """
try
:
args
=
sys
.
argv
[
1
:]
try
:
opts
,
args
=
getopt
.
getopt
(
args
,
MAIN_OPTS
)
except
getopt
.
GetoptError
as
e
:
error
(
str
(
e
))
sys
.
exit
(
1
)
if
args
[
0
]
==
'prompt'
:
PromptApplication
().
run
()
else
:
CLIApplication
().
run
()
except
IndexError
:
CLIApplication
().
run
()
if
__name__
==
'__main__'
:
main
()
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