fix: pm3 command for mode switching without re-sourcing venv
source activate once, then pm3/pm3 sim/pm3 sniff/pm3 all to launch REPL with appropriate imports. Uses python -i for reliable startup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
30
activate
30
activate
@@ -1,21 +1,19 @@
|
||||
# pm3py venv activation with mode-based auto-imports.
|
||||
# Usage: source activate — core (Proxmark3, Cmd, etc.)
|
||||
# source activate sim — + SimSession, transponder models
|
||||
# source activate sniff — + SniffSession, trace decoders
|
||||
# source activate all — everything
|
||||
# pm3py venv activation.
|
||||
# Usage: source activate
|
||||
#
|
||||
# Then: python — REPL with auto-imports
|
||||
# ipython — IPython with auto-imports (if installed)
|
||||
# Then: pm3 — REPL with core imports (Proxmark3, Cmd)
|
||||
# pm3 sim — + SimSession, all transponder models
|
||||
# pm3 sniff — + SniffSession, trace decoders
|
||||
# pm3 all — everything
|
||||
|
||||
_PM3PY_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Activate the venv
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/.venv/bin/activate"
|
||||
source "${_PM3PY_ROOT}/.venv/bin/activate"
|
||||
|
||||
# Set mode and PYTHONSTARTUP
|
||||
export PM3PY_MODE="${1:-core}"
|
||||
export PYTHONSTARTUP="$(dirname "${BASH_SOURCE[0]}")/.pythonstartup.py"
|
||||
# pm3 command — launches REPL with mode
|
||||
pm3() {
|
||||
PM3PY_MODE="${1:-core}" python -i "${_PM3PY_ROOT}/.pythonstartup.py"
|
||||
}
|
||||
|
||||
# Update prompt to show mode
|
||||
PS1="(pm3py:${PM3PY_MODE}) ${_OLD_VIRTUAL_PS1:-\$ }"
|
||||
export PS1
|
||||
|
||||
echo "pm3py env ready (mode: ${PM3PY_MODE}). Run 'python' for REPL with auto-imports."
|
||||
echo "pm3py env ready. Commands: pm3, pm3 sim, pm3 sniff, pm3 all"
|
||||
|
||||
Reference in New Issue
Block a user