Skip to content

Commit

Permalink
Enhance install script to avoid conflict when pulling new version (#26)
Browse files Browse the repository at this point in the history
* Move example configs to example/ to avoid conflict when pulling

* Update README.md

* Update example/gdbinit-gep
  • Loading branch information
lebr0nli authored Nov 29, 2023
1 parent 44d0857 commit 7b47b8c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
__pycache__/*
.venv/*
.gdb_history
.gdb_history
gdbinit-gep
geprc.py
!example/gdbinit-gep
!example/geprc.py
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ You can modify the configuration for history, auto-completion, and other GEP con

You can also add your custom key bindings by modifying `/path/to/GEP/geprc.py`.

> The `example` subdirectory houses samples and default configurations.
## The trade-offs

Since GDB doesn't have a good Python API to fully control and emulate its prompt, this plug-in has some side
Expand Down
2 changes: 1 addition & 1 deletion gdbinit-gep → example/gdbinit-gep
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ set history remove-duplicates unlimited
# Note: Set it to unlimited is not a good idea for large projects
# set max-completions unlimited

# Set whether to use single column for tab completion
# Set whether to use single column for tab completion (when fzf is not available)
# defulat: on
# set single-column-tab-complete off
File renamed without changes.
11 changes: 3 additions & 8 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,11 @@ PYTHON=$VENV_PATH/bin/python
"$PYTHON" -m pip install -U pip
"$VENV_PATH/bin/pip" install --no-cache-dir -U prompt_toolkit

if [ -f ~/.gdbinit ]; then
# backup gdbinit if exists
cp ~/.gdbinit ~/.gdbinit.old
else
# create gdbinit if not exists
touch ~/.gdbinit
fi
# copy example config to INSTALL_PATH if not exists
cp -n "$INSTALL_PATH"/example/* "$INSTALL_PATH"

# append gep to gdbinit
if ! grep -q gep ~/.gdbinit; then
if ! grep -q '^[^#]*source.*/gdbinit-gep.py' ~/.gdbinit; then
printf '\nsource%s\n' "$GDBINIT_GEP_PY" >> ~/.gdbinit
fi

Expand Down
2 changes: 1 addition & 1 deletion lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set -o xtrace

LINT_PYTHON_FILES=(
"gdbinit-gep.py"
"geprc.py"
"example/geprc.py"
)
LINT_SHELL_FILES=(
"install.sh"
Expand Down

0 comments on commit 7b47b8c

Please sign in to comment.