Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pystache_custom
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
pystache_custom
Commits
d7dde611
Commit
d7dde611
authored
Dec 13, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made commands.main() easier to unit test.
parent
73f05e04
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
pystache/commands.py
+6
-3
No files found.
pystache/commands.py
View file @
d7dde611
...
...
@@ -12,6 +12,7 @@ Run this script using the -h option for command-line help.
# isn't available until Python 2.7.
import
argparse
import
json
import
sys
# We use absolute imports here to allow use of this script from its
# location in source control (e.g. for development purposes).
...
...
@@ -23,11 +24,13 @@ from pystache.loader import Loader
from
pystache.template
import
Template
def
main
():
def
main
(
sys_argv
):
args
=
sys_argv
[
1
:]
parser
=
argparse
.
ArgumentParser
(
description
=
'Render a mustache template with the given context.'
)
parser
.
add_argument
(
'template'
,
help
=
'A filename or a template code.'
)
parser
.
add_argument
(
'context'
,
help
=
'A filename or a JSON string'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
(
args
=
args
)
if
args
.
template
.
endswith
(
'.mustache'
):
args
.
template
=
args
.
template
[:
-
9
]
...
...
@@ -46,5 +49,5 @@ def main():
if
__name__
==
'__main__'
:
main
()
main
(
sys
.
argv
)
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