#!/bin/bash
# SPDX-Version: 3.0
# SPDX-CreationInfo: 2025-05-05; WEIDNER, Marc S.; <msw@coresecret.dev>
# SPDX-ExternalRef: GIT https://git.coresecret.dev/msw/CISS.debian.live.builder.git
# SPDX-FileContributor: WEIDNER, Marc S.; Centurion Intelligence Consulting Agency
# SPDX-FileCopyrightText: 2024-2025; WEIDNER, Marc S.; <msw@coresecret.dev>
# SPDX-FileType: SOURCE
# SPDX-License-Identifier: EUPL-1.2 OR LicenseRef-CCLA-1.0
# SPDX-LicenseComment: This file is part of the CISS.debian.installer.secure framework.
# SPDX-PackageName: CISS.debian.live.builder
# SPDX-Security-Contact: security@coresecret.eu

declare -ga shortcuts=(
  "aptac: apt autoclean"
  "aptap: apt autopurge"
  "aptar: apt autoremove"
  "aptcheck: apt-get check"
  "aptdep: apt-cache depends"
  "aptdl: apti --download-only"
  "aptfug: apt full-upgrade"
  "apti: apt install"
  "aptimage: get Kernel Img"
  "aptp: apt purge"
  "aptpp: dpkg --purge"
  "aptr: apt remove"
  "aptse: apt search"
  "aptsh: apt show"
  "aptupd: apt update"
  "aptupg: apt upgrade"
  "boot: reboot -h now"
  "c: clear"
  "clear: printf \033c"
  "cscan: clamscan -r --bell -i"
  "chkhvg: hvg -n 0 | dieharder -g 200 -a"
  "cysd: chrony selectdata"
  "cyss: chrony sourcestats"
  "cytr: chrony tracking"
  "dev: lsblk -o ..."
  "df: df -h"
  "f2ball: f2b status all"
  "f2bubn: f2b unban --all"
  "f2bufw: f2b status ufw"
  "free: free -m"
  "genpasswd: PWD"
  "genpasswdhash: PWD Hash"
  "genstring: Random String"
  "i: who you are"
  "ipunused: iptables -L -v -n"
  "jboot: journalctl --boot=0"
  "l: ls"
  "la: ls"
  "ll: ls"
  "ls: eza"
  "lsadt: lynis audit system"
  "lsadtdoc: lynis audit system"
  "lsf: eza --absolute"
  "lss: eza --extended"
  "mkdir: mkdir -pv"
  "n: nano"
  "nstat: netstat -tlpnvWa"
  "q: exit"
  "rsban: restart fail2ban"
  "rsweb: restart nginx php8.4-fpm redis"
  "s: sudo -i"
  "sas: systemd-analyze security"
  "scanlw: scan libwrap"
  "scurl: TLS1.3 curl"
  "shut: shutdown -h now"
  "ssa: systemctl status"
  "ssf: systemctl status --failed"
  "swget: TLS1.3 wget"
  "sysdr: systemctl daemon-reload"
  "syses: systemctl edit"
  "sysliboot: list-unit-files --state=enabled --type=service"
  "syslirun: list-units --type=service --state=running"
  "sysp: load 99_local.hardened"
  "sysrl: systemctl reload"
  "sysrs: systemctl restart'"
  "syssp: systemctl stop"
  "sysst: systemctl start"
  "trel: tree"
  "usn: ufw status numbered"
  "usv: ufw status verbose"
  "v: nvim"
  "whatdelete: lsof | grep deleted"
  "whatimage: dpkg --list | grep linux"
  "whatpurge: dpkg --get-selections"
  "whichpackage <PROGRAM>"
  "whichused <PATH> <DEPTH> <ENTRIES>"
)

#######################################
# Show available Aliases
# Globals:
#   CMAG
#   CRES
#   shortcuts
# Arguments:
#  None
#######################################
celp() {
  declare arr=("${shortcuts[@]}")
  declare cols=3
  declare col_width=42
  declare i=0
  declare entry
  for entry in "${arr[@]}"; do
    ### Print entry left-aligned in fixed width, colored.
    printf "${CMAG}%-${col_width}s${CRES}" "${entry}"
    ((i++))
    if ((i % cols == 0)); then
      printf "\n"
    fi
  done
  # If last line not full, add a newline
  if ((i % cols != 0)); then
    printf "\n"
  fi
}
# vim: number et ts=2 sw=2 sts=2 ai tw=128 ft=sh
