<commit_before>#!/usr/bin/env bash

no_clipboard=FALSE
quiet=FALSE

function ShowHelp() {
	local -r script_name=`basename $0`

	echo "Using:"
	echo -e "\t$script_name -h | --help"
	echo -e "\t$script_name [-c | --no-clipboard]"
	echo -e "\t$script_name [-q | --quiet]"
	echo ""
	echo "Options:"
	echo -e "\t-h, --help          - show help;"
	echo -e "\t-c, --no-clipboard  - disable a copying to clipboard;"
	echo -e "\t-q, --quiet         - disable a printing to stdout."
}

function ProcessOptions() {
	local -r option="$1"

	case "$option" in
		-h|--help)
			ShowHelp
			exit

			;;
		-c|--no-clipboard)
			no_clipboard=TRUE
			;;
		-q|--quiet)
			quiet=TRUE
			;;
	esac
}

function FindAccessCode() {
	local -r script_path=`dirname $0`

	cat "$script_path/../protected/runtime/application.log" \
		| grep "access code" \
		| tail -1 \
		| awk '{print $NF}'
}

function OutputToStdout() {
	local -r message="$1"

	if [[ $quiet != "TRUE" ]]
	then
		echo "$message"
	fi
}

function CopyToClipboard() {
	local -r message="$1"

	if [[ $no_clipboard != "TRUE" ]]
	then
		printf "$message" | xclip -selection clipboard -i
	fi
}

ProcessOptions "$@"

readonly access_code=`FindAccessCode`
OutputToStdout "$access_code"
CopyToClipboard "$access_code"<commit_msg>Remove clipboard support from the `access_code_finder.sh` script<commit_after>#!/usr/bin/env bash

function ShowHelp() {
	local -r script_name=`basename $0`

	echo "Using:"
	echo -e "\t$script_name [-h | --help]"
	echo ""
	echo "Options:"
	echo -e "\t-h, --help  - show help."
}

function ProcessOptions() {
	local -r option="$1"

	case "$option" in
		-h|--help)
			ShowHelp
			exit

			;;
	esac
}

function FindAccessCode() {
	local -r script_path=`dirname $0`

	cat "$script_path/../protected/runtime/application.log" \
		| grep "access code" \
		| tail -1 \
		| awk '{print $NF}'
}

function OutputToStdout() {
	local -r message="$1"

	echo "$message"
}

ProcessOptions "$@"

readonly access_code=`FindAccessCode`
OutputToStdout "$access_code"
{'fraction_non_alphanumeric': 0.16974538192710933, 'fraction_numerical': 0.0054917623564653024, 'mean_word_length': 3.192468619246862, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5973710', 'n_tokens_mistral': 811, 'n_tokens_neox': 741, 'n_words': 190}