From c6e41c605a7725768569ae8880f99ed8f318ab37 Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Thu, 2 May 2019 19:16:38 -0400 Subject: [PATCH 01/19] added default example filename --- Makefile | 4 + cmd/generate_example.go | 9 +- mytest.json | 226 ++++++++++++++++++++++++++++++++++++++++ resume_example.json | 226 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 463 insertions(+), 2 deletions(-) create mode 100644 mytest.json create mode 100644 resume_example.json diff --git a/Makefile b/Makefile index fdeb0f8..5afa506 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,10 @@ release: pre-build @go build -ldflags "-s -w -X $(CODEPATH)/cmd.version=$(RESUMIC_VERSION) -X $(CODEPATH)/cmd.gitCommit=$(GITCOMMIT)" -o resumic @packr2 clean +nopackr: # Builds without installing packr. Useful if offline. + @go build -ldflags "-s -w -X $(CODEPATH)/cmd.version=$(RESUMIC_VERSION) -X $(CODEPATH)/cmd.gitCommit=$(GITCOMMIT)" -o resumic + + test: build go test -v ./... diff --git a/cmd/generate_example.go b/cmd/generate_example.go index e93eca2..fb928b0 100644 --- a/cmd/generate_example.go +++ b/cmd/generate_example.go @@ -10,7 +10,12 @@ import ( ) func generateExampleRun(cmd *cobra.Command, args []string) error { - examplePath := args[0] + var examplePath string + if len(args) == 0 { + examplePath = "resume_example.json" + } else { + examplePath = args[0] + } example, err := schema.GenerateExample() if err != nil { return fmt.Errorf("Couldn't generate the example: %s", err) @@ -30,7 +35,7 @@ func generateExampleRun(cmd *cobra.Command, args []string) error { var generateExampleCmd = &cobra.Command{ Use: "example PATH", Short: "Generate an example json resume", - Args: cobra.ExactArgs(1), + Args: cobra.MaximumNArgs(1), RunE: generateExampleRun, } diff --git a/mytest.json b/mytest.json new file mode 100644 index 0000000..3976826 --- /dev/null +++ b/mytest.json @@ -0,0 +1,226 @@ +{ + "core": { + "title": "Software Engineer", + "workArea": "Munich Citycenter + 20kms", + "livingArea": "Germany" + }, + "personal": { + "name": "John Doe", + "gender": "male", + "image": "example.com/Abcxyz", + "email": "lucas@example.com", + "phone": "912-217-7923", + "url": "http://www.example.com/", + "summary": "The man who sold the world!", + "currentLocation": { + "lat": 35.712758, + "long": 51.392114 + }, + "permanentLocation": { + "lat": 35.712758, + "long": 51.392114 + }, + "birthday": "1995-02-14", + "birthPlace": "Munich", + "profiles": [ + { + "network": "github", + "username": "john_doe", + "url": "https://github.com/john_doe" + } + ], + "relationshipStatus": "married", + "postalAddress": "John Doe, Wittekindshof, Schulstrasse 4, 32547 Bad Oyenhausen, Germany" + }, + "work": [ + { + "name": "XYZ Inc", + "description": "A social media company", + "position": "Software Engineer", + "location": { + "lat": 35.712758, + "long": 51.392114 + }, + "url": "http://xyz.example.com", + "startDate": "2017-12-29", + "endDate": "2018-12-29", + "summary": "Developing and maintaining the company website using syna", + "highlights": [ + "Worked with mobile team at Twitter to develop remote debugging tools for mobile browsers" + ] + } + ], + "education": [ + { + "institution": "XYZ Institute of Technology", + "location": { + "lat": 35.712758, + "long": 51.392114 + }, + "area": "Engineering", + "studyType": "Bachelor", + "startDate": "2017-06-28", + "endDate": "2013-06-28", + "score": { + "type": "GPA", + "value": "3.4", + "best": "4", + "worst": "0" + }, + "courses": [ + "CS302 - Introduction to Algorithms" + ], + "honors": [ + "Magna Cum Laude" + ], + "highlights": [ + "Live abroad within a new culture" + ] + } + ], + "volunteer": [ + { + "organization": "Xyz", + "position": "Open Source Contributor", + "location": { + "lat": 35.712758, + "long": 51.392114 + }, + "url": "http://xyz.example.com", + "startDate": "2014-06-29", + "endDate": "2017-06-29", + "summary": "Frontend developer", + "highlights": [ + "Invited as a speaker in Xyzcon'17" + ] + } + ], + "publications": [ + { + "name": "Deep learning and Artificial Intelligence", + "publisher": "XYZ, Computer Magazine", + "releaseDate": "2015-08-01", + "resources": [ + { + "url": "http://www.example.com/my-example-slides/", + "label": "Slides" + } + ], + "url": "http://www.computer.org.example.com/csdl/mags/co/2015/10/rx069-abs.html", + "summary": "Discussion of the advent of deep learning and artificial intelligence" + } + ], + "legal": [ + { + "name": "XYZ's patent on LZW compression, a fundamental part of the widely used GIF graphics format", + "legalType": "Patent, Trademark, Copyright", + "description": "Some legal document!", + "applicationDate": "2015-08-01", + "grantDate": "2016-09-01", + "endDate": "2020-09-03", + "resources": [ + { + "url": "http://www.example.com/my-example-slides/", + "label": "Slides" + } + ], + "idNumber": "JP2004369746A", + "currentAssignee": "John Doe", + "previousAssignee": "John Doe", + "author": "John Doe", + "coAuthors": "John Doe" + } + ], + "skills": [ + { + "name": "Web Development", + "proficiency": "advanced", + "keywords": [ + "HTML" + ] + } + ], + "awards": [ + { + "title": "Awarded Software Process Achievement Award", + "date": "2016-06-12", + "awarder": "IEEE", + "summary": "Received for my work in Deep learning and AI" + } + ], + "projects": [ + { + "name": "File Transfer application", + "location": { + "lat": 35.712758, + "long": 51.392114 + }, + "description": "Developed a client and server based application", + "highlights": [ + "used Java AWT and Swing for client side userinterface" + ], + "keywords": [ + "Java" + ], + "startDate": "2016-06-29", + "endDate": "2017-03-02", + "resources": [ + { + "url": "http://www.example.com/my-example-slides/", + "label": "Slides" + } + ], + "url": "http://www.example.org/csdl/mags/co/1996/10/rx069-abs.html", + "roles": [ + "Team Lead" + ], + "entity": "greenpeace", + "type": "volunteering" + } + ], + "certificate": [ + { + "code": "1Z0-062", + "name": "XYZ Certified Application Specialist (MCAS)", + "website": "http://www.example.org", + "verification": "http://www.example.org", + "grantDate": "2017-06-29", + "score": { + "type": "GPA", + "value": "3.4", + "best": "4", + "worst": "0" + }, + "endDate": "2017-06-29", + "doesNotExpire": true + } + ], + "references": [ + { + "name": "Stephan Mark", + "company": "Xyz", + "position": "Senior Software Engineer", + "reference": "Joe blogs was a great employee, who turned up to work at least once a week. He exceeded my expectations when it came to doing nothing." + } + ], + "languages": [ + { + "language": "English", + "level": "fluent" + } + ], + "interests": [ + { + "name": "Machine Learning", + "keywords": [ + "Neural Networks" + ] + } + ], + "meta": { + "canonical": "", + "version": "v1.0.0", + "lastModified": "2017-06-29T15:53:01+01:00", + "uuid": "078c39ce-23ee-4970-9637-c07379132dce" + } +} \ No newline at end of file diff --git a/resume_example.json b/resume_example.json new file mode 100644 index 0000000..3976826 --- /dev/null +++ b/resume_example.json @@ -0,0 +1,226 @@ +{ + "core": { + "title": "Software Engineer", + "workArea": "Munich Citycenter + 20kms", + "livingArea": "Germany" + }, + "personal": { + "name": "John Doe", + "gender": "male", + "image": "example.com/Abcxyz", + "email": "lucas@example.com", + "phone": "912-217-7923", + "url": "http://www.example.com/", + "summary": "The man who sold the world!", + "currentLocation": { + "lat": 35.712758, + "long": 51.392114 + }, + "permanentLocation": { + "lat": 35.712758, + "long": 51.392114 + }, + "birthday": "1995-02-14", + "birthPlace": "Munich", + "profiles": [ + { + "network": "github", + "username": "john_doe", + "url": "https://github.com/john_doe" + } + ], + "relationshipStatus": "married", + "postalAddress": "John Doe, Wittekindshof, Schulstrasse 4, 32547 Bad Oyenhausen, Germany" + }, + "work": [ + { + "name": "XYZ Inc", + "description": "A social media company", + "position": "Software Engineer", + "location": { + "lat": 35.712758, + "long": 51.392114 + }, + "url": "http://xyz.example.com", + "startDate": "2017-12-29", + "endDate": "2018-12-29", + "summary": "Developing and maintaining the company website using syna", + "highlights": [ + "Worked with mobile team at Twitter to develop remote debugging tools for mobile browsers" + ] + } + ], + "education": [ + { + "institution": "XYZ Institute of Technology", + "location": { + "lat": 35.712758, + "long": 51.392114 + }, + "area": "Engineering", + "studyType": "Bachelor", + "startDate": "2017-06-28", + "endDate": "2013-06-28", + "score": { + "type": "GPA", + "value": "3.4", + "best": "4", + "worst": "0" + }, + "courses": [ + "CS302 - Introduction to Algorithms" + ], + "honors": [ + "Magna Cum Laude" + ], + "highlights": [ + "Live abroad within a new culture" + ] + } + ], + "volunteer": [ + { + "organization": "Xyz", + "position": "Open Source Contributor", + "location": { + "lat": 35.712758, + "long": 51.392114 + }, + "url": "http://xyz.example.com", + "startDate": "2014-06-29", + "endDate": "2017-06-29", + "summary": "Frontend developer", + "highlights": [ + "Invited as a speaker in Xyzcon'17" + ] + } + ], + "publications": [ + { + "name": "Deep learning and Artificial Intelligence", + "publisher": "XYZ, Computer Magazine", + "releaseDate": "2015-08-01", + "resources": [ + { + "url": "http://www.example.com/my-example-slides/", + "label": "Slides" + } + ], + "url": "http://www.computer.org.example.com/csdl/mags/co/2015/10/rx069-abs.html", + "summary": "Discussion of the advent of deep learning and artificial intelligence" + } + ], + "legal": [ + { + "name": "XYZ's patent on LZW compression, a fundamental part of the widely used GIF graphics format", + "legalType": "Patent, Trademark, Copyright", + "description": "Some legal document!", + "applicationDate": "2015-08-01", + "grantDate": "2016-09-01", + "endDate": "2020-09-03", + "resources": [ + { + "url": "http://www.example.com/my-example-slides/", + "label": "Slides" + } + ], + "idNumber": "JP2004369746A", + "currentAssignee": "John Doe", + "previousAssignee": "John Doe", + "author": "John Doe", + "coAuthors": "John Doe" + } + ], + "skills": [ + { + "name": "Web Development", + "proficiency": "advanced", + "keywords": [ + "HTML" + ] + } + ], + "awards": [ + { + "title": "Awarded Software Process Achievement Award", + "date": "2016-06-12", + "awarder": "IEEE", + "summary": "Received for my work in Deep learning and AI" + } + ], + "projects": [ + { + "name": "File Transfer application", + "location": { + "lat": 35.712758, + "long": 51.392114 + }, + "description": "Developed a client and server based application", + "highlights": [ + "used Java AWT and Swing for client side userinterface" + ], + "keywords": [ + "Java" + ], + "startDate": "2016-06-29", + "endDate": "2017-03-02", + "resources": [ + { + "url": "http://www.example.com/my-example-slides/", + "label": "Slides" + } + ], + "url": "http://www.example.org/csdl/mags/co/1996/10/rx069-abs.html", + "roles": [ + "Team Lead" + ], + "entity": "greenpeace", + "type": "volunteering" + } + ], + "certificate": [ + { + "code": "1Z0-062", + "name": "XYZ Certified Application Specialist (MCAS)", + "website": "http://www.example.org", + "verification": "http://www.example.org", + "grantDate": "2017-06-29", + "score": { + "type": "GPA", + "value": "3.4", + "best": "4", + "worst": "0" + }, + "endDate": "2017-06-29", + "doesNotExpire": true + } + ], + "references": [ + { + "name": "Stephan Mark", + "company": "Xyz", + "position": "Senior Software Engineer", + "reference": "Joe blogs was a great employee, who turned up to work at least once a week. He exceeded my expectations when it came to doing nothing." + } + ], + "languages": [ + { + "language": "English", + "level": "fluent" + } + ], + "interests": [ + { + "name": "Machine Learning", + "keywords": [ + "Neural Networks" + ] + } + ], + "meta": { + "canonical": "", + "version": "v1.0.0", + "lastModified": "2017-06-29T15:53:01+01:00", + "uuid": "078c39ce-23ee-4970-9637-c07379132dce" + } +} \ No newline at end of file From 7224c6650111dd4005c383f256897745e93d5ceb Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Fri, 3 May 2019 11:57:08 -0400 Subject: [PATCH 02/19] got rid of sample output files --- mytest.json | 226 -------------------------------------------- resume_example.json | 226 -------------------------------------------- 2 files changed, 452 deletions(-) delete mode 100644 mytest.json delete mode 100644 resume_example.json diff --git a/mytest.json b/mytest.json deleted file mode 100644 index 3976826..0000000 --- a/mytest.json +++ /dev/null @@ -1,226 +0,0 @@ -{ - "core": { - "title": "Software Engineer", - "workArea": "Munich Citycenter + 20kms", - "livingArea": "Germany" - }, - "personal": { - "name": "John Doe", - "gender": "male", - "image": "example.com/Abcxyz", - "email": "lucas@example.com", - "phone": "912-217-7923", - "url": "http://www.example.com/", - "summary": "The man who sold the world!", - "currentLocation": { - "lat": 35.712758, - "long": 51.392114 - }, - "permanentLocation": { - "lat": 35.712758, - "long": 51.392114 - }, - "birthday": "1995-02-14", - "birthPlace": "Munich", - "profiles": [ - { - "network": "github", - "username": "john_doe", - "url": "https://github.com/john_doe" - } - ], - "relationshipStatus": "married", - "postalAddress": "John Doe, Wittekindshof, Schulstrasse 4, 32547 Bad Oyenhausen, Germany" - }, - "work": [ - { - "name": "XYZ Inc", - "description": "A social media company", - "position": "Software Engineer", - "location": { - "lat": 35.712758, - "long": 51.392114 - }, - "url": "http://xyz.example.com", - "startDate": "2017-12-29", - "endDate": "2018-12-29", - "summary": "Developing and maintaining the company website using syna", - "highlights": [ - "Worked with mobile team at Twitter to develop remote debugging tools for mobile browsers" - ] - } - ], - "education": [ - { - "institution": "XYZ Institute of Technology", - "location": { - "lat": 35.712758, - "long": 51.392114 - }, - "area": "Engineering", - "studyType": "Bachelor", - "startDate": "2017-06-28", - "endDate": "2013-06-28", - "score": { - "type": "GPA", - "value": "3.4", - "best": "4", - "worst": "0" - }, - "courses": [ - "CS302 - Introduction to Algorithms" - ], - "honors": [ - "Magna Cum Laude" - ], - "highlights": [ - "Live abroad within a new culture" - ] - } - ], - "volunteer": [ - { - "organization": "Xyz", - "position": "Open Source Contributor", - "location": { - "lat": 35.712758, - "long": 51.392114 - }, - "url": "http://xyz.example.com", - "startDate": "2014-06-29", - "endDate": "2017-06-29", - "summary": "Frontend developer", - "highlights": [ - "Invited as a speaker in Xyzcon'17" - ] - } - ], - "publications": [ - { - "name": "Deep learning and Artificial Intelligence", - "publisher": "XYZ, Computer Magazine", - "releaseDate": "2015-08-01", - "resources": [ - { - "url": "http://www.example.com/my-example-slides/", - "label": "Slides" - } - ], - "url": "http://www.computer.org.example.com/csdl/mags/co/2015/10/rx069-abs.html", - "summary": "Discussion of the advent of deep learning and artificial intelligence" - } - ], - "legal": [ - { - "name": "XYZ's patent on LZW compression, a fundamental part of the widely used GIF graphics format", - "legalType": "Patent, Trademark, Copyright", - "description": "Some legal document!", - "applicationDate": "2015-08-01", - "grantDate": "2016-09-01", - "endDate": "2020-09-03", - "resources": [ - { - "url": "http://www.example.com/my-example-slides/", - "label": "Slides" - } - ], - "idNumber": "JP2004369746A", - "currentAssignee": "John Doe", - "previousAssignee": "John Doe", - "author": "John Doe", - "coAuthors": "John Doe" - } - ], - "skills": [ - { - "name": "Web Development", - "proficiency": "advanced", - "keywords": [ - "HTML" - ] - } - ], - "awards": [ - { - "title": "Awarded Software Process Achievement Award", - "date": "2016-06-12", - "awarder": "IEEE", - "summary": "Received for my work in Deep learning and AI" - } - ], - "projects": [ - { - "name": "File Transfer application", - "location": { - "lat": 35.712758, - "long": 51.392114 - }, - "description": "Developed a client and server based application", - "highlights": [ - "used Java AWT and Swing for client side userinterface" - ], - "keywords": [ - "Java" - ], - "startDate": "2016-06-29", - "endDate": "2017-03-02", - "resources": [ - { - "url": "http://www.example.com/my-example-slides/", - "label": "Slides" - } - ], - "url": "http://www.example.org/csdl/mags/co/1996/10/rx069-abs.html", - "roles": [ - "Team Lead" - ], - "entity": "greenpeace", - "type": "volunteering" - } - ], - "certificate": [ - { - "code": "1Z0-062", - "name": "XYZ Certified Application Specialist (MCAS)", - "website": "http://www.example.org", - "verification": "http://www.example.org", - "grantDate": "2017-06-29", - "score": { - "type": "GPA", - "value": "3.4", - "best": "4", - "worst": "0" - }, - "endDate": "2017-06-29", - "doesNotExpire": true - } - ], - "references": [ - { - "name": "Stephan Mark", - "company": "Xyz", - "position": "Senior Software Engineer", - "reference": "Joe blogs was a great employee, who turned up to work at least once a week. He exceeded my expectations when it came to doing nothing." - } - ], - "languages": [ - { - "language": "English", - "level": "fluent" - } - ], - "interests": [ - { - "name": "Machine Learning", - "keywords": [ - "Neural Networks" - ] - } - ], - "meta": { - "canonical": "", - "version": "v1.0.0", - "lastModified": "2017-06-29T15:53:01+01:00", - "uuid": "078c39ce-23ee-4970-9637-c07379132dce" - } -} \ No newline at end of file diff --git a/resume_example.json b/resume_example.json deleted file mode 100644 index 3976826..0000000 --- a/resume_example.json +++ /dev/null @@ -1,226 +0,0 @@ -{ - "core": { - "title": "Software Engineer", - "workArea": "Munich Citycenter + 20kms", - "livingArea": "Germany" - }, - "personal": { - "name": "John Doe", - "gender": "male", - "image": "example.com/Abcxyz", - "email": "lucas@example.com", - "phone": "912-217-7923", - "url": "http://www.example.com/", - "summary": "The man who sold the world!", - "currentLocation": { - "lat": 35.712758, - "long": 51.392114 - }, - "permanentLocation": { - "lat": 35.712758, - "long": 51.392114 - }, - "birthday": "1995-02-14", - "birthPlace": "Munich", - "profiles": [ - { - "network": "github", - "username": "john_doe", - "url": "https://github.com/john_doe" - } - ], - "relationshipStatus": "married", - "postalAddress": "John Doe, Wittekindshof, Schulstrasse 4, 32547 Bad Oyenhausen, Germany" - }, - "work": [ - { - "name": "XYZ Inc", - "description": "A social media company", - "position": "Software Engineer", - "location": { - "lat": 35.712758, - "long": 51.392114 - }, - "url": "http://xyz.example.com", - "startDate": "2017-12-29", - "endDate": "2018-12-29", - "summary": "Developing and maintaining the company website using syna", - "highlights": [ - "Worked with mobile team at Twitter to develop remote debugging tools for mobile browsers" - ] - } - ], - "education": [ - { - "institution": "XYZ Institute of Technology", - "location": { - "lat": 35.712758, - "long": 51.392114 - }, - "area": "Engineering", - "studyType": "Bachelor", - "startDate": "2017-06-28", - "endDate": "2013-06-28", - "score": { - "type": "GPA", - "value": "3.4", - "best": "4", - "worst": "0" - }, - "courses": [ - "CS302 - Introduction to Algorithms" - ], - "honors": [ - "Magna Cum Laude" - ], - "highlights": [ - "Live abroad within a new culture" - ] - } - ], - "volunteer": [ - { - "organization": "Xyz", - "position": "Open Source Contributor", - "location": { - "lat": 35.712758, - "long": 51.392114 - }, - "url": "http://xyz.example.com", - "startDate": "2014-06-29", - "endDate": "2017-06-29", - "summary": "Frontend developer", - "highlights": [ - "Invited as a speaker in Xyzcon'17" - ] - } - ], - "publications": [ - { - "name": "Deep learning and Artificial Intelligence", - "publisher": "XYZ, Computer Magazine", - "releaseDate": "2015-08-01", - "resources": [ - { - "url": "http://www.example.com/my-example-slides/", - "label": "Slides" - } - ], - "url": "http://www.computer.org.example.com/csdl/mags/co/2015/10/rx069-abs.html", - "summary": "Discussion of the advent of deep learning and artificial intelligence" - } - ], - "legal": [ - { - "name": "XYZ's patent on LZW compression, a fundamental part of the widely used GIF graphics format", - "legalType": "Patent, Trademark, Copyright", - "description": "Some legal document!", - "applicationDate": "2015-08-01", - "grantDate": "2016-09-01", - "endDate": "2020-09-03", - "resources": [ - { - "url": "http://www.example.com/my-example-slides/", - "label": "Slides" - } - ], - "idNumber": "JP2004369746A", - "currentAssignee": "John Doe", - "previousAssignee": "John Doe", - "author": "John Doe", - "coAuthors": "John Doe" - } - ], - "skills": [ - { - "name": "Web Development", - "proficiency": "advanced", - "keywords": [ - "HTML" - ] - } - ], - "awards": [ - { - "title": "Awarded Software Process Achievement Award", - "date": "2016-06-12", - "awarder": "IEEE", - "summary": "Received for my work in Deep learning and AI" - } - ], - "projects": [ - { - "name": "File Transfer application", - "location": { - "lat": 35.712758, - "long": 51.392114 - }, - "description": "Developed a client and server based application", - "highlights": [ - "used Java AWT and Swing for client side userinterface" - ], - "keywords": [ - "Java" - ], - "startDate": "2016-06-29", - "endDate": "2017-03-02", - "resources": [ - { - "url": "http://www.example.com/my-example-slides/", - "label": "Slides" - } - ], - "url": "http://www.example.org/csdl/mags/co/1996/10/rx069-abs.html", - "roles": [ - "Team Lead" - ], - "entity": "greenpeace", - "type": "volunteering" - } - ], - "certificate": [ - { - "code": "1Z0-062", - "name": "XYZ Certified Application Specialist (MCAS)", - "website": "http://www.example.org", - "verification": "http://www.example.org", - "grantDate": "2017-06-29", - "score": { - "type": "GPA", - "value": "3.4", - "best": "4", - "worst": "0" - }, - "endDate": "2017-06-29", - "doesNotExpire": true - } - ], - "references": [ - { - "name": "Stephan Mark", - "company": "Xyz", - "position": "Senior Software Engineer", - "reference": "Joe blogs was a great employee, who turned up to work at least once a week. He exceeded my expectations when it came to doing nothing." - } - ], - "languages": [ - { - "language": "English", - "level": "fluent" - } - ], - "interests": [ - { - "name": "Machine Learning", - "keywords": [ - "Neural Networks" - ] - } - ], - "meta": { - "canonical": "", - "version": "v1.0.0", - "lastModified": "2017-06-29T15:53:01+01:00", - "uuid": "078c39ce-23ee-4970-9637-c07379132dce" - } -} \ No newline at end of file From 949aa567299269fe4bd9c08c9c17d50081b91466 Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Fri, 3 May 2019 14:18:03 -0400 Subject: [PATCH 03/19] default values added for render cmd args --- cmd/render.go | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/cmd/render.go b/cmd/render.go index 49b65a3..f570501 100644 --- a/cmd/render.go +++ b/cmd/render.go @@ -3,15 +3,48 @@ package cmd import ( "fmt" "io/ioutil" + "strings" "github.com/resumic/schema/render" "github.com/resumic/schema/theme" "github.com/spf13/cobra" ) +// Added in case we change default filenames. +const ( + defaultHTML = "resume.html" + defaultResume = "resume.json" +) + func renderRun(cmd *cobra.Command, args []string) error { - resumePath := args[0] - htmlPath := args[1] + var ( + resumePath string + htmlPath string + ) + switch argLen := len(args); argLen { + // No args: use defaults for input file and output file. + case 0: + resumePath = defaultResume + htmlPath = defaultHTML + // 1 argument: check to see what the file type is. If JSON, use as input file. + // If HTML, use as output file. This doesn't permit using files with no extension. + case 1: + if strings.Contains(args[0], ".json") { + resumePath = args[0] + htmlPath = defaultHTML + } else if strings.Contains(args[0], ".html") { + resumePath = defaultResume + htmlPath = args[0] + } else { + return fmt.Errorf("Please provide argument(s) with a valid .json or .html extension") + } + // 2 args: use args for input and output files. + case 2: + resumePath = args[0] + htmlPath = args[1] + } + // resumePath := args[0] + // htmlPath := args[1] cacheDir, err := cmd.Flags().GetString("cacheDir") if err != nil { panic(err) @@ -49,9 +82,9 @@ func renderRun(cmd *cobra.Command, args []string) error { } var renderCmd = &cobra.Command{ - Use: "render JSON_PATH HTML_PATH", + Use: "render JSON_PATH (defaults to resume.json) HTML_PATH (defaults to resume.html)", Short: "Render json resume to html", - Args: cobra.ExactArgs(2), + Args: cobra.MaximumNArgs(2), RunE: renderRun, } From 55bb954303432804208207329a903861f2a6d95c Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Fri, 3 May 2019 14:33:48 -0400 Subject: [PATCH 04/19] added default input file value for validate --- cmd/validate.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/validate.go b/cmd/validate.go index 327f4fd..97ebb09 100644 --- a/cmd/validate.go +++ b/cmd/validate.go @@ -10,7 +10,12 @@ import ( ) func validateRun(cmd *cobra.Command, args []string) error { - resumePath := args[0] + var resumePath string + if len(args) == 0 { + resumePath = "resume.json" + } else { + resumePath = args[0] + } resume, err := ioutil.ReadFile(resumePath) if err != nil { @@ -23,14 +28,14 @@ func validateRun(cmd *cobra.Command, args []string) error { } return fmt.Errorf("Couldn't validate the resume: %s", err) } - fmt.Printf("%s is valid and conforming with the resumic schema", resumePath) + fmt.Printf("%s is valid and conforming with the resumic schema\n", resumePath) return nil } var validateCmd = &cobra.Command{ Use: "validate PATH", Short: "Validate a json resume", - Args: cobra.ExactArgs(1), + Args: cobra.MaximumNArgs(1), RunE: validateRun, } From 0f3b0241dec0d88fdf4ceb65f03381ccdcabdd9f Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Fri, 3 May 2019 15:29:00 -0400 Subject: [PATCH 05/19] added default output filename values to generate commands --- cmd/generate_jsonschema.go | 9 +++++++-- cmd/generate_uischema.go | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/cmd/generate_jsonschema.go b/cmd/generate_jsonschema.go index 039ca67..a390620 100644 --- a/cmd/generate_jsonschema.go +++ b/cmd/generate_jsonschema.go @@ -9,7 +9,12 @@ import ( ) func generateJSONSchemaRun(cmd *cobra.Command, args []string) error { - schemaPath := args[0] + var schemaPath string + if len(args) == 0 { + schemaPath = "resume.json" + } else { + schemaPath = args[0] + } schema, err := schema.GenerateJSONSchema() if err != nil { return fmt.Errorf("Couldn't generate JSON schema: %s", err) @@ -25,7 +30,7 @@ func generateJSONSchemaRun(cmd *cobra.Command, args []string) error { var generateJSONSchemaCmd = &cobra.Command{ Use: "jsonschema PATH", Short: "Generate the jsonschema for the resumic schema", - Args: cobra.ExactArgs(1), + Args: cobra.MaximumNArgs(1), RunE: generateJSONSchemaRun, } diff --git a/cmd/generate_uischema.go b/cmd/generate_uischema.go index 71b00a1..59eee2c 100644 --- a/cmd/generate_uischema.go +++ b/cmd/generate_uischema.go @@ -9,7 +9,12 @@ import ( ) func generateUISchemaRun(cmd *cobra.Command, args []string) error { - schemaPath := args[0] + var schemaPath string + if len(args) == 0 { + schemaPath = "resume.json" + } else { + schemaPath = args[0] + } schema, err := schema.GenerateUISchema() if err != nil { return fmt.Errorf("Couldn't generate UI schema: %s", err) @@ -25,7 +30,7 @@ func generateUISchemaRun(cmd *cobra.Command, args []string) error { var generateUISchemaCmd = &cobra.Command{ Use: "uischema PATH", Short: "Generate the uischema for the resumic schema", - Args: cobra.ExactArgs(1), + Args: cobra.MaximumNArgs(1), RunE: generateUISchemaRun, } From f5707bbb7c52f0558ca993c07785bafb06407c84 Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Wed, 15 May 2019 17:08:40 -0400 Subject: [PATCH 06/19] got rid of nomakr rule --- Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Makefile b/Makefile index 5afa506..fdeb0f8 100644 --- a/Makefile +++ b/Makefile @@ -20,10 +20,6 @@ release: pre-build @go build -ldflags "-s -w -X $(CODEPATH)/cmd.version=$(RESUMIC_VERSION) -X $(CODEPATH)/cmd.gitCommit=$(GITCOMMIT)" -o resumic @packr2 clean -nopackr: # Builds without installing packr. Useful if offline. - @go build -ldflags "-s -w -X $(CODEPATH)/cmd.version=$(RESUMIC_VERSION) -X $(CODEPATH)/cmd.gitCommit=$(GITCOMMIT)" -o resumic - - test: build go test -v ./... From 80a4416bbd58d5412ee7a7c9af96f0145069ddbe Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Sat, 29 Jun 2019 18:27:19 -0400 Subject: [PATCH 07/19] adding -o flag to example command --- .examples/hello.json | 220 ++++++++++++++++++++++++++++++++++++++++ cmd/generate_example.go | 4 + go.mod | 13 +-- go.sum | 38 +++++++ 4 files changed, 267 insertions(+), 8 deletions(-) create mode 100644 .examples/hello.json diff --git a/.examples/hello.json b/.examples/hello.json new file mode 100644 index 0000000..d4280f5 --- /dev/null +++ b/.examples/hello.json @@ -0,0 +1,220 @@ +{ + "core": { + "title": "Software Engineer", + "workArea": "Munich Citycenter + 20kms", + "livingArea": "Germany", + "optionalKey": "foo" + }, + "optionalData": { + "one": "two", + "foo": "bar" + }, + "optionalData1": { + "one": "two", + "foo": "bar" + }, + "optionalData2": { + "one": "two", + "foo": "bar" + }, + "personal": { + "name": "John Doe", + "gender": "male", + "image": "example.com/Abcxyz", + "email": "lucas@example.com", + "phone": "912-217-7923", + "url": "http://www.example.com/", + "summary": "The man who sold the world!", + "currentLocation": { + "lat": 35.712758, + "long": 51.392114 + }, + "permanentLocation": { + "lat": 35.712758, + "long": 51.392114 + }, + "birthday": "1995-02-14", + "birthPlace": "Munich", + "profiles": [ + { + "network": "github", + "username": "john_doe", + "url": "https://github.com/john_doe" + } + ], + "relationshipStatus": "married", + "postalAddress": "John Doe, Wittekindshof, Schulstrasse 4, 32547 Bad Oyenhausen, Germany" + }, + "work": [ + { + "name": "XYZ Inc", + "description": "A social media company", + "position": "Software Engineer", + "location": { + "lat": 35.712758, + "long": 51.392114 + }, + "url": "http://xyz.example.com", + "startDate": "2017-12-29", + "endDate": "2018-12-29", + "summary": "Developing and maintaining the company website using syna", + "highlights": [ + "Worked with mobile team at Twitter to develop remote debugging tools for mobile browsers" + ] + } + ], + "education": [ + { + "institution": "XYZ Institute of Technology", + "location": { + "lat": 35.712758, + "long": 51.392114 + }, + "area": "Engineering", + "studyType": "Bachelor", + "startDate": "2017-06-28", + "endDate": "2013-06-28", + "score": { + "type": "GPA", + "value": "3.4", + "best": "4", + "worst": "0" + }, + "courses": ["CS302 - Introduction to Algorithms"], + "honors": ["Magna Cum Laude"], + "highlights": ["Live abroad within a new culture"] + } + ], + "volunteer": [ + { + "organization": "Xyz", + "position": "Open Source Contributor", + "location": { + "lat": 35.712758, + "long": 51.392114 + }, + "url": "http://xyz.example.com", + "startDate": "2014-06-29", + "endDate": "2017-06-29", + "summary": "Frontend developer", + "highlights": ["Invited as a speaker in Xyzcon'17"] + } + ], + "publications": [ + { + "name": "Deep learning and Artificial Intelligence", + "publisher": "XYZ, Computer Magazine", + "releaseDate": "2015-08-01", + "resources": [ + { + "url": "http://www.example.com/my-example-slides/", + "label": "Slides" + } + ], + "url": "http://www.computer.org.example.com/csdl/mags/co/2015/10/rx069-abs.html", + "summary": "Discussion of the advent of deep learning and artificial intelligence" + } + ], + "legal": [ + { + "name": "XYZ's patent on LZW compression, a fundamental part of the widely used GIF graphics format", + "legalType": "Patent, Trademark, Copyright", + "description": "Some legal document!", + "applicationDate": "2015-08-01", + "grantDate": "2016-09-01", + "endDate": "2020-09-03", + "resources": [ + { + "url": "http://www.example.com/my-example-slides/", + "label": "Slides" + } + ], + "idNumber": "JP2004369746A", + "currentAssignee": "John Doe", + "previousAssignee": "John Doe", + "author": "John Doe", + "coAuthors": "John Doe" + } + ], + "skills": [ + { + "name": "Web Development", + "proficiency": "advanced", + "keywords": ["HTML"] + } + ], + "awards": [ + { + "title": "Awarded Software Process Achievement Award", + "date": "2016-06-12", + "awarder": "IEEE", + "summary": "Received for my work in Deep learning and AI" + } + ], + "projects": [ + { + "name": "File Transfer application", + "location": { + "lat": 35.712758, + "long": 51.392114 + }, + "description": "Developed a client and server based application", + "highlights": ["used Java AWT and Swing for client side userinterface"], + "keywords": ["Java"], + "startDate": "2016-06-29", + "endDate": "2017-03-02", + "resources": [ + { + "url": "http://www.example.com/my-example-slides/", + "label": "Slides" + } + ], + "url": "http://www.example.org/csdl/mags/co/1996/10/rx069-abs.html", + "roles": ["Team Lead"], + "entity": "greenpeace", + "type": "volunteering" + } + ], + "certificate": [ + { + "code": "1Z0-062", + "name": "XYZ Certified Application Specialist (MCAS)", + "website": "http://www.example.org", + "verification": "http://www.example.org", + "grantDate": "2017-06-29", + "score": { + "type": "GPA", + "value": "3.4", + "best": "4", + "worst": "0" + }, + "endDate": "2017-06-29", + "doesNotExpire": true + } + ], + "references": [ + { + "name": "Stephan Mark", + "company": "Xyz", + "position": "Senior Software Engineer", + "reference": "Joe blogs was a great employee, who turned up to work at least once a week. He exceeded my expectations when it came to doing nothing." + } + ], + "languages": [ + { + "language": "English", + "level": "fluent" + } + ], + "interests": [ + { + "name": "Machine Learning", + "keywords": ["Neural Networks"] + } + ], + "meta": { + "version": "v1.0.0", + "lastModified": "2017-06-29T15:53:01+01:00", + "uuid": "078c39ce-23ee-4970-9637-c07379132dce" + } +} diff --git a/cmd/generate_example.go b/cmd/generate_example.go index fb928b0..ca9d2d6 100644 --- a/cmd/generate_example.go +++ b/cmd/generate_example.go @@ -9,6 +9,9 @@ import ( "github.com/spf13/cobra" ) +// Flag to specify output +var output string + func generateExampleRun(cmd *cobra.Command, args []string) error { var examplePath string if len(args) == 0 { @@ -40,5 +43,6 @@ var generateExampleCmd = &cobra.Command{ } func init() { + generateExampleCmd.Flags().StringVarP(&output, "output", "o", "resume_example.json", "Specify a custom output file for example resume data.") generateCmd.AddCommand(generateExampleCmd) } diff --git a/go.mod b/go.mod index f3223ba..0dc7b77 100644 --- a/go.mod +++ b/go.mod @@ -3,21 +3,18 @@ module github.com/resumic/schema require ( github.com/emirpasic/gods v1.12.0 // indirect github.com/gobuffalo/events v1.1.8 // indirect - github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0 - github.com/gobuffalo/packr/v2 v2.2.0 + github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e // indirect + github.com/gobuffalo/packd v0.3.0 + github.com/gobuffalo/packr/v2 v2.5.2 + github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754 // indirect github.com/gohugoio/hugo v0.49.2 - github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect github.com/kr/pty v1.1.4 // indirect github.com/markbates/inflect v1.0.4 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/spf13/cobra v0.0.3 + github.com/spf13/cobra v0.0.5 github.com/stretchr/objx v0.2.0 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.1.0 - golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5 // indirect - golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 // indirect - golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67 // indirect gopkg.in/src-d/go-billy.v4 v4.3.0 // indirect gopkg.in/src-d/go-git-fixtures.v3 v3.3.0 // indirect gopkg.in/src-d/go-git.v4 v4.9.1 diff --git a/go.sum b/go.sum index 456ecf9..5273fe1 100644 --- a/go.sum +++ b/go.sum @@ -21,6 +21,7 @@ github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkx github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/bep/debounce v1.1.0 h1:6ocXeW2iZ/7vAzgXz82J00tYxncMiEEBExPftTtOQzk= github.com/bep/debounce v1.1.0/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0= github.com/bep/gitmap v1.0.0 h1:cTTZwq7vpGuhwefKCBDV9UrHnZAPVJTvoWobimrqkUc= @@ -32,8 +33,13 @@ github.com/chaseadamsio/goorgeous v1.1.0/go.mod h1:6QaC0vFoKWYDth94dHFNgRT2YkT5F github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/cockroach-go v0.0.0-20181001143604-e0a95dfd547c/go.mod h1:XGLbWH/ujMcbPbhZq52Nv6UrCghb1yGn//133kEsvDk= github.com/codegangsta/negroni v1.0.0/go.mod h1:v0y3T5G7Y1UlFfyxFn/QLRU4a2EuNau2iZY63YTKWo0= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/cpuguy83/go-md2man v1.0.8 h1:DwoNytLphI8hzS2Af4D0dfaEaiSq2bN05mEm4R6vf8M= github.com/cpuguy83/go-md2man v1.0.8/go.mod h1:N6JayAiVKtlHSnuTCeuLSQVs75hb8q+dYQLjr7cDsKY= +github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -149,6 +155,8 @@ github.com/gobuffalo/logger v0.0.0-20181127160119-5b956e21995c h1:Z/ppYX6EtPEysb github.com/gobuffalo/logger v0.0.0-20181127160119-5b956e21995c/go.mod h1:+HxKANrR9VGw9yN3aOAppJKvhO05ctDi63w4mDnKv2U= github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2 h1:8thhT+kUJMTMy3HlX4+y9Da+BNJck+p109tqqKp7WDs= github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= +github.com/gobuffalo/logger v1.0.0 h1:xw9Ko9EcC5iAFprrjJ6oZco9UpzS5MQ4jAwghsLHdy4= +github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= github.com/gobuffalo/makr v1.1.5/go.mod h1:Y+o0btAH1kYAMDJW/TX3+oAXEu0bmSLLoC9mIFxtzOw= github.com/gobuffalo/mapi v1.0.0/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= github.com/gobuffalo/mapi v1.0.1 h1:JRuTiZzDEZhBHkFiHTxJkYRT6CbYuL0K/rn+1byJoEA= @@ -178,6 +186,8 @@ github.com/gobuffalo/packd v0.0.0-20181124090624-311c6248e5fb h1:039sqjIDVgXXcB5 github.com/gobuffalo/packd v0.0.0-20181124090624-311c6248e5fb/go.mod h1:Foenia9ZvITEvG05ab6XpiD5EfBHPL8A6hush8SJ0o8= github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0 h1:P6naWPiHm/7R3eYx/ub3VhaW9G+1xAMJ6vzACePaGPI= github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= +github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4= +github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q= github.com/gobuffalo/packr v1.13.7/go.mod h1:KkinLIn/n6+3tVXMwg6KkNvWwVsrRAz4ph+jgpk3Z24= github.com/gobuffalo/packr v1.15.0/go.mod h1:t5gXzEhIviQwVlNx/+3SfS07GS+cZ2hn76WLzPp6MGI= github.com/gobuffalo/packr v1.15.1/go.mod h1:IeqicJ7jm8182yrVmNbM6PR4g79SjN9tZLH8KduZZwE= @@ -192,6 +202,8 @@ github.com/gobuffalo/packr/v2 v2.1.0 h1:nWGTgGtZrR4yBQvmAKF4AthraObjRMzx6lJa9e+J github.com/gobuffalo/packr/v2 v2.1.0/go.mod h1:n90ZuXIc2KN2vFAOQascnPItp9A2g9QYSvYvS3AjQEM= github.com/gobuffalo/packr/v2 v2.2.0 h1:Ir9W9XIm9j7bhhkKE9cokvtTl1vBm62A/fene/ZCj6A= github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= +github.com/gobuffalo/packr/v2 v2.5.2 h1:4EvjeIpQLZuRIljwnidYgbRXbr1yIzVRrESiLjqKj6s= +github.com/gobuffalo/packr/v2 v2.5.2/go.mod h1:sgEE1xNZ6G0FNN5xn9pevVu4nywaxHvgup67xisti08= github.com/gobuffalo/plush v3.7.16+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= github.com/gobuffalo/plush v3.7.20+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= github.com/gobuffalo/plush v3.7.21+incompatible/go.mod h1:rQ4zdtUUyZNqULlc6bqd5scsPfLKfT0+TGMChgduDvI= @@ -264,6 +276,8 @@ github.com/karrick/godirwalk v1.7.5 h1:VbzFqwXwNbAZoA6W5odrLr+hKK197CcENcPh6E/gJ github.com/karrick/godirwalk v1.7.5/go.mod h1:2c9FRhkDxdIbgkOnCEvnSWs71Bhugbl46shStcFDJ34= github.com/karrick/godirwalk v1.8.0 h1:ycpSqVon/QJJoaT1t8sae0tp1Stg21j+dyuS7OoagcA= github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= +github.com/karrick/godirwalk v1.10.12 h1:BqUm+LuJcXjGv1d2mj3gBiQyrQ57a0rYoAmhvJQ7RDU= +github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e h1:RgQk53JHp/Cjunrr1WlsXSZpqXn+uREuHvUVcK82CV8= github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= @@ -353,6 +367,8 @@ github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhg github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday v0.0.0-20180804101149-46c73eb196ba h1:8Vzt8HxRjy7hp1eqPKVoAEPK9npQFW2510qlobGzvi0= github.com/russross/blackfriday v0.0.0-20180804101149-46c73eb196ba/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/sanity-io/litter v1.1.0 h1:BllcKWa3VbZmOZbDCoszYLk7zCsKHz5Beossi8SUcTc= github.com/sanity-io/litter v1.1.0/go.mod h1:CJ0VCw2q4qKU7LaQr3n7UOSHzgEMgcGco7N/SkZQPjw= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= @@ -375,6 +391,8 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= @@ -384,6 +402,8 @@ github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/fsync v0.0.0-20170320142552-12a01e648f05 h1:pQHm7pxjSgC54M1rtLSLmju25phy6RgYf3p4O6XanYE= github.com/spf13/fsync v0.0.0-20170320142552-12a01e648f05/go.mod h1:jdsEoy1w+v0NpuwXZEaRAH6ADTDmzfRnE2eVwshwFrM= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= @@ -396,6 +416,8 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/viper v1.2.0/go.mod h1:P4AexN0a+C9tGAnUFNwDMYYZv3pjFuvmeiMyKRaNVlI= github.com/spf13/viper v1.2.1 h1:bIcUwXqLseLF3BDAZduuNfekWG87ibtFxi59Bq+oI9M= github.com/spf13/viper v1.2.1/go.mod h1:P4AexN0a+C9tGAnUFNwDMYYZv3pjFuvmeiMyKRaNVlI= +github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/src-d/gcfg v1.4.0 h1:xXbNR5AlLSA315x2UO+fTSSAXCDf+Ar38/6oyGbDKQ4= github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -411,6 +433,7 @@ github.com/tdewolff/parse v2.3.3+incompatible h1:q6OSjvHtvBucLb34z24OH1xl5wGdw1m github.com/tdewolff/parse v2.3.3+incompatible/go.mod h1:8oBwCsVmUkgHO8M5iCzSIDtpzXOT0WXX9cWhz+bIzJQ= github.com/tdewolff/test v0.0.0-20171106182207-265427085153 h1:B1Z2txQ2QI9nsWELeEvGBAdNhMylGMSCCypjsLJh/Mw= github.com/tdewolff/test v0.0.0-20171106182207-265427085153/go.mod h1:DiQUlutnqlEvdvhSn2LPGy4TFwRauAaYDsL+683RNX4= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/unrolled/secure v0.0.0-20180918153822-f340ee86eb8b/go.mod h1:mnPT77IAdsi/kV7+Es7y+pXALeV3h7G6dQF6mNYjcLA= github.com/unrolled/secure v0.0.0-20181005190816-ff9db2ff917f/go.mod h1:mnPT77IAdsi/kV7+Es7y+pXALeV3h7G6dQF6mNYjcLA= github.com/wellington/go-libsass v0.0.0-20180624165032-615eaa47ef79 h1:ivqgxj/zO3UZuzX7ZnlcyX8cAbNqLl1oes4zPddAO5Q= @@ -425,6 +448,7 @@ github.com/xeipuuv/gojsonschema v0.0.0-20181112162635-ac52e6811b56 h1:yhqBHs09Sm github.com/xeipuuv/gojsonschema v0.0.0-20181112162635-ac52e6811b56/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= github.com/xeipuuv/gojsonschema v1.1.0 h1:ngVtJC9TY/lg0AA/1k48FYhBrhRoFlEmWzsehpNAaZg= github.com/xeipuuv/gojsonschema v1.1.0/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yosssi/ace v0.0.5 h1:tUkIP/BLdKqrlrPwcmH0shwEEhTRHoGnc1wFIWmaBUA= github.com/yosssi/ace v0.0.5/go.mod h1:ALfIzm2vT7t5ZE7uoIZqF3TQ7SAOyupFZnkrF5id+K0= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -439,11 +463,14 @@ golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85 h1:et7+NAX3lLIk5qUCTA9QelBjGE/NkhzYw/mhnr0s7nI= golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190131182504-b8fe1690c613 h1:MQ/ZZiDsUapFFiMS+vzwXkCTeEKaum+Do5rINYJDmxc= golang.org/x/crypto v0.0.0-20190131182504-b8fe1690c613/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5 h1:bselrhR0Or1vomJZC8ZIjWtbDmn9OYFLX5Ik9alpJpE= golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= +golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 h1:ydJNl0ENAG67pFbB+9tfhiL2pYqLhfoaZFw/cjLhY4A= +golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81 h1:00VmoueYNlNz/aHIilyyQz/MHSqGoWJzpFv/HW8xpzI= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -471,6 +498,8 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 h1:bjcUS9ztw9kFmmIxJInhon/0 golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190412183630-56d357773e84 h1:IqXQ59gzdXv58Jmm2xn0tSOR9i6HqroaOFRQ3wR/dJQ= golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180816055513-1c9583448a9c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -488,12 +517,17 @@ golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181106135930-3a76605856fd/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 h1:YoY1wS6JYVRpIfFngRf2HHo9R9dAne3xbkGOQ5rJXjU= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190204203706-41f3e6584952 h1:FDfvYgoVsA7TTZSbgiqjAbfPbK47CNHdWl3h/PJtii0= golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67 h1:1Fzlr8kkDLQwqMP8GxrhptBLqZG/EDpiATneiZHY998= golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190515120540-06a5c4944438 h1:khxRGsvPk4n2y8I/mLLjp7e5dMTJmH75wvqS6nMwUtY= +golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -516,6 +550,8 @@ golang.org/x/tools v0.0.0-20190409150902-04e50493df54 h1:L7+razWg8CVl9qm8LxypkFI golang.org/x/tools v0.0.0-20190409150902-04e50493df54/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421 h1:0lteSdckF24NlQCFAMS8BzXQy45S0v4SY3N3BBkq/gA= golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0 h1:Dh6fw+p6FyRl5x/FvNswO1ji0lIGzm3KP8Y9VkS9PTE= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= @@ -540,3 +576,5 @@ gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From 2e1ee606e59dd8b0cb21439e6d5884ddb8d5f3a0 Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Sat, 29 Jun 2019 18:46:40 -0400 Subject: [PATCH 08/19] cleaning up -o flag code for generate example --- cmd/generate_example.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/cmd/generate_example.go b/cmd/generate_example.go index ca9d2d6..c081ad4 100644 --- a/cmd/generate_example.go +++ b/cmd/generate_example.go @@ -9,16 +9,11 @@ import ( "github.com/spf13/cobra" ) -// Flag to specify output -var output string +// Flag to specify output. Default value is "resume_example.json" +var outputFileName string func generateExampleRun(cmd *cobra.Command, args []string) error { - var examplePath string - if len(args) == 0 { - examplePath = "resume_example.json" - } else { - examplePath = args[0] - } + fmt.Println(outputFileName) example, err := schema.GenerateExample() if err != nil { return fmt.Errorf("Couldn't generate the example: %s", err) @@ -27,11 +22,12 @@ func generateExampleRun(cmd *cobra.Command, args []string) error { if err != nil { return fmt.Errorf("Couldn't marshal the example to json: %s", err) } - err = ioutil.WriteFile(examplePath, exampleJSON, 0600) + err = ioutil.WriteFile(outputFileName, exampleJSON, 0600) + if err != nil { - return fmt.Errorf("Couldn't write the example to %s: %s", examplePath, err) + return fmt.Errorf("Couldn't write the example to %s: %s", outputFileName, err) } - fmt.Printf("Example file created successfully at %s\n", examplePath) + fmt.Printf("Example file created successfully at %s\n", outputFileName) return nil } @@ -43,6 +39,6 @@ var generateExampleCmd = &cobra.Command{ } func init() { - generateExampleCmd.Flags().StringVarP(&output, "output", "o", "resume_example.json", "Specify a custom output file for example resume data.") + generateExampleCmd.Flags().StringVarP(&outputFileName, "output", "o", "resume_example.json", "Specify a custom output file for example resume data.") generateCmd.AddCommand(generateExampleCmd) } From 9b6e4efef9edcb5b8854162b5c4285064d52de80 Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Sat, 29 Jun 2019 18:47:03 -0400 Subject: [PATCH 09/19] deleted errant println --- cmd/generate_example.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/generate_example.go b/cmd/generate_example.go index c081ad4..081cdce 100644 --- a/cmd/generate_example.go +++ b/cmd/generate_example.go @@ -13,7 +13,6 @@ import ( var outputFileName string func generateExampleRun(cmd *cobra.Command, args []string) error { - fmt.Println(outputFileName) example, err := schema.GenerateExample() if err != nil { return fmt.Errorf("Couldn't generate the example: %s", err) From 190f94f8595a99e1935224013f78d389bb2e928a Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Sat, 29 Jun 2019 18:59:31 -0400 Subject: [PATCH 10/19] added -o flag to generate jsonschema cmd --- cmd/generate_jsonschema.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cmd/generate_jsonschema.go b/cmd/generate_jsonschema.go index a390620..65969b7 100644 --- a/cmd/generate_jsonschema.go +++ b/cmd/generate_jsonschema.go @@ -8,13 +8,9 @@ import ( "github.com/spf13/cobra" ) +var schemaPath string + func generateJSONSchemaRun(cmd *cobra.Command, args []string) error { - var schemaPath string - if len(args) == 0 { - schemaPath = "resume.json" - } else { - schemaPath = args[0] - } schema, err := schema.GenerateJSONSchema() if err != nil { return fmt.Errorf("Couldn't generate JSON schema: %s", err) @@ -35,5 +31,6 @@ var generateJSONSchemaCmd = &cobra.Command{ } func init() { + generateJSONSchemaCmd.Flags().StringVarP(&schemaPath, "output", "o", "resume.json", "Specify an output file for the resume data") generateCmd.AddCommand(generateJSONSchemaCmd) } From 5fbe96523cb2341949ba08a01ad9c194178a5e12 Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Sat, 29 Jun 2019 19:15:25 -0400 Subject: [PATCH 11/19] added -o flags to schema commands, fixed tests --- cmd/generate_example_test.go | 2 +- cmd/generate_jsonschema_test.go | 2 +- cmd/generate_uischema.go | 15 ++++++--------- cmd/generate_uischema_test.go | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/cmd/generate_example_test.go b/cmd/generate_example_test.go index 0e8f38a..0bbc294 100644 --- a/cmd/generate_example_test.go +++ b/cmd/generate_example_test.go @@ -12,7 +12,7 @@ func TestGenerateExampleRunValid(t *testing.T) { if err != nil { t.Fatalf("Could not generate temp file: %s", err) } - err = Execute([]string{"generate", "example", tempFile.Name()}) + err = Execute([]string{"generate", "example", "-o", tempFile.Name()}) if err != nil { t.Fatalf("Could not generate example, %s", err) } diff --git a/cmd/generate_jsonschema_test.go b/cmd/generate_jsonschema_test.go index fa17754..0aaa37e 100644 --- a/cmd/generate_jsonschema_test.go +++ b/cmd/generate_jsonschema_test.go @@ -12,7 +12,7 @@ func TestGenerateJSONSchemaRunValid(t *testing.T) { if err != nil { t.Fatalf("Could not generate temp file: %s", err) } - err = Execute([]string{"generate", "jsonschema", tempFile.Name()}) + err = Execute([]string{"generate", "jsonschema", "-o", tempFile.Name()}) if err != nil { t.Fatalf("Could not generate schema, %s", err) } diff --git a/cmd/generate_uischema.go b/cmd/generate_uischema.go index 59eee2c..539aaf2 100644 --- a/cmd/generate_uischema.go +++ b/cmd/generate_uischema.go @@ -8,22 +8,18 @@ import ( "github.com/spf13/cobra" ) +var uiSchemaPath string + func generateUISchemaRun(cmd *cobra.Command, args []string) error { - var schemaPath string - if len(args) == 0 { - schemaPath = "resume.json" - } else { - schemaPath = args[0] - } schema, err := schema.GenerateUISchema() if err != nil { return fmt.Errorf("Couldn't generate UI schema: %s", err) } - err = ioutil.WriteFile(schemaPath, schema, 0600) + err = ioutil.WriteFile(uiSchemaPath, schema, 0600) if err != nil { - return fmt.Errorf("Couldn't write the schema to %s: %s", schemaPath, err) + return fmt.Errorf("Couldn't write the schema to %s: %s", uiSchemaPath, err) } - fmt.Printf("UI schema file created successfully at %s\n", schemaPath) + fmt.Printf("UI schema file created successfully at %s\n", uiSchemaPath) return nil } @@ -35,5 +31,6 @@ var generateUISchemaCmd = &cobra.Command{ } func init() { + generateUISchemaCmd.Flags().StringVarP(&uiSchemaPath, "output", "o", "resume.json", "Specify an output file for the resume data") generateCmd.AddCommand(generateUISchemaCmd) } diff --git a/cmd/generate_uischema_test.go b/cmd/generate_uischema_test.go index 686c9e9..abb40a7 100644 --- a/cmd/generate_uischema_test.go +++ b/cmd/generate_uischema_test.go @@ -12,7 +12,7 @@ func TestGenerateUISchemaRunValid(t *testing.T) { if err != nil { t.Fatalf("Could not generate temp file: %s", err) } - err = Execute([]string{"generate", "uischema", tempFile.Name()}) + err = Execute([]string{"generate", "uischema", "-o", tempFile.Name()}) if err != nil { t.Fatalf("Could not generate schema, %s", err) } From 3e4c52e3272a81828561c3284b3474abff1cbe6c Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Sun, 30 Jun 2019 23:33:03 -0400 Subject: [PATCH 12/19] added render flags --- cmd/render.go | 61 ++++++++++++++++++++++++---------------------- cmd/render_test.go | 2 +- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/cmd/render.go b/cmd/render.go index f570501..4fab613 100644 --- a/cmd/render.go +++ b/cmd/render.go @@ -3,7 +3,6 @@ package cmd import ( "fmt" "io/ioutil" - "strings" "github.com/resumic/schema/render" "github.com/resumic/schema/theme" @@ -16,35 +15,37 @@ const ( defaultResume = "resume.json" ) +var ( + resumePath string + htmlPath string +) + func renderRun(cmd *cobra.Command, args []string) error { - var ( - resumePath string - htmlPath string - ) - switch argLen := len(args); argLen { - // No args: use defaults for input file and output file. - case 0: - resumePath = defaultResume - htmlPath = defaultHTML - // 1 argument: check to see what the file type is. If JSON, use as input file. - // If HTML, use as output file. This doesn't permit using files with no extension. - case 1: - if strings.Contains(args[0], ".json") { - resumePath = args[0] - htmlPath = defaultHTML - } else if strings.Contains(args[0], ".html") { - resumePath = defaultResume - htmlPath = args[0] - } else { - return fmt.Errorf("Please provide argument(s) with a valid .json or .html extension") - } - // 2 args: use args for input and output files. - case 2: - resumePath = args[0] - htmlPath = args[1] - } - // resumePath := args[0] - // htmlPath := args[1] + + // switch argLen := len(args); argLen { + // // No args: use defaults for input file and output file. + // case 0: + // resumePath = defaultResume + // htmlPath = defaultHTML + // // 1 argument: check to see what the file type is. If JSON, use as input file. + // // If HTML, use as output file. This doesn't permit using files with no extension. + // case 1: + // if strings.Contains(args[0], ".json") { + // resumePath = args[0] + // htmlPath = defaultHTML + // } else if strings.Contains(args[0], ".html") { + // resumePath = defaultResume + // htmlPath = args[0] + // } else { + // return fmt.Errorf("Please provide argument(s) with a valid .json or .html extension") + // } + // // 2 args: use args for input and output files. + // case 2: + // resumePath = args[0] + // htmlPath = args[1] + // } + // // resumePath := args[0] + // // htmlPath := args[1] cacheDir, err := cmd.Flags().GetString("cacheDir") if err != nil { panic(err) @@ -89,6 +90,8 @@ var renderCmd = &cobra.Command{ } func init() { + renderCmd.Flags().StringVarP(&resumePath, "resume", "r", "resume.json", "Path to resume data file") + renderCmd.Flags().StringVarP(&htmlPath, "output", "o", "resume.html", "Path to output file") renderCmd.Flags().StringP("theme", "t", "test-theme", "Theme to use") renderCmd.Flags().StringP("themesDir", "d", "", "Filesystem path to themes directory") rootCmd.AddCommand(renderCmd) diff --git a/cmd/render_test.go b/cmd/render_test.go index b6ef648..f7e2d0f 100644 --- a/cmd/render_test.go +++ b/cmd/render_test.go @@ -18,7 +18,7 @@ func TestRenderRun(t *testing.T) { if err != nil { t.Fatalf("Could not make temp file: %s", err) } - err = Execute([]string{"--cacheDir", cacheDir, "render", resumePath, tempFile.Name()}) + err = Execute([]string{"--cacheDir", cacheDir, "render", "-r", resumePath, "-o", tempFile.Name()}) if err != nil { t.Fatalf("Could not render the resume html: %s", err) } From 8efdf749c5f3c7e20f6fe2db242a4bb58d7dd745 Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Sun, 30 Jun 2019 23:51:33 -0400 Subject: [PATCH 13/19] added validate -r flag --- cmd/validate.go | 15 ++++++--------- cmd/validate_test.go | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/cmd/validate.go b/cmd/validate.go index 97ebb09..0ef653c 100644 --- a/cmd/validate.go +++ b/cmd/validate.go @@ -9,17 +9,13 @@ import ( "github.com/spf13/cobra" ) +var resumePathValidate string + func validateRun(cmd *cobra.Command, args []string) error { - var resumePath string - if len(args) == 0 { - resumePath = "resume.json" - } else { - resumePath = args[0] - } - resume, err := ioutil.ReadFile(resumePath) + resume, err := ioutil.ReadFile(resumePathValidate) if err != nil { - return fmt.Errorf("Couldn't read the resume json file from %s: %s", resumePath, err) + return fmt.Errorf("Couldn't read the resume json file from %s: %s", resumePathValidate, err) } if err := schema.ValidateResume(resume); err != nil { @@ -28,7 +24,7 @@ func validateRun(cmd *cobra.Command, args []string) error { } return fmt.Errorf("Couldn't validate the resume: %s", err) } - fmt.Printf("%s is valid and conforming with the resumic schema\n", resumePath) + fmt.Printf("%s is valid and conforming with the resumic schema\n", resumePathValidate) return nil } @@ -40,5 +36,6 @@ var validateCmd = &cobra.Command{ } func init() { + validateCmd.Flags().StringVarP(&resumePathValidate, "resume", "r", "resume.json", "Path to resume data file") rootCmd.AddCommand(validateCmd) } diff --git a/cmd/validate_test.go b/cmd/validate_test.go index 3506f9e..4d6ed83 100644 --- a/cmd/validate_test.go +++ b/cmd/validate_test.go @@ -4,7 +4,7 @@ import "testing" func TestValidateRunValid(t *testing.T) { resumeFile := "../example.json" - err := validateRun(validateCmd, []string{resumeFile}) + err := Execute([]string{"validate", "-r", resumeFile}) //validateRun(validateCmd, []string{"-r", resumeFile}) if err != nil { t.Fatalf("Expected valid state, got error, %s", err) } From ac4abf5de6682d686ac03a23d0b2f6124dc94569 Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Mon, 15 Jul 2019 13:50:23 -0400 Subject: [PATCH 14/19] cleaned up extra comments --- cmd/render.go | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/cmd/render.go b/cmd/render.go index 4fab613..a4d7834 100644 --- a/cmd/render.go +++ b/cmd/render.go @@ -21,31 +21,6 @@ var ( ) func renderRun(cmd *cobra.Command, args []string) error { - - // switch argLen := len(args); argLen { - // // No args: use defaults for input file and output file. - // case 0: - // resumePath = defaultResume - // htmlPath = defaultHTML - // // 1 argument: check to see what the file type is. If JSON, use as input file. - // // If HTML, use as output file. This doesn't permit using files with no extension. - // case 1: - // if strings.Contains(args[0], ".json") { - // resumePath = args[0] - // htmlPath = defaultHTML - // } else if strings.Contains(args[0], ".html") { - // resumePath = defaultResume - // htmlPath = args[0] - // } else { - // return fmt.Errorf("Please provide argument(s) with a valid .json or .html extension") - // } - // // 2 args: use args for input and output files. - // case 2: - // resumePath = args[0] - // htmlPath = args[1] - // } - // // resumePath := args[0] - // // htmlPath := args[1] cacheDir, err := cmd.Flags().GetString("cacheDir") if err != nil { panic(err) From 2f10228412584e814d445e8d2b7ab307886331d3 Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Mon, 15 Jul 2019 13:51:35 -0400 Subject: [PATCH 15/19] got rid of extra consts --- cmd/render.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cmd/render.go b/cmd/render.go index a4d7834..9def034 100644 --- a/cmd/render.go +++ b/cmd/render.go @@ -9,12 +9,6 @@ import ( "github.com/spf13/cobra" ) -// Added in case we change default filenames. -const ( - defaultHTML = "resume.html" - defaultResume = "resume.json" -) - var ( resumePath string htmlPath string From a30010ce01407bbc4ca97c38becc065ff6fbef8f Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Mon, 15 Jul 2019 14:01:34 -0400 Subject: [PATCH 16/19] fixing usage string --- cmd/render.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/render.go b/cmd/render.go index 9def034..2bbd9b9 100644 --- a/cmd/render.go +++ b/cmd/render.go @@ -52,7 +52,7 @@ func renderRun(cmd *cobra.Command, args []string) error { } var renderCmd = &cobra.Command{ - Use: "render JSON_PATH (defaults to resume.json) HTML_PATH (defaults to resume.html)", + Use: "render", Short: "Render json resume to html", Args: cobra.MaximumNArgs(2), RunE: renderRun, From 83569b2e3854350af9ca2e85592c4eef6b188c3e Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Wed, 31 Jul 2019 12:54:46 -0400 Subject: [PATCH 17/19] got rid of path in generate example --- cmd/generate_example.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/generate_example.go b/cmd/generate_example.go index 081cdce..3a9aa3f 100644 --- a/cmd/generate_example.go +++ b/cmd/generate_example.go @@ -31,7 +31,7 @@ func generateExampleRun(cmd *cobra.Command, args []string) error { } var generateExampleCmd = &cobra.Command{ - Use: "example PATH", + Use: "example", Short: "Generate an example json resume", Args: cobra.MaximumNArgs(1), RunE: generateExampleRun, From 084676a04aef71df2dab22abe41ccb78a9900b4e Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Wed, 31 Jul 2019 12:57:42 -0400 Subject: [PATCH 18/19] got rid of PATH text in generate jsonschema --- cmd/generate_jsonschema.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/generate_jsonschema.go b/cmd/generate_jsonschema.go index 65969b7..6175038 100644 --- a/cmd/generate_jsonschema.go +++ b/cmd/generate_jsonschema.go @@ -24,7 +24,7 @@ func generateJSONSchemaRun(cmd *cobra.Command, args []string) error { } var generateJSONSchemaCmd = &cobra.Command{ - Use: "jsonschema PATH", + Use: "jsonschema", Short: "Generate the jsonschema for the resumic schema", Args: cobra.MaximumNArgs(1), RunE: generateJSONSchemaRun, From dbe30bf13ea982061840fdbd950063bb7c6a877b Mon Sep 17 00:00:00 2001 From: Jahziel Villasana Date: Wed, 31 Jul 2019 12:59:31 -0400 Subject: [PATCH 19/19] got rid of PATH text in generate uischema --- cmd/generate_uischema.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/generate_uischema.go b/cmd/generate_uischema.go index 539aaf2..15fc9af 100644 --- a/cmd/generate_uischema.go +++ b/cmd/generate_uischema.go @@ -24,7 +24,7 @@ func generateUISchemaRun(cmd *cobra.Command, args []string) error { } var generateUISchemaCmd = &cobra.Command{ - Use: "uischema PATH", + Use: "uischema", Short: "Generate the uischema for the resumic schema", Args: cobra.MaximumNArgs(1), RunE: generateUISchemaRun,