@jswork/ushell-module-base 1.0.36 → 1.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.sh +1 -0
- package/modules/_mkd.sh +30 -0
- package/package.json +1 -1
package/index.sh
CHANGED
|
@@ -21,6 +21,7 @@ source $ROOT_PATH/modules/tail.sh;
|
|
|
21
21
|
# Edit file
|
|
22
22
|
alias reload='source $BASH_BASE_PATH/src/index.sh';
|
|
23
23
|
alias bakup='cd ~/github/macos-backup/ && gg "feat(daily): automatic backup mac files" && cd -';
|
|
24
|
+
alias mkd="$ROOT_PATH/modules/_mkd.sh"
|
|
24
25
|
|
|
25
26
|
## aliases:
|
|
26
27
|
alias cwd="pwd | tr -d '\n' | pbcopy";
|
package/modules/_mkd.sh
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
cd $HOME/alo7i/daily-works/src/$(date +%Y)/$(date +%Y-%m)
|
|
4
|
+
|
|
5
|
+
# this weekday
|
|
6
|
+
start_date=$(date +"%Y-%m-%d")
|
|
7
|
+
|
|
8
|
+
# 循环生成七天的日期
|
|
9
|
+
for ((i=0; i<7; i++)); do
|
|
10
|
+
date=$(date -d "$start_date +$i day" +"%Y-%m-%d")
|
|
11
|
+
|
|
12
|
+
# if date is in this month
|
|
13
|
+
if [[ $date =~ $(date +"%Y-%m") ]]; then
|
|
14
|
+
if [[ -f $date.md ]]; then
|
|
15
|
+
continue
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# check if date is friday
|
|
19
|
+
if [[ $(date -d $date +%u) -eq 5 ]]; then
|
|
20
|
+
printf "# $date \n\n# weekly\n" >> ${date}_weekly.md
|
|
21
|
+
else
|
|
22
|
+
echo "# $date" >> $date.md
|
|
23
|
+
fi
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
done
|
|
27
|
+
|
|
28
|
+
cd -
|
|
29
|
+
|
|
30
|
+
unset start_date;
|