<commit_before>#!/bin/bash

# variables
action=$1

name=$2
Name=$3
author=$4
email=$5
description=$6

# validation

if [ "$name" = "" ]; then
	echo 'Name parameter is required.'
	exit 0
fi

if [ "$action" = "create" ]; then
	
	if [ -d ../../$name-module ]; then
		echo "Module '$name' already exists."
		exit 0
	fi

	# copy default module directory
	cp -r ../AdminModule/static/default-module ../../$name-module
	
	# rename files
	find ../../$name-module -name 'Name*' -type f -exec bash -c "mv \"\$1\" \"\${1/Name/$Name}\"" -- {} \;
	find ../../$name-module -name 'Name*' -type d -exec bash -c "mv \"\$1\" \"\${1/Name/$Name}\"" -- {} \;

	# replace variables
	grep -rl '#Name#' ../../$name-module | xargs sed -i "s/#Name#/$Name/g"
	grep -rl '#name#' ../../$name-module | xargs sed -i "s/#name#/$name/g"
	grep -rl '#Author#' ../../$name-module | xargs sed -i "s/#Author#/$author/g"
	grep -rl '#AuthorEmail#' ../../$name-module | xargs sed -i "s/#AuthorEmail#/$email/g"
	grep -rl '#Description#' ../../$name-module | xargs sed -i "s/#Description#/$description/g"
<commit_msg>Fixed new module creation.<commit_after>#!/bin/bash

# variables
action=$1

name=$2
Name=$3
author=$4
email=$5
description=$6

# validation

if [ "$name" = "" ]; then
	echo 'Name parameter is required.'
	exit 0
fi

if [ "$action" = "create" ]; then
	
	if [ -d ../../$name-module ]; then
		echo "Module '$name' already exists."
		exit 0
	fi

	# copy default module directory
	tar -xf ../AdminModule/static/default-module.tar ../../$name-module
	
	# rename files
	find ../../$name-module -name 'Name*' -type f -exec bash -c "mv \"\$1\" \"\${1/Name/$Name}\"" -- {} \;
	find ../../$name-module -name 'Name*' -type d -exec bash -c "mv \"\$1\" \"\${1/Name/$Name}\"" -- {} \;

	# replace variables
	grep -rl '#Name#' ../../$name-module | xargs sed -i "s/#Name#/$Name/g"
	grep -rl '#name#' ../../$name-module | xargs sed -i "s/#name#/$name/g"
	grep -rl '#Author#' ../../$name-module | xargs sed -i "s/#Author#/$author/g"
	grep -rl '#AuthorEmail#' ../../$name-module | xargs sed -i "s/#AuthorEmail#/$email/g"
	grep -rl '#Description#' ../../$name-module | xargs sed -i "s/#Description#/$description/g"

{'fraction_non_alphanumeric': 0.25288417166589755, 'fraction_numerical': 0.011075219197046609, 'mean_word_length': 2.6133333333333333, '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': '6154382', 'n_tokens_mistral': 844, 'n_tokens_neox': 779, 'n_words': 227}