Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add syntax highlighting to readme #63

Merged
merged 1 commit into from Aug 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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