#!/usr/bin/env -S 9 rc
# CHAOTIC SOFTWARE : BEWARE

# GEMINI
# https://gemini.circumlunar.space/docs/specification.html

. gemini.rc
fn gemget_help {
		echo usage: gemget URL >[1=2]
		echo only gemini urls are supported >[1=2]
		echo cert $client_cert
		echo key $client_key
}
switch ($1) {
	case gemini:*
		gemini_request $1 | 9 tail -n +2
	case -raw
		shift
		gemini_request $1 $client_cert $client_key
	case -auth
		shift
		gemini_request $1 $client_cert $client_key | 9 tail -n +2
	case -info
		shift
		gemini_info $1
	case -h
		gemget_help
	case *
		gemget_help
}
