"Fossies" - the Fresh Open Source Software Archive

Member "fd-8.1.1/doc/screencast.sh" (25 May 2020, 768 Bytes) of package /linux/privat/fd-8.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 # Designed to be executed via svg-term from the fd root directory:
    3 # svg-term --command="bash doc/screencast.sh" --out doc/screencast.svg --padding=10
    4 set -e
    5 set -u
    6 
    7 PROMPT="▶"
    8 
    9 enter() {
   10     INPUT=$1
   11     DELAY=1
   12 
   13     prompt
   14     sleep "$DELAY"
   15     type "$INPUT"
   16     sleep 0.5
   17     printf '%b' "\\n"
   18     eval "$INPUT"
   19     type "\\n"
   20 }
   21 
   22 prompt() {
   23   printf '%b ' $PROMPT | pv -q
   24 }
   25 
   26 type() {
   27     printf '%b' "$1" | pv -qL $((10+(-2 + RANDOM%5)))
   28 }
   29 
   30 main() {
   31     IFS='%'
   32 
   33     enter "fd"
   34 
   35     enter "fd app"
   36 
   37     enter "fd sh"
   38 
   39     enter "fd sh --type f"
   40 
   41     enter "fd -e md"
   42 
   43     enter "fd -e md --exec wc -l"
   44 
   45     enter "fd '^[A-Z]'"
   46 
   47     enter "fd --exclude src"
   48 
   49     enter "fd --hidden sample"
   50 
   51     prompt
   52 
   53     sleep 3
   54 
   55     echo ""
   56 
   57     unset IFS
   58 }
   59 
   60 main