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:
parent
719dcd77bb
commit
0f1ee5f533
@ -62,7 +62,13 @@ in {
|
||||
}
|
||||
EOF
|
||||
# Run command in container
|
||||
c() { sudo extra-container run demo-node -- "$@" | cat; }
|
||||
c() {
|
||||
if [[ $# > 0 ]]; then
|
||||
sudo extra-container run demo-node -- "$@" | cat;
|
||||
else
|
||||
sudo nixos-container root-login demo-node
|
||||
fi
|
||||
}
|
||||
|
||||
echo
|
||||
echo "Bitcoind service:"
|
||||
|
@ -38,6 +38,7 @@ nixops deploy -d bitcoin-node
|
||||
# Connect to node
|
||||
nixops ssh bitcoin-node systemctl status bitcoind
|
||||
|
||||
c() { nixops ssh bitcoin-node "$@"; }
|
||||
# Uncomment to start a shell session here
|
||||
# . start-bash-session.sh
|
||||
|
||||
|
@ -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"
|
||||
')
|
||||
|
Loading…
Reference in New Issue
Block a user