nbdiff_checkpoint parameter parsing fixed

This commit is contained in:
ziembla
2017-12-11 06:52:17 +01:00
parent 8e664e8ddb
commit 8fa96f1320

View File

@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
if [ "$#" -ne 1 ]; then if [[ "$#" -lt 1 || "$1" =~ ^((-h)|(--help))$ ]] ; then
echo "usage: nbdiff_checkpoint NOTEBOOK.ipynb" echo "usage: nbdiff_checkpoint NOTEBOOK.ipynb"
echo echo
echo "Show differences between given jupyter notebook and its checkpointed version (in .ipynb_checkpoints subdirectory)" echo "Show differences between given jupyter notebook and its checkpointed version (in .ipynb_checkpoints subdirectory)"
@@ -8,9 +8,10 @@ fi
DIRNAME=$(dirname "$1") DIRNAME=$(dirname "$1")
BASENAME=$(basename "$1" .ipynb) BASENAME=$(basename "$1" .ipynb)
shift
WORKING_COPY=$DIRNAME/$BASENAME.ipynb WORKING_COPY=$DIRNAME/$BASENAME.ipynb
CHECKPOINT_COPY=$DIRNAME/.ipynb_checkpoints/$BASENAME-checkpoint.ipynb CHECKPOINT_COPY=$DIRNAME/.ipynb_checkpoints/$BASENAME-checkpoint.ipynb
echo "----- Analysing how to change $CHECKPOINT_COPY into $WORKING_COPY -----" echo "----- Analysing how to change $CHECKPOINT_COPY into $WORKING_COPY -----"
nbdiff "$CHECKPOINT_COPY" "$WORKING_COPY" --ignore-details nbdiff "$CHECKPOINT_COPY" "$WORKING_COPY" --ignore-details "$@"