aboutsummaryrefslogtreecommitdiff
path: root/sh/shrc.d/ls.sh
blob: b5acfcf998e8245559805cd7149d7d473414237d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Our ~/.profile should already have made a directory with the supported
# options for us; if not, we won't be wrapping ls(1) with a function at all
[ -d "$HOME"/.cache/sh/opt/ls ] || return

# If the system has already aliased ls(1) for us, like Slackware or OpenBSD
# does, just get rid of it
unalias ls >/dev/null 2>&1

# Discard GNU ls(1) environment variables if the environment set them
unset -v LS_OPTIONS LS_COLORS

# Define function proper
ls() {

    # -F to show trailing indicators of the filetype
    # -q to replace control chars with '?'
    set -- -Fq "$@"

    # If output is to a terminal, add -x to format entries across, not down
    [ -t 1 ] && set -- -x "$@"

    # Add --block-size=K to always show the filesize in kibibytes
    [ -e "$HOME"/.cache/sh/opt/ls/block-size ] &&
        set -- --block-size=1024 "$@"

    # Add --color if the terminal has at least 8 colors
    [ -e "$HOME"/.cache/sh/opt/ls/color ] &&
    [ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] &&
        set -- --color=auto "$@"

    # Add --time-style='+%Y-%m-%d %H:%M:%S' to show the date in my preferred
    # (fixed) format
    [ -e "$HOME"/.cache/sh/opt/ls/time-style ] &&
        set -- --time-style='+%Y-%m-%d %H:%M:%S' "$@"

    # Run ls(1) with the concluded arguments
    command ls "$@"
}
39 +1200'>21 months v12.20.0dotfiles-12.20.0.tar.gz (sig)  dotfiles-12.20.0.zip  Tom Ryder21 months v12.19.0dotfiles-12.19.0.tar.gz (sig)  dotfiles-12.19.0.zip  Tom Ryder21 months v12.18.0dotfiles-12.18.0.tar.gz (sig)  dotfiles-12.18.0.zip  Tom Ryder21 months v12.17.0dotfiles-12.17.0.tar.gz (sig)  dotfiles-12.17.0.zip  Tom Ryder21 months v12.16.0dotfiles-12.16.0.tar.gz (sig)  dotfiles-12.16.0.zip  Tom Ryder21 months v12.15.0dotfiles-12.15.0.tar.gz (sig)  dotfiles-12.15.0.zip  Tom Ryder21 months v12.14.0dotfiles-12.14.0.tar.gz (sig)  dotfiles-12.14.0.zip  Tom Ryder21 months v12.13.0dotfiles-12.13.0.tar.gz (sig)  dotfiles-12.13.0.zip  Tom Ryder21 months v12.12.0dotfiles-12.12.0.tar.gz (sig)  dotfiles-12.12.0.zip  Tom Ryder21 months v12.11.0dotfiles-12.11.0.tar.gz (sig)  dotfiles-12.11.0.zip  Tom Ryder21 months v12.10.0dotfiles-12.10.0.tar.gz (sig)  dotfiles-12.10.0.zip  Tom Ryder21 months v12.9.0dotfiles-12.9.0.tar.gz (sig)  dotfiles-12.9.0.zip  Tom Ryder21 months v12.8.0dotfiles-12.8.0.tar.gz (sig)  dotfiles-12.8.0.zip  Tom Ryder22 months v12.7.0dotfiles-12.7.0.tar.gz (sig)  dotfiles-12.7.0.zip  Tom Ryder23 months v12.5.0dotfiles-12.5.0.tar.gz (sig)  dotfiles-12.5.0.zip  Tom Ryder24 months v12.4.0dotfiles-12.4.0.tar.gz (sig)  dotfiles-12.4.0.zip  Tom Ryder24 months v12.3.0dotfiles-12.3.0.tar.gz (sig)  dotfiles-12.3.0.zip  Tom Ryder24 months v12.2.0dotfiles-12.2.0.tar.gz (sig)  dotfiles-12.2.0.zip  Tom Ryder24 months v12.1.0dotfiles-12.1.0.tar.gz (sig)  dotfiles-12.1.0.zip  Tom Ryder24 months v12.0.0dotfiles-12.0.0.tar.gz (sig)  dotfiles-12.0.0.zip  Tom Ryder24 months v11.22.0dotfiles-11.22.0.tar.gz (sig)  dotfiles-11.22.0.zip  Tom Ryder2 years v11.21.0dotfiles-11.21.0.tar.gz (sig)  dotfiles-11.21.0.zip  Tom Ryder2 years v11.20.0dotfiles-11.20.0.tar.gz (sig)  dotfiles-11.20.0.zip  Tom Ryder2 years v11.19.0dotfiles-11.19.0.tar.gz (sig)  dotfiles-11.19.0.zip  Tom Ryder2 years v11.18.0dotfiles-11.18.0.tar.gz (sig)  dotfiles-11.18.0.zip  Tom Ryder2 years v11.17.0dotfiles-11.17.0.tar.gz (sig)  dotfiles-11.17.0.zip  Tom Ryder2 years v11.16.0dotfiles-11.16.0.tar.gz (sig)  dotfiles-11.16.0.zip  Tom Ryder2 years v11.15.0dotfiles-11.15.0.tar.gz (sig)  dotfiles-11.15.0.zip  Tom Ryder2 years v11.14.0dotfiles-11.14.0.tar.gz (sig)  dotfiles-11.14.0.zip  Tom Ryder2 years v11.13.0dotfiles-11.13.0.tar.gz (sig)  dotfiles-11.13.0.zip  Tom Ryder2 years v11.12.0dotfiles-11.12.0.tar.gz (sig)  dotfiles-11.12.0.zip  Tom Ryder2 years v11.11.0dotfiles-11.11.0.tar.gz (sig)  dotfiles-11.11.0.zip  Tom Ryder2 years v11.10.0dotfiles-11.10.0.tar.gz (sig)  dotfiles-11.10.0.zip  Tom Ryder2 years v11.9.0dotfiles-11.9.0.tar.gz (sig)  dotfiles-11.9.0.zip  Tom Ryder2 years v11.8.0dotfiles-11.8.0.tar.gz (sig)  dotfiles-11.8.0.zip  Tom Ryder3 years v11.7.0dotfiles-11.7.0.tar.gz (sig)  dotfiles-11.7.0.zip  Tom Ryder3 years v11.6.0dotfiles-11.6.0.tar.gz (sig)  dotfiles-11.6.0.zip  Tom Ryder3 years v11.5.0dotfiles-11.5.0.tar.gz (sig)  dotfiles-11.5.0.zip  Tom Ryder3 years v11.4.0dotfiles-11.4.0.tar.gz (sig)  dotfiles-11.4.0.zip  Tom Ryder3 years v11.3.0dotfiles-11.3.0.tar.gz (sig)  dotfiles-11.3.0.zip  Tom Ryder3 years v11.2.0dotfiles-11.2.0.tar.gz (sig)  dotfiles-11.2.0.zip  Tom Ryder3 years v11.1.0dotfiles-11.1.0.tar.gz (sig)  dotfiles-11.1.0.zip  Tom Ryder3 years v11.0.0dotfiles-11.0.0.tar.gz (sig)  dotfiles-11.0.0.zip  Tom Ryder3 years v10.26.0dotfiles-10.26.0.tar.gz (sig)  dotfiles-10.26.0.zip  Tom Ryder3 years v10.25.0dotfiles-10.25.0.tar.gz (sig)  dotfiles-10.25.0.zip  Tom Ryder3 years v10.23.0dotfiles-10.23.0.tar.gz (sig)  dotfiles-10.23.0.zip  Tom Ryder3 years v10.22.0dotfiles-10.22.0.tar.gz (sig)  dotfiles-10.22.0.zip  Tom Ryder3 years v10.21.0dotfiles-10.21.0.tar.gz (sig)  dotfiles-10.21.0.zip  Tom Ryder3 years v10.20.0dotfiles-10.20.0.tar.gz (sig)  dotfiles-10.20.0.zip  Tom Ryder3 years v10.19.0dotfiles-10.19.0.tar.gz (sig)  dotfiles-10.19.0.zip  Tom Ryder3 years v10.18.0dotfiles-10.18.0.tar.gz (sig)  dotfiles-10.18.0.zip  Tom Ryder3 years v10.17.0dotfiles-10.17.0.tar.gz (sig)  dotfiles-10.17.0.zip  Tom Ryder3 years v10.16.0dotfiles-10.16.0.tar.gz (sig)  dotfiles-10.16.0.zip  Tom Ryder3 years v10.15.0dotfiles-10.15.0.tar.gz (sig)  dotfiles-10.15.0.zip  Tom Ryder3 years v10.14.0dotfiles-10.14.0.tar.gz (sig)  dotfiles-10.14.0.zip  Tom Ryder3 years v10.13.0dotfiles-10.13.0.tar.gz (sig)  dotfiles-10.13.0.zip  Tom Ryder4 years v10.12.0dotfiles-10.12.0.tar.gz (sig)  dotfiles-10.12.0.zip  Tom Ryder4 years v10.11.0dotfiles-10.11.0.tar.gz (sig)  dotfiles-10.11.0.zip  Tom Ryder4 years v10.10.0dotfiles-10.10.0.tar.gz (sig)  dotfiles-10.10.0.zip  Tom Ryder4 years v10.9.0dotfiles-10.9.0.tar.gz (sig)  dotfiles-10.9.0.zip  Tom Ryder4 years v10.8.0dotfiles-10.8.0.tar.gz (sig)  dotfiles-10.8.0.zip  Tom Ryder4 years v10.7.0dotfiles-10.7.0.tar.gz (sig)  dotfiles-10.7.0.zip  Tom Ryder4 years v10.6.0dotfiles-10.6.0.tar.gz (sig)  dotfiles-10.6.0.zip  Tom Ryder4 years v10.5.0dotfiles-10.5.0.tar.gz (sig)  dotfiles-10.5.0.zip  Tom Ryder4 years v10.4.0dotfiles-10.4.0.tar.gz (sig)  dotfiles-10.4.0.zip  Tom Ryder4 years v10.3.0dotfiles-10.3.0.tar.gz (sig)  dotfiles-10.3.0.zip  Tom Ryder4 years v10.2.0dotfiles-10.2.0.tar.gz (sig)  dotfiles-10.2.0.zip  Tom Ryder4 years v10.1.0dotfiles-10.1.0.tar.gz (sig)  dotfiles-10.1.0.zip  Tom Ryder4 years v10.0.0dotfiles-10.0.0.tar.gz (sig)  dotfiles-10.0.0.zip