Skip to content

Commit

Permalink
Some more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Egil committed Oct 16, 2023
1 parent c54515e commit 3267f9c
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ It can be used in two major ways:
* [Pysh modules](#pysh-modules)
* [Eval and exec](#eval-and-exec)
* [Configuration](#configuration)
* [Changing the prompt](#changing-the-prompt)
* [External tools](#external-tools)
* [Unit tests](#unit-tests)
* [Copyright](#copyright)
Expand Down Expand Up @@ -452,11 +453,26 @@ full syntax of Pieshell can be used in the string to evaluate/execute.
# Configuration

When running pieshell in interactive mode it executes
~/.config/pieshell at startup if it exists. This file can be used to
configure the interactive environment the same way ~/.bashrc can be
`~/.config/pieshell` at startup if it exists. This file can be used to
configure the interactive environment the same way `~/.bashrc` can be
used to configure the bash shell. For example it can be used to load
python modules, execute shell pipelines or set environment variables.
An example config file is supplied in contrib/cofig.
An example config file is supplied in
`pieshell/resources/default_config.pysh`.

## Changing the prompt

The prompt that Pieshell uses is generated by the method
`pieshell.Environment.__str__`. This method can be overridden by
assigning a new function to it:

def prompt(self):
return "Pieshell> "

Be careful if you run pipelines or other code inside the prompt that
might call repr() as that might lead to an infinite loop of prompt
printing. To solve this, use a thread local variable as a flag to
catch and break any recursion.

# Builtins

Expand Down

0 comments on commit 3267f9c

Please sign in to comment.