#!/bin/bash

command=${1?Need command}

command_type=$(type -t "$command")
if [[ $? != 0 ]]; then
    printf "%s\n" "$command not found"
    exit 1
fi

if [[ $command_type != file ]]; then
    printf "%s\n" "$command is not a script"
    exit 1
fi

command=$(which "$command")

if file "$command" | cut -d: -f 2- | grep -q ELF; then
    printf "%s\n" "$command is a binary"
    exit 1
fi

more=more
command -v bat &>/dev/null && more=bat
$more "$command"
