diff --git a/coala_quickstart/Strings.py b/coala_quickstart/Strings.py index d944dcb..9dfad87 100644 --- a/coala_quickstart/Strings.py +++ b/coala_quickstart/Strings.py @@ -26,6 +26,12 @@ "We can help you with that. Let's get started with " 'some basic questions.'] +PROJECT_DIR_HELP = """ +Enter the directory whose contents you want to analyse. +For example, you may want to include your src/ folder. +To do this, simply enter `src/`. To select the present +directory simply press enter and continue. +""" GLOB_HELP_URL = 'http://coala.readthedocs.io/en/latest/Users/Glob_Patterns.html' GLOB_HELP = """ @@ -34,10 +40,8 @@ separated by commas. To learn more about glob patterns please visit: {} -For example, you may want to include your src/ folder and -all its contents but exclude your .git directory and all -.o files. To do this, simply give `src/` for the first -question and `.git/**,**/*.o` for the second question. +For example, you may want to exclude your .git directory and all +.o files. To do this, simply give `.git/**,**/*.o` for this question. """.format(GLOB_HELP_URL) BEAR_DOCS_URL = ('https://github.com/coala/bear-docs/blob/master/' diff --git a/coala_quickstart/coala_quickstart.py b/coala_quickstart/coala_quickstart.py index e6dd8a7..c889b72 100644 --- a/coala_quickstart/coala_quickstart.py +++ b/coala_quickstart/coala_quickstart.py @@ -13,6 +13,7 @@ from coala_quickstart.generation.Project import ( valid_path, get_used_languages, print_used_languages) from coala_quickstart.generation.FileGlobs import get_project_files +from coala_quickstart.Strings import PROJECT_DIR_HELP from coala_quickstart.generation.Bears import ( filter_relevant_bears, print_relevant_bears, @@ -85,6 +86,7 @@ def main(): fpc = FilePathCompleter() fpc.activate() print_welcome_message(printer) + printer.print(PROJECT_DIR_HELP) project_dir = ask_question( 'What is your project directory?', default=project_dir, diff --git a/tests/generation/FileGlobs.py b/tests/generation/FileGlobs.py index 239951c..a14d173 100644 --- a/tests/generation/FileGlobs.py +++ b/tests/generation/FileGlobs.py @@ -3,11 +3,12 @@ from pyprint.ConsolePrinter import ConsolePrinter from coala_utils.ContextManagers import ( - simulate_console_inputs, suppress_stdout) + simulate_console_inputs, suppress_stdout, retrieve_stdout) from coala_utils.FilePathCompleter import FilePathCompleter from coala_quickstart.generation.FileGlobs import get_project_files from coala_quickstart.generation.Utilities import get_gitignore_glob from coalib.collecting.Collectors import collect_files +from coala_quickstart.Strings import GLOB_HELP class TestQuestion(unittest.TestCase): @@ -30,11 +31,13 @@ def test_get_project_files(self): open(os.path.join("ignore_dir", "src.c"), "w").close() open(os.path.join("ignore_dir", "src.js"), "w").close() - with suppress_stdout(), simulate_console_inputs("ignore_dir/**"): + with retrieve_stdout() as custom_stdout, \ + simulate_console_inputs("ignore_dir/**"): res, _ = get_project_files(self.log_printer, self.printer, os.getcwd(), self.file_path_completer) + self.assertIn(GLOB_HELP, custom_stdout.getvalue()) self.assertIn(os.path.normcase( os.path.join(os.getcwd(), "src", "file.c")), res) self.assertIn(os.path.normcase( diff --git a/tests/interaction/Logo.py b/tests/interaction/Logo.py index d9ab234..1dfe846 100644 --- a/tests/interaction/Logo.py +++ b/tests/interaction/Logo.py @@ -4,6 +4,7 @@ from coala_utils.ContextManagers import retrieve_stdout from coala_quickstart.interaction.Logo import ( print_welcome_message, print_side_by_side) +from coala_quickstart.Strings import PROJECT_DIR_HELP class TestLogo(unittest.TestCase): @@ -28,3 +29,8 @@ def test_print_welcome_message(self): with retrieve_stdout() as custom_stdout: print_welcome_message(self.printer) self.assertIn("o88Oo", custom_stdout.getvalue()) + + def test_print_ask_dir_help_message(self): + with retrieve_stdout() as custom_stdout: + self.printer.print(PROJECT_DIR_HELP) + self.assertIn(PROJECT_DIR_HELP, custom_stdout.getvalue())