Skip to content

Commit

Permalink
🚀 added a file listener for make
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoSahadeo committed Aug 24, 2024
1 parent 56a6e98 commit 448b561
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 3 deletions.
Binary file modified build/doctrees/Computer-Science/index.doctree
Binary file not shown.
Binary file modified build/doctrees/Mathematics/Algebra/Logarithm.doctree
Binary file not shown.
Binary file modified build/doctrees/Mathematics/Algebra/index.doctree
Binary file not shown.
Binary file modified build/doctrees/Mathematics/index.doctree
Binary file not shown.
Binary file modified build/doctrees/Mathematics/linear_approximation.doctree
Binary file not shown.
Binary file modified build/doctrees/Physics/index.doctree
Binary file not shown.
Binary file modified build/doctrees/Physics/normalisevector.doctree
Binary file not shown.
Binary file modified build/doctrees/Programming/index.doctree
Binary file not shown.
Binary file modified build/doctrees/environment.pickle
Binary file not shown.
Binary file modified build/doctrees/index.doctree
Binary file not shown.
1 change: 1 addition & 0 deletions build/html/_sources/Computer-Science/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ Computer-Science
================

.. toctree::

1 change: 0 additions & 1 deletion build/html/_sources/Programming/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ Programming
.. toctree::
:maxdepth: 2
:caption: Contents:

2 changes: 1 addition & 1 deletion build/html/searchindex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions listen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/bash

source .venv/bin/activate
command_to_run="make html"
folder_to_search="source"
directories=`find $folder_to_search -type f`
files=()

# Get an initial timestamp for all files in folder
getTimeStamps()
{
local_files=()
for entry in $directories; do
local_files+=("$(date -r $entry "+%m%d%Y%H%M%S")")
done
echo ${local_files[@]}
}

refreshMessage()
{
echo "Refreshing build"
}

refreshMessage
$command_to_run
files=($(getTimeStamps))

echo "Watching file changes"
while true; do
local_files=($(getTimeStamps))
local_files_count=${#local_files[@]}

files_count=${#files[@]}

if [[ $files_count -ne $local_files_count ]]; then
refreshMessage
$command_to_run
files=($(getTimeStamps))
echo "Watching file changes"
continue
fi
for index in "${!files[@]}"; do
numb_1=${local_files[$index]}
numb_2=${files[$index]}
if [[ $numb_1 != $numb_2 ]]; then
refreshMessage
$command_to_run
echo "Watching file changes"
files=($(getTimeStamps))
break
fi
done
sleep 1
done
1 change: 1 addition & 0 deletions source/Computer-Science/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ Computer-Science
================

.. toctree::

1 change: 0 additions & 1 deletion source/Programming/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ Programming
.. toctree::
:maxdepth: 2
:caption: Contents:

0 comments on commit 448b561

Please sign in to comment.