@@ -3,14 +3,16 @@ const auth = require('../auth');
33
44/**
55 * Create a github repository
6- * @param {String } name The name for the github project
6+ * @param {String } name The name for the github project
77 * @param {Boolean } [isPrivate=false] Defines is the project will be created as private
88 * or public on github
9+ * @param {String } [description=''] The description for the github project
10+ * @param {String } [ul=''] The url for the github project
911 * @return {json|Boolean } In case of success will return the json from the
1012 * github api response, otherwise, return false.
1113 * @throws If the token is not present
1214 */
13- async function create ( name , isPrivate = false ) {
15+ async function create ( name , isPrivate = false , description = '' , url = '' ) {
1416 let token = '' ;
1517 let result ;
1618
@@ -22,8 +24,7 @@ async function create(name, isPrivate = false) {
2224
2325 console . log ( 'Creating github repository...\n' ) ;
2426 // TODO consider use http instead curl?
25- // TODO Include description, website and keywords
26- const cmd = `curl -w "%{http_code}" -H "Authorization: token ${ token } " -d '{"name": "${ name } ", "private": ${ isPrivate } }' https://api.github.com/user/repos` ;
27+ const cmd = `curl -w "%{http_code}" -H "Authorization: token ${ token } " -d '{"name": "${ name } ", "private": ${ isPrivate } , "description": "${ description } ", "homepage": "${ url } "}' https://api.github.com/user/repos` ;
2728
2829 try {
2930 result = await utils . execp ( cmd ) ;
@@ -100,6 +101,8 @@ async function deleteRepo(name, user) {
100101 } ;
101102}
102103
104+ // TODO include a method to handle the topics (will require to get the github user)
105+
103106module . exports = {
104107 create,
105108 deleteRepo,
0 commit comments