diff --git a/src/Command/Markdown/Builder.php b/src/Command/Markdown/Builder.php index 7666b1f..9d9489c 100644 --- a/src/Command/Markdown/Builder.php +++ b/src/Command/Markdown/Builder.php @@ -33,10 +33,10 @@ class Builder public function __construct(array $data) { - $this->probjectName = $data['name']; + $this->projectName = $data['name']; $this->heading = $data['heading']; $this->description = $data['description']; - $this->projectRequirements = $data['requirements']; + $this->requirements = $data['requirements']; $this->authorName = $data['author']; $this->authorEmail = $data['email']; $this->authorWebpage = $data['webpage']; @@ -70,7 +70,7 @@ private function parse(string $contents): string ':DESCRIPTION:', ':REQUIREMENTS:', ':AUTHOR-NAME:', - ':EMAIL:', + ':AUTHOR-EMAIL:', ':AUTHOR-URL:', ':LICENSE-NAME:', ':LICENSE-LINK:', diff --git a/src/Command/Markdown/Generator.php b/src/Command/Markdown/Generator.php index ea7c1db..0c52f6d 100644 --- a/src/Command/Markdown/Generator.php +++ b/src/Command/Markdown/Generator.php @@ -74,6 +74,7 @@ private function treatFields(InputInterface $input, OutputInterface $output): ar $name = $this->promptName($io); $heading = $this->promptHeading($io); $description = $this->promptDescription($io); + $requirements = $this->promptRequirements($io); $author = $this->promptAuthor($io); $email = $this->promptEmail($io); $webpage = $this->promptHomepageUrl($io); @@ -84,6 +85,7 @@ private function treatFields(InputInterface $input, OutputInterface $output): ar 'name' => $name, 'heading' => $heading, 'description' => $description, + 'requirements' => $requirements, 'author' => $author, 'email' => $email, 'webpage' => $webpage, @@ -99,21 +101,21 @@ private function treatFields(InputInterface $input, OutputInterface $output): ar private function promptName(SymfonyStyle $io): string { - $heading = $io->ask('Project Name'); + $name = $io->ask('Project Name'); - if (!$this->isFieldFilled($heading)) { + if (!$this->isFieldFilled($name)) { throw new EmptyFieldException('Mention a name for your project 😺'); } - return $heading; + return $name; } private function promptHeading(SymfonyStyle $io): string { - $heading = $io->ask('Project Heading'); + $heading = $io->ask('Project Heading/Summary'); if (!$this->isFieldFilled($heading)) { - throw new EmptyFieldException('Mention the README heading.'); + throw new EmptyFieldException('Mention the README heading or a small summary.'); } return $heading; @@ -130,6 +132,17 @@ private function promptDescription(SymfonyStyle $io): string return $description; } + private function promptRequirements(SymfonyStyle $io): string + { + $requirements = $io->ask('Requirements / Installation?'); + + if (!$this->isFieldFilled($requirements)) { + throw new EmptyFieldException('What are the requirements/Installation steps for this project?'); + } + + return $requirements; + } + private function promptAuthor(SymfonyStyle $io): string { $authorName = $io->ask('Author Name'); @@ -143,7 +156,7 @@ private function promptAuthor(SymfonyStyle $io): string private function promptEmail(SymfonyStyle $io): string { - $email = $io->ask('Author Email'); + $email = $io->ask('Author Email (will be also used for your gravatar)'); if (!$this->isFieldFilled($email)) { throw new EmptyFieldException('Author email is required.'); diff --git a/src/Command/Markdown/view/readme-template.md b/src/Command/Markdown/view/readme-template.md index ac13ff1..1159b55 100644 --- a/src/Command/Markdown/view/readme-template.md +++ b/src/Command/Markdown/view/readme-template.md @@ -18,23 +18,21 @@ ## 🪄 Author -I'm **[:AUTHOR-NAME:][:AUTHOR-URL:]**. A passionate, zen & dedicated software engineer 😊 +I'm **[:AUTHOR-NAME:](:AUTHOR-URL:)**. A passionate, zen & dedicated software engineer 😊 +You can contact me at: *:AUTHOR-EMAIL:* -![[github-url]][github-image]][github-url] +[![:GITHUB-USERNAME:][github-image]](https://github.com/:GITHUB-USERNAME:) --- -[![:AUTHOR-NAME:](:GRAVATAR:)](:AUTHOR-URL: ":AUTHOR-NAME:, a Software Developer") +[![:AUTHOR-NAME:](:GRAVATAR-IMAGE:)](:AUTHOR-URL: ":AUTHOR-NAME:, a Software Developer") ## 📃 License pH2Gravatar is distributed under [:LICENSE-NAME:](:LICENSE-LINK:) license 🚀 Enjoy! ❤️ -[author-url]: :AUTHOR-URL: -[license-url]: :LICENSE-LINK: -[github-url]: https://github.com/:GITHUB-USERNAME: [github-image]: https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white