-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
109 lines (95 loc) · 2.55 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
var fs = require("fs");
var inquirer = require("inquirer");
// array of questions for user
const questions = [
{
type: "input",
message:"Enter a Title/Name for your READme",
name:"title"
},
{
type: "input",
message: "Enter a discription for your READme",
name:"discription"
},
{
type:"input",
message: "Enter you installation instructions",
name:"installation"
},
{
type: "input",
messgae: "Enter the usage of your application",
name: "usage"
},
{
type:"input",
message: "Enter the contributor to our application",
name: "contributors"
},
{
type:"checkbox",
message: "Select your Licence",
choices: [
"MIT",
"Appache",
"GNU GPLv3",
"ISC"
],
name:"licence"
},
{
type: "input",
message: "Enter Github username",
name: "username"
},
{
type:"input",
message: "Enter your email adress",
name: "email"
},
];
// function to write README file
function writeReadme(response) {
return `
# ${response.title}
# Table of Contents
- [Description](#description)
- [Installation](#installation)
- [Usage](#usage)
- [Contributions](#contributions)
- [Licence](#licence)
- [Questions](#questions)
## Description: [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
${response.description}
## Installation:
${response.installation}
## Usage:
${response.usage}
## Contributions:
${response.contributors}
## License:
The licence used was: ${response.licence}
Click on licence badge for licence details:
[![License: MIT](https://img.shields.io/badge/License-${response.licence}-yellow.svg)](https://opensource.org/licenses/${response.licence})
## Questions:
If you have any furter questions please contact the following email address:
email: ${response.email}
visit the bellow link to my github porfile for more projects:
-[Github Profile](https://www.github.com/${response.username})
`;
};
// function to initialize program
function init(questions) {
inquirer.prompt(questions).then( response => {
try{
const readme = writeReadme(response);
fs.writeFileSync("Generated_README.md", readme);
console.log("It works");
}catch(err){
console.log(err)
}
});
};
// function call to initialize program
init(questions);