make scratch even better
This commit is contained in:
parent
0cadf4111a
commit
b6d3741175
2 changed files with 14 additions and 12 deletions
|
@ -37,10 +37,6 @@ alias viv-dev='python3 <(curl -fsSL https://raw.githubusercontent.com/daylinmorg
|
|||
# increment a build number and maintain Lexicographic order
|
||||
alias lexid-inc="python -c \"import sys;build=(sys.argv[1] if len(sys.argv) ==2 else sys.exit('please provide number as input'));print((next if build[1] == (next:= str(int(build) + 1))[0] else f'{int(next[0])*11}{next[1:]}'))\""
|
||||
|
||||
alias task="./do"
|
||||
alias task="./task"
|
||||
alias t="./task"
|
||||
|
||||
alias micromamba-fhs="nix-shell -E 'with import <nixpkgs> {}; (pkgs.buildFHSUserEnv {name = \"micromamba-fhs\"; runScript=\"zsh\";}).env'"
|
||||
|
||||
alias fhs="nix-shell -E 'with import <nixpkgs> {}; (pkgs.buildFHSUserEnv {name = \"micromamba-fhs\"; runScript=\"zsh\";}).env'"
|
||||
|
|
|
@ -3,16 +3,22 @@
|
|||
|
||||
# inspo: https://leahneukirchen.org/blog/archive/2006/01/keeping-your-home-clean-with-mess.html
|
||||
|
||||
date_dir=$(date +"%Y/%U")
|
||||
DATED_SCRATCH=$HOME/scratch/$date_dir
|
||||
mkdir -p $DATED_SCRATCH
|
||||
ln -sfn $DATED_SCRATCH $HOME/scratch/current
|
||||
local dir date_scratch
|
||||
|
||||
date_scratch=$HOME/scratch/$(date +"%Y/%U")
|
||||
mkdir -p $date_scratch
|
||||
ln -sfn $date_scratch $HOME/scratch/current
|
||||
|
||||
# cleanup any empty directories while I'm here
|
||||
find $HOME/scratch/$(date +"%Y") \
|
||||
-mindepth 2 -maxdepth 2 -type d -empty -print0 |\
|
||||
xargs -0 --no-run-if-empty rmdir --verbose
|
||||
|
||||
if [[ -n $1 ]]; then
|
||||
DIR=$DATED_SCRATCH/$1
|
||||
mkdir -p $DIR
|
||||
dir=$date_scratch/$1
|
||||
mkdir -p $dir
|
||||
else
|
||||
DIR=$(mktemp -d $DATED_SCRATCH/$(date +"%d").XXXX)
|
||||
dir=$(mktemp -d $date_scratch/$(date +"%d").XXXX)
|
||||
fi
|
||||
|
||||
pushd $DIR
|
||||
pushd $dir
|
||||
|
|
Loading…
Add table
Reference in a new issue