2017-12-09 20:17:56 +01:00
|
|
|
#!/bin/bash
|
2017-12-11 06:52:17 +01:00
|
|
|
if [[ "$#" -lt 1 || "$1" =~ ^((-h)|(--help))$ ]] ; then
|
2017-12-10 18:38:25 +01:00
|
|
|
echo "usage: nbdiff_checkpoint NOTEBOOK.ipynb"
|
|
|
|
echo
|
|
|
|
echo "Show differences between given jupyter notebook and its checkpointed version (in .ipynb_checkpoints subdirectory)"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2017-12-09 20:17:56 +01:00
|
|
|
DIRNAME=$(dirname "$1")
|
|
|
|
BASENAME=$(basename "$1" .ipynb)
|
2017-12-11 06:52:17 +01:00
|
|
|
shift
|
2017-12-09 20:17:56 +01:00
|
|
|
|
|
|
|
WORKING_COPY=$DIRNAME/$BASENAME.ipynb
|
|
|
|
CHECKPOINT_COPY=$DIRNAME/.ipynb_checkpoints/$BASENAME-checkpoint.ipynb
|
|
|
|
|
2017-12-10 18:38:25 +01:00
|
|
|
echo "----- Analysing how to change $CHECKPOINT_COPY into $WORKING_COPY -----"
|
2017-12-11 06:52:17 +01:00
|
|
|
nbdiff "$CHECKPOINT_COPY" "$WORKING_COPY" --ignore-details "$@"
|