#!/bin/bash

function make_mime_types_markdown()(
 function show_greetings() {
  echo " ";
  echo " Utility to make ~/.mime.types file for Firefox to view Markdown";
  echo " Copyright (c) 2025 Alexey Kuryakin kouriakine@mail.ru";
  echo " Version: 20250110";
  echo "";
 };
 function show_title() {
  echo " ";
  echo " $*";
  echo " ";
 };
 function set_mime_types(){
  local config="$HOME/.mime.types";
  if [ -z "$*" ]; then
   rm -f $config;
  else
   if [ -e $config ]; then
    echo "$*" >> $config;
   else
    echo "$*" >  $config;
   fi;
  fi;
 };
 clear;
 show_greetings;
 set_mime_types;
 set_mime_types "text/html     html htm";
 set_mime_types "text/plain    txt text";
 set_mime_types "text/plain    md mkd markdown";
 set_mime_types "text/plain    pas inc dpr lpr";
 set_mime_types "text/plain    cfg crc ini sml log";
 set_mime_types "text/plain    sh bat cmd vbs lua wlua";
 cat $HOME/.mime.types; echo "";
);
make_mime_types_markdown;
