Skip to content

Commit

Permalink
Add syntax highlighting to readme (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Aug 8, 2022
2 parents ace4525 + ee99294 commit 57ed4fe
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions README.rst
Expand Up @@ -11,7 +11,7 @@ Shellingham detects what shell the current Python executable is running in.
Usage
=====

::
.. code-block:: python
>>> import shellingham
>>> shellingham.detect_shell()
Expand Down Expand Up @@ -43,13 +43,16 @@ Shellingham raises ``ShellDetectionFailure`` if there is no shell to detect,
but *your application should almost never do this to your user*.

A practical approach to this is to wrap ``detect_shell`` in a try block, and
provide a sane default on failure::
provide a sane default on failure

.. code-block:: python
try:
shell = shellingham.detect_shell()
except shellingham.ShellDetectionFailure:
shell = provide_default()
There are a few choices for you to choose from.

* The POSIX standard mandates the environment variable ``SHELL`` to refer to
Expand All @@ -63,7 +66,9 @@ There are a few choices for you to choose from.
This can always be used to launch a usable command prompt (e.g. `cmd.exe` on
Windows).

Here's a simple implementation to provide a default shell::
Here's a simple implementation to provide a default shell

.. code-block:: python
import os
Expand Down

0 comments on commit 57ed4fe

Please sign in to comment.