examples: improve shell session usability

- Add usage prompt when starting shell sessions

- Give all examples an uniform interface ("c") for running commands
  or starting a shell on the node.
This commit is contained in:
Erik Arvstedt 2020-05-17 23:46:44 +02:00
parent 719dcd77bb
commit 0f1ee5f533
No known key found for this signature in database
GPG key ID: 33312B944DD97846
3 changed files with 19 additions and 3 deletions

View file

@ -1,6 +1,15 @@
# Start an interactive bash session in the current bash environment.
USAGE_INFO='
Starting shell...
Run "c COMMAND" to execute a command on the bitcoin node
Run "c" to start a shell session inside the node'
# BASH_ENVIRONMENT contains definitions of read-only variables like 'BASHOPTS' that
# cause warnings on importing. Suppress these warnings during bash startup.
# cause warnings on evaluation. Suppress these warnings while sourcing.
BASH_ENVIRONMENT=<(declare -p; declare -pf) \
bash --rcfile <(echo 'source $BASH_ENVIRONMENT 2>/dev/null')
USAGE_INFO="$USAGE_INFO" \
bash --rcfile <(echo '
source $BASH_ENVIRONMENT 2>/dev/null
echo "$USAGE_INFO"
')