<commit_before>"""Command line interface handler.

Todo:
    * Add color text in command line
    * Add translation to options
"""

from html_builder import HtmlSheet
import language_strings


class SheetWizard(object):
	"""Creation Wizard for sheet maker.

	Each new html block added will need a new Method to handle each of the
	attributes needed to build it in "html_builder"
	
	"""
	

	def __init__(self, version):
		"""Return a SheetWizard object.
		
		Args:
			version (str): Script version.

		Attrib:
			version (str): Script version.
			lang_strings (dict): Contains all message strings.
			self.title (str): Html file name.
			self.columns (int): Number of main columns.
			NewSheet (obj): HtmlSheet object instance.

		"""
		self.version = version


	def input_handler(self, options):
		"""Handle all inputs. Input validation must be done on each method.

		Args:
			options (dict): Text options that can be selected

		
		Returns:
			answer (str): Text typed by the user.
		"""
		input_text = ""
		for key, value in options.items():
			input_text = "{0}{1}. {2}\n".format(input_text, key, value)
		return(input(input_text))


	def menu_language(self):
		"""Displays language selector"""
		print("Choose your language:")
		options = { 1: "English",
				    2: "Español (NOT CODED YET)",
				  }
		answer = self.input_handler(options)
		if answer == "1":
			self.lang_strings = language_strings.english
		elif answer == "2":
			self.lang_strings = language_strings.espanol
		else:
			self.menu_language()


	def intro(self):
		"""Displays text intro to SheetWizard"""
		print("{0} {1}".format(self.lang_strings["INTRO_MESSAGE"] ,self.version))


	def main_menu(self):
		"""Displays and handles all menu options"""
		print(self.lang_strings["MENU_MESSAGE"])
		options = { 1: "Create sheet",
				    2: "Export (NOT CODED YET)"
				    3: "Help (NOT CODED YET)",
				  }
		answer = self.input_handler(options)
		if answer == "1":
			self.config_sheet()
		elif answer == "2":
			self.export() #not coded yet
		else:
			print(self.lang_strings["INVALID_INPUT_MESSAGE"])
			self.main_menu()


	def config_sheet(self):
		"""Displays basic sheet styler. Creates a HtmlSheet object instance.

		Method will ask for HtmlSheet attributes.
		"""
		print(self.lang_strings["CONFIG_SHEET_MESSAGE1"])
		options = { 1: "What is your sheet title? ('CheatSheet' is added automaticaly)"
				  }<commit_msg>Intro message improved<commit_after>"""Command line interface handler.

Todo:
    * Add color text in command line
    * Add translation to options
"""

from html_builder import HtmlSheet
import language_strings


class SheetWizard(object):
	"""Creation Wizard for sheet maker.

	Each new html block added will need a new Method to handle each of the
	attributes needed to build it in "html_builder"
	
	"""
	

	def __init__(self, version):
		"""Return a SheetWizard object.
		
		Args:
			version (str): Script version.

		Attrib:
			version (str): Script version.
			lang_strings (dict): Contains all message strings.
			self.title (str): Html file name.
			self.columns (int): Number of main columns.
			NewSheet (obj): HtmlSheet object instance.

		"""
		self.version = version


	def input_handler(self, options):
		"""Handle all inputs. Input validation must be done on each method.

		Args:
			options (dict): Text options that can be selected

		
		Returns:
			answer (str): Text typed by the user.
		"""
		input_text = ""
		for key, value in options.items():
			input_text = "{0}{1}. {2}\n".format(input_text, key, value)
		return(input(input_text))


	def menu_language(self):
		"""Displays language selector"""
		print("Choose your language:")
		options = { 1: "English",
				    2: "Español (NOT CODED YET)",
				  }
		answer = self.input_handler(options)
		if answer == "1":
			self.lang_strings = language_strings.english
		elif answer == "2":
			self.lang_strings = language_strings.espanol
		else:
			self.menu_language()


	def intro(self):
		"""Displays text intro to SheetWizard"""
		print("##################################################################")
		print("#                                                                #")
		print("#                                                                #")
		print("#                 {0} {1}                #".format(self.lang_strings["INTRO_MESSAGE"] ,self.version))
		print("#                                                                #")
		print("#                                                                #")
		print("##################################################################")

	def main_menu(self):
		"""Displays and handles all menu options"""
		print(self.lang_strings["MENU_MESSAGE"])
		options = { 1: "Create sheet",
				    2: "Export (NOT CODED YET)",
				    3: "Help (NOT CODED YET)",
				  }
		answer = self.input_handler(options)
		if answer == "1":
			self.config_sheet()
		elif answer == "2":
			self.export() #not coded yet
		else:
			print(self.lang_strings["INVALID_INPUT_MESSAGE"])
			self.main_menu()


	def config_sheet(self):
		"""Displays basic sheet styler. Creates a HtmlSheet object instance.

		Method will ask for HtmlSheet attributes.
		"""
		print(self.lang_strings["CONFIG_SHEET_MESSAGE1"])
		options = { 1: "What is your sheet title? ('CheatSheet' is added automaticaly)"
				  }
{'fraction_non_alphanumeric': 0.14035418236623964, 'fraction_numerical': 0.006028636021100226, 'mean_word_length': 2.9827456864216053, 'pattern_counts': {'":': 8, '<': 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': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2981861', 'n_tokens_mistral': 1793, 'n_tokens_neox': 1535, 'n_words': 494}