From d07c3748a916c66c55482ad65323499f2529f417 Mon Sep 17 00:00:00 2001 From: fbt Date: Mon, 1 Mar 2021 09:47:15 +0300 Subject: [PATCH] old trash Signed-off-by: fbt --- sprunge | 3 --- syntax | 49 ------------------------------------------------- 2 files changed, 52 deletions(-) delete mode 100755 sprunge delete mode 100755 syntax diff --git a/sprunge b/sprunge deleted file mode 100755 index 48301e7..0000000 --- a/sprunge +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -curl -F 'sprunge=<-' http://sprunge.us diff --git a/syntax b/syntax deleted file mode 100755 index 479611c..0000000 --- a/syntax +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash - -_highlight() { - declare -n syn=$1 - - if [[ "$syn" ]]; then - exec highlight --force --inline-css -f -I -O xhtml -S "$syn" 2>/dev/null - else -# echo " :cgit: No syntax type provided." - exec cat - fi -} - -file_name=$1 -file_extension="${file_name##*.}" - -if ! [[ "$file_name" == "$file_extension" ]]; then - case "$file_extension" in - (md) exec cmark;; - (bash|zsh) syntax='sh';; - (*) syntax=$file_extension;; - esac -fi - -case "$file_name" in - (Makefile) syntax='makefile';; - (PKGBUILD) syntax='sh';; -esac - -# Read and output the first line -read -r - -# Set syntax if the first line is a shebang -if [[ "$REPLY" =~ ^'#!' ]]; then - case "$REPLY" in - (*sh) syntax='sh';; - (*ruby*) syntax='ruby';; - esac -fi - -{ - # Print the first line - printf '%s\n' "$REPLY" - - # Read and output everything - while read -r; do - printf '%s\n' "$REPLY" - done -} | _highlight syntax