diff --git a/README.md b/README.md index 64fe21e..ecabcc8 100644 --- a/README.md +++ b/README.md @@ -200,11 +200,22 @@ $ ws datetime # 获取当前日期和时间 如果你本地配置了 mutt 邮件发送,然后安装如下方式配置好你的 Kindle 邮箱即可推送 +**配置 kindle 接收邮箱** + +```bash +$ echo "email=your_kindle@kindle.cn" > ~/.config/wshell/kindle/kindrc +``` + +**配置 mutt 推送邮箱配置** + ```bash -# 配置邮箱 -$ echo "email=your_kindle@kindle.cn" > ~/.config/wshell/kindle +set smtp_url = "smtp://@:" +set smtp_pass = "" +set from = "" ``` +**推送** + ```bash $ ws kindle push # 推送 ``` diff --git a/VERSION b/VERSION index 4cda8f1..1cc9c18 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.2 +1.5.8 diff --git a/bin/base/bf.py b/bin/base/bf.py index de84739..276f606 100755 --- a/bin/base/bf.py +++ b/bin/base/bf.py @@ -48,6 +48,8 @@ def format_size(size: int): print(line) filelists.sort(key=lambda x: x['size'], reverse=True) + if len(filelists) <= 10: + sys.exit(0) print('\n排序后,最大的 10 个文件') for f in filelists[:10]: diff --git a/bin/book/publish b/bin/book/publish new file mode 100755 index 0000000..1a128e1 --- /dev/null +++ b/bin/book/publish @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Author: wxnacy(wxnacy@gmail.com) +# Description: 将书发布到 https://github.com/wxnacy/book + +filepath=$1 + +publish(){ + book_dir=$1 + goss -r book -p book/${book_dir}/ $2 +} + +if [ -f $filepath ] +then + names=($(ws py parse_filename.py $filepath)) + book_dir=${names[2]} + publish $book_dir $filepath +else + filepath=$(python -c "print('${filepath}'.rstrip('/'))") + book_dir=$(python -c "print('${filepath}'.split('/')[-1])") + + for f in `ls $filepath` + do + fp=$filepath/$f + echo $fp + publish $book_dir $fp + done + +fi + diff --git a/bin/kindle/push b/bin/kindle/push index 8e206a9..d4b2eee 100755 --- a/bin/kindle/push +++ b/bin/kindle/push @@ -1,10 +1,14 @@ #!/usr/bin/env bash # Author: wxnacy(wxnacy@gmail.com) # Description: 推送书籍到 kindle -# vim ${HOME}/.config/wshell/kindle +# vim ${HOME}/.config/wshell/kindle/kindrc # email=your_kindle@kindle.cn +# vim ${HOME}/.config/wshell/kindle/muttrc +# set smtp_url = "smtp://@:" +# set smtp_pass = "" +# set from = "" -. ${HOME}/.config/wshell/kindle +. ${HOME}/.config/wshell/kindle/kindrc path=$1 @@ -14,6 +18,7 @@ then exit 0 fi -mutt $email -a $path < /dev/null +echo "Begin push $path" +mutt $email -F ${HOME}/.config/wshell/kindle/muttrc -s $path -a $path < /dev/null echo 'Success!' diff --git a/bin/mutt/install b/bin/mutt/install new file mode 100755 index 0000000..68e520c --- /dev/null +++ b/bin/mutt/install @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Author: wxnacy(wxnacy@gmail.com) +# Description: + + +OS=`ws os` +OSS=(${OS}) +SYS=${OSS[0]} +VER=${OSS[1]} +PKG=${OSS[2]} + +case $SYS in + debian|ubuntu|devuan|deepin) + sudo apt update -y + sudo apt install mutt -y + ;; + centos|fedora|rhel|amzn) + sudo yum update -y + sudo yum install mutt -y + ;; + Darwin) + brew install mutt + ;; + *) + echo '暂时不支持该系统' + ;; +esac + + diff --git a/bin/py/parse_filename.py b/bin/py/parse_filename.py new file mode 100755 index 0000000..59b2919 --- /dev/null +++ b/bin/py/parse_filename.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- +# Author: wxnacy(wxnacy@gmail.com) +# Description: 解析文件名 + +import os + +def parse(filename): + filedir, name = os.path.split(filename) + names = name.split(".") + result = [filedir or '.', name] + result.extend(names) + return result + +if __name__ == "__main__": + import sys + filename = sys.argv[1] + # filename = '~/Downloads/人间失格/人间失格.mobi' + # filename = '~/Downloads/人间失格/' + a, b, c, d = parse(filename) + print(a, b, c, d) + + + diff --git a/conf/bash/bash_aliases b/conf/bash/bash_aliases index 6e1de3f..d0992c7 100644 --- a/conf/bash/bash_aliases +++ b/conf/bash/bash_aliases @@ -7,6 +7,9 @@ alias gt="git tag -l" # for system alias ll="ls -l" alias la="ls -la" +alias lh="ls -lh" +alias dfh="df -h" +alias du1="du -d 1 -h" alias ..="cd .." alias ...="cd ../.." alias ....="cd ../../.."