Skip to content

Commit

Permalink
Move scripts to bin/
Browse files Browse the repository at this point in the history
  • Loading branch information
erikw committed Jul 10, 2022
1 parent aaf9c55 commit aa5800d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions empty_readmes.sh → bin/empty_readmes.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env sh
# Find READMEs that are empty.

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
. $SCRIPT_DIR/lib.sh
cd_git_root

git ls-files | grep README.txt | xargs -I {} sh -c 'wc -l {}' | grep "^\s*0\s" | awk '{print $2}'
3 changes: 3 additions & 0 deletions bin/lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cd_git_root() {
cd "$(git rev-parse --show-toplevel)"
}
8 changes: 6 additions & 2 deletions solve_day.sh → bin/solve_day.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

set -eu

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
. $SCRIPT_DIR/lib.sh
cd_git_root

FILES=(README.txt part1.rb input input1.0 output1.0 part2.rb)

enter_day() {
Expand Down Expand Up @@ -74,7 +78,7 @@ fi
$EDITOR -c "tabedit part1.rb | sp input | tabedit input1.0 | sp output1.0 | tabedit part2.rb | normal 2gt " README.txt


cd -
./stats.sh
cd_git_root
bin/stats.sh

printf '\ngit add %s && git commit -m "Add %s" && git push && tig\n' "$path" "$path"
4 changes: 4 additions & 0 deletions stats.sh → bin/stats.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/usr/bin/env bash
# Assumption: a README.txt means a solved puzzle.

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
. $SCRIPT_DIR/lib.sh
cd_git_root

nbr_solved() {
local path="$1"
test -z ${path} && path=.
Expand Down

0 comments on commit aa5800d

Please sign in to comment.