Skip to content

Commit

Permalink
1.2.0 - display old vs new disk space
Browse files Browse the repository at this point in the history
  • Loading branch information
bntzio committed Jun 21, 2017
1 parent dd1549d commit 5229cf2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wipe-modules",
"version": "1.1.1",
"version": "1.2.0",
"description": "A little agent that removes the node_modules folder of non-active projects",
"license": "MIT",
"repository": "bntzio/wipe-modules",
Expand Down
12 changes: 12 additions & 0 deletions wipe-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ modules_removed=0
is_dir=0
is_number=0
run=0
initial_size=0
end_size=0

# usage info
usage() {
Expand Down Expand Up @@ -67,6 +69,9 @@ display_message() {
echo "\033[90m $modules_removed node_modules were found! \033[39m"
else
echo "\033[90m $modules_removed node_modules successfully removed! \033[39m"
echo ""
echo "\033[90m Your initial directory size was $initial_size \033[39m"
echo "\033[90m Now it is $end_size! \033[39m"
fi
else
echo "\033[90m Our agent couldn't find any inactive projects. \033[39m"
Expand All @@ -78,6 +83,9 @@ go_gir() {
# move to code directory
cd -- "$code_dir" || exit

# grab the initial directory size
initial_size=$(du -hs . | awk -F'\t' '{print $1;}')

# if $dry is --dry (or -D) then show message
if [ "$dry" = "--dry" ] || [ "$dry" = "-D" ]; then
echo "\033[90m The node_modules in the following directories can be wiped out: \033[39m"
Expand All @@ -94,6 +102,10 @@ go_gir() {
wipe "$d"
done

# grab the new directory size!
end_size=$(du -hs . | awk -F'\t' '{print $1;}')

# show info
display_message
}
}
Expand Down

0 comments on commit 5229cf2

Please sign in to comment.