依赖
Bash 脚本
sort-filter-tuniu-train-info() {
# brew install xsv
# pip3 install pretty-format-json printable
# accept json data from tuniu.py
csv_json | xsv sort -s sellOut,trainTypeName,departDepartTime,trainNum | xsv select trainNum,sellOut,trainTypeName,departStationName,destStationName,trainStartDate,departDepartTime,destArriveTime,durationStr,memo,price_0-price_3 | csv_json | printable --grid full --less
}
get-train-info-from-tuniu() {
if [[ "$@" == "-h" || "$@" == "" ]]; then
tuniu -h
return 1
fi
tuniu $@ | sort-filter-tuniu-train-info
}
效果
$ get-train-info-from-tuniu 长沙 深圳 -d 2018-10-12