Merge pull request #1546 from Carreau/docs

Improve documentation and messaging.
This commit is contained in:
Anthony Scopatz 2016-08-11 18:22:55 +08:00 committed by GitHub
commit 8b8ec2b1e6
2 changed files with 24 additions and 4 deletions

View file

@ -1104,8 +1104,9 @@ must have one of the following two signatures
return 0 return 0
Adding and Removing Aliases Adding, Modifying, and Removing Aliases
--------------------------- ---------------------------------------
We can dynamically alter the aliases present simply by modifying the We can dynamically alter the aliases present simply by modifying the
built-in mapping. Here is an example using a function value: built-in mapping. Here is an example using a function value:
@ -1117,6 +1118,23 @@ built-in mapping. Here is an example using a function value:
>>> banana >>> banana
'My spoon is tooo big!' 'My spoon is tooo big!'
To redefine an alias, simply assign a new function, here using a python lambda
with keyword arguments:
.. code-block:: xonshcon
>>> aliases['banana'] = lambda args,stdin=None: "Banana for scale.\n"
>>> banana
Banana for scale.
Removing an alias is as easy as deleting the key from the alias dictionary:
.. code-block:: xonshcon
>>> del aliases['banana']
.. note:: .. note::
Alias functions should generally be defined with a leading underscore. Alias functions should generally be defined with a leading underscore.

View file

@ -281,8 +281,10 @@ def make_xonfig_wizard(default_file=None, confirm=False):
]) ])
if confirm: if confirm:
q = ("Would you like to run the xonsh configuration wizard now?\n\n" q = ("Would you like to run the xonsh configuration wizard now?\n\n"
"1. Yes\n2. No, but ask me later.\n3. No, and don't ask me again." "1. Yes (You can abort at any time)\n"
"\n\n1, 2, or 3 [default: 2]? ") "2. No, but ask me next time.\n"
"3. No, and don't ask me again.\n\n"
"1, 2, or 3 [default: 2]? ")
passer = wiz.Pass() passer = wiz.Pass()
saver = wiz.Save(check=False, ask_filename=False, saver = wiz.Save(check=False, ask_filename=False,
default_file=default_file) default_file=default_file)