Compare commits

...

4 Commits

Author SHA1 Message Date
gitlab.com/pepa65 15854a1465 Fix Chinese display in less and debug linting 2023-05-31 06:10:54 +07:00
gitlab.com/pepa65 c65bb3fb1d Debug full stop 2023-05-31 05:39:19 +07:00
gitlab.com/pepa65 ea512b442c New version 0.5.0 2023-05-31 05:15:25 +07:00
gitlab.com/pepa65 ff1fabc6b1 Allow for Chinese full stop when linting
(does the official spec allow for it??)
2023-05-31 05:13:42 +07:00
2 changed files with 8 additions and 5 deletions

View File

@ -1,6 +1,6 @@
# tldr-bash-client
* version 0.4.11
* version 0.6.0
### Bash client for tldr: community driven man-by-example
**A fully-functional [bash](https://tiswww.case.edu/php/chet/bash/bashtop.html)

11
tldr
View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash
set +vx -o pipefail
[[ $- = *i* ]] && echo "Don't source this script!" && return 1
version='0.4.11'
# tldr-bash-client version 0.48
version='0.6.0'
# tldr-bash-client version 0.6.0
# Bash client for tldr: community driven man-by-example
# - forked from Ray Lee, https://github.com/raylee/tldr
# - modified and expanded by pepa65: https://gitlab.com/pepa65/tldr-bash-client
@ -300,7 +300,7 @@ Display_tldr(){
ln=0 REPLY=
[[ $md ]] || md=$1
# Read full lines, and process even when no newline at the end
while read -r || [[ $REPLY ]]
while read -r -d '\x0a' || [[ $REPLY ]]
do
((++ln))
if ((ln==1))
@ -325,8 +325,10 @@ Display_tldr(){
[[ ! ${REPLY:1:1} = ' ' ]] && Unlinted "2nd character no space"
Out "$TNL$TSP$T${REPLY:2}$XT" ;;
'>') ((${#REPLY} <= 3)) && Unlinted "No valid desciption"
echo "$REPLY"
[[ ! ${REPLY:1:1} = ' ' ]] && Unlinted "2nd character no space"
[[ ! ${REPLY: -1} = '.' ]] && Unlinted "Description doesn't end in full stop"
echo "${REPLY: -1}" |hexdump -C
[[ ! ${REPLY: -1} = '.' && ! ${REPLY: -1} = '。' ]] && Unlinted "Description doesn't end in full stop"
Out "$DNL$DSP$D${REPLY:2}$XD"
DNL= ;;
'-') ((newfmt)) && Unlinted "Bad first character"
@ -496,6 +498,7 @@ Main(){
((markdown)) && Out "$(cat "$cached")" || Display_tldr "$cached"
}
export LC_ALL=en_US.UTF-8
Main "$@"
# The exit trap will output the accumulated stdout
exit 0