-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Install proper Django during pinax-cli installation
Install required Django at installation, based on enviroment markers in setup.py. Update help with usage examples, colored output, and ordered sub-command list.
- Loading branch information
Showing
5 changed files
with
213 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import crayons | ||
|
||
|
||
def order_manually(sub_commands): | ||
"""Order sub-commands for display""" | ||
order = [ | ||
"start", | ||
] | ||
ordered = [] | ||
commands = dict(zip([cmd for cmd in sub_commands], sub_commands)) | ||
for k in order: | ||
ordered.append(commands.get(k, "")) | ||
if k in commands: | ||
del commands[k] | ||
|
||
# Add commands not present in `order` above | ||
for k in commands: | ||
ordered.append(commands[k]) | ||
|
||
return ordered | ||
|
||
|
||
def format_help(help): | ||
"""Format the help string.""" | ||
help = help.replace('Options:', str(crayons.black('Options:', bold=True))) | ||
|
||
help = help.replace('Usage: pinax', str('Usage: {0}'.format(crayons.black('pinax', bold=True)))) | ||
|
||
help = help.replace(' start', str(crayons.green(' start', bold=True))) | ||
help = help.replace(' apps', str(crayons.yellow(' apps', bold=True))) | ||
help = help.replace(' demos', str(crayons.yellow(' demos', bold=True))) | ||
help = help.replace(' projects', str(crayons.yellow(' projects', bold=True))) | ||
help = help.replace(' themes', str(crayons.yellow(' themes', bold=True))) | ||
help = help.replace(' tools', str(crayons.yellow(' tools', bold=True))) | ||
|
||
additional_help = \ | ||
"""Usage Examples: | ||
Create new project based on Pinax 'account' starter project: | ||
$ {0} | ||
Create new project based on development version of 'blog' starter project | ||
$ {6} | ||
View all Pinax starter projects: | ||
$ {1} | ||
View all Pinax demo projects: | ||
$ {2} | ||
View all Pinax apps: | ||
$ {3} | ||
View all Pinax tools: | ||
$ {4} | ||
View all Pinax themes: | ||
$ {5} | ||
Commands:""".format( | ||
crayons.red('pinax start account my_project'), | ||
crayons.red('pinax projects'), | ||
crayons.red('pinax demos'), | ||
crayons.red('pinax apps'), | ||
crayons.red('pinax tools'), | ||
crayons.red('pinax themes'), | ||
crayons.red('pinax start --dev blog my_project') | ||
) | ||
|
||
help = help.replace('Commands:', additional_help) | ||
|
||
return help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters