Change presentation of styles list, spaces instead of comma
Make screenshots present smaller
This commit is contained in:
parent
97550224c0
commit
de0355d651
26
README.md
26
README.md
|
@ -1,12 +1,12 @@
|
|||
# tldr-bash
|
||||
# tldr (bash)
|
||||
|
||||
**A fully-functional [bash](https://tiswww.case.edu/php/chet/bash/bashtop.html)
|
||||
client for the [tldr](https://github.com/rprieto/tldr/) project, providing
|
||||
poignant examples of terminal commands.**
|
||||
|
||||
![tldr screenshot list](tldr-list.jpg?raw=true)
|
||||
![tldr screenshot list](tldr-list.jpg?raw=true "tldr list" {width=800px})
|
||||
|
||||
![tldr screenshot page](tldr-page.jpg?raw=true)
|
||||
![tldr screenshot page](tldr-page.jpg?raw=true "tldr page" {width=800px})
|
||||
|
||||
## Installation
|
||||
Download the tldr bash script to the install location:
|
||||
|
@ -22,30 +22,30 @@ If the location is not in $PATH, you need to specify the path to run it.
|
|||
### Prerequisites
|
||||
coreutils, less, grep, unzip, curl / wget
|
||||
|
||||
![tldr screenshot usage](tldr-usage.jpg?raw=true)
|
||||
![tldr screenshot usage](tldr-usage.jpg?raw=true "tldr usage" {width=800px})
|
||||
|
||||
## Customisation
|
||||
The colors and other styling of the 5 elements of tldr pages can be modified
|
||||
either by editing the first few lines of the scipt, or by setting the following
|
||||
environment variables:
|
||||
* TLDR_TITLE_STYLE (defaults to Newline,Space,Bold,Yellow)
|
||||
* TLDR_DESCRIPTION_STYLE (defaults to Space,Yellow)
|
||||
* TLDR_EXAMPLE_STYLE (defaults to Newline,Bold,Green)
|
||||
* TLDR_CODE_STYLE (defaults to Space,Bold,Blue)
|
||||
* TLDR_VALUE_STYLE (defaults to Bold,Cyan)
|
||||
* TLDR_TITLE_STYLE (defaults to: Newline Space Bold Yellow)
|
||||
* TLDR_DESCRIPTION_STYLE (defaults to: Space Yellow)
|
||||
* TLDR_EXAMPLE_STYLE (defaults to: Newline Bold Green)
|
||||
* TLDR_CODE_STYLE (defaults to: Space Bold Blue)
|
||||
* TLDR_VALUE_STYLE (defaults to: Bold Cyan)
|
||||
|
||||
Also the error color and page expiry can easily be set:
|
||||
* TLDR_ERROR_COLOR (defaults to Red)
|
||||
* TLDR_EXPIRY (defaults to 60)
|
||||
* TLDR_ERROR_COLOR (defaults to: Red)
|
||||
* TLDR_EXPIRY (defaults to: 60)
|
||||
|
||||
![tldr screenshot customize](tldr-customize.jpg?raw=true)
|
||||
![tldr screenshot customize](tldr-customize.jpg?raw=true "tldr customize" {width=800px})
|
||||
|
||||
## Contributing
|
||||
|
||||
Please file an issue for a question, a bug or a feature request.
|
||||
Or even better, send a pull request!
|
||||
|
||||
![tldr screenshot markdown](tldr-markdown.jpg?raw=true)
|
||||
![tldr screenshot markdown](tldr-markdown.jpg?raw=true "tldr markdown" {width=800px})
|
||||
|
||||
### License
|
||||
|
||||
|
|
22
tldr
22
tldr
|
@ -13,17 +13,17 @@ set +x -o pipefail
|
|||
# Modes: Bold, Underline, Italic, Inverse
|
||||
# 'Newline' can be added to the Style list to add a newline before the element
|
||||
# and 'Space' to add a space at the start of the line (not for Value element)
|
||||
# (The style items are separated by commas, lower or uppercase, no spaces.)
|
||||
: ${TLDR_TITLE_STYLE:=Newline,Space,Bold,Yellow}
|
||||
: ${TLDR_DESCRIPTION_STYLE:=Space,Yellow}
|
||||
: ${TLDR_EXAMPLE_STYLE:=Newline,Bold,Green}
|
||||
: ${TLDR_CODE_STYLE:=Space,Bold,Blue}
|
||||
: ${TLDR_VALUE_STYLE:=Bold,Cyan}
|
||||
# (The style items are separated by space, lower or uppercase mixed allowed.)
|
||||
: ${TLDR_TITLE_STYLE:= Newline Space Bold Yellow }
|
||||
: ${TLDR_DESCRIPTION_STYLE:= Space Yellow }
|
||||
: ${TLDR_EXAMPLE_STYLE:= Newline Bold Green }
|
||||
: ${TLDR_CODE_STYLE:= Space Bold Blue }
|
||||
: ${TLDR_VALUE_STYLE:= Bold Cyan }
|
||||
# Color and/or background (Newline and Space also allowed) for error messages
|
||||
: ${TLDR_ERROR_COLOR=Red}
|
||||
: ${TLDR_ERROR_COLOR= Red }
|
||||
|
||||
# How long before an attempt will be made to re-download a page
|
||||
: ${TLDR_EXPIRY:=60}
|
||||
: ${TLDR_EXPIRY:= 60 }
|
||||
|
||||
Usage(){ # $1: optional exit code
|
||||
self=$(basename $0)
|
||||
|
@ -56,9 +56,9 @@ Err(){ STDERR+="$ERRNL$ERRSP$ERR$B$1$XB$XERR$N";} # $1: error message for later
|
|||
Out(){ STDOUT+="$1$N";} # $1: message for later
|
||||
|
||||
Style(){ # $1: Style specification
|
||||
local style styles=${1// /} # remove spaces
|
||||
local style
|
||||
STYLES= XSTYLES= COLOR= XCOLOR= NL= SP=
|
||||
for style in ${styles//,/ }
|
||||
for style in $1
|
||||
do
|
||||
[[ ${style,,} = newline ]] && NL=$N
|
||||
[[ ${style,,} = space ]] && SP=' '
|
||||
|
@ -136,7 +136,7 @@ Init_term(){
|
|||
ERR=$COLOR XERR=$XCOLOR ERRNL=$NL ERRSP=$SP
|
||||
}
|
||||
|
||||
Recent(){ find "$1" -mtime -$TLDR_EXPIRY &>/dev/null;} # $1: page
|
||||
Recent(){ find "$1" -mtime -${TLDR_EXPIRY// /} &>/dev/null;} # $1: page
|
||||
|
||||
Update_index(){
|
||||
$DL "$index" "$index_url" && Out "${GRE}Index file $I$index$XI re-downloaded$DEF" || {
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 65 KiB |
Loading…
Reference in New Issue