Skip to content

Commit

Permalink
add shell example to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rochacbruno committed Jun 21, 2016
1 parent 81382f5 commit 69fa870
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,53 @@ If **IPython** is installed **manage shell** loads it

Else will use the **default Python console** including support for autocomplete.

Check the examples in:
The first thing you can do with **manage** is customizing the objects that will be automatically loaded in to shell,
saving you from importing and initializing a lot of stuff every time you need to play with your app via console.

Edit **manage.yml** with:

.. code-block:: yaml
project_name: My Awesome Project
help_text: |
This is the {project_name} interactive shell!
shell:
readline_enabled: true
banner:
enabled: true
message: 'Welcome to {project_name} shell!'
auto_import:
display: true
objects:
my_system.config.settings:
my_system.my_module.MyClass:
my_system.my_module.OtherClass:
as: NiceClass
sys.path:
as: sp
init:
insert:
args:
- 0
- /path/to/be/added/automatically/to/sys/path
init_script: |
from my_system.config import settings
print("Initializing settings...")
settings.configure()
Then the above **manage.yaml** will give you a shell like this:

.. code-block:: console
$ manage shell
Initializing settings...
Welcome to My Awesome Project shell!
Auto imported: ['sp', 'settings', 'MyClass', 'NiceCLass']
>>> NiceClass. <tab> # autocomplete enabled
Check more examples in:

https://github.com/rochacbruno/manage/tree/master/examples/

Expand Down

0 comments on commit 69fa870

Please sign in to comment.