Compare commits
44 Commits
7f0a8a3da3
...
v1.0
Author | SHA1 | Date | |
---|---|---|---|
04d78dc9ba | |||
2d31c6b37e | |||
47596f7e3a | |||
30a6abf391 | |||
66bcba5584 | |||
7a9abe314a | |||
a956f3ad42 | |||
0c3b9b4868 | |||
0ce7627edb | |||
d8eb0eefcc | |||
9511d3d6ba | |||
1d37671cfa | |||
d61770054b | |||
659ed76189 | |||
a62bcb3412 | |||
4665979277 | |||
aa9a9a9fb9 | |||
9e97af3bdc | |||
d9ef630835 | |||
171eb46522 | |||
1fba3a2642 | |||
5bb19c8dfe | |||
c5b5557270 | |||
5c63ee2049 | |||
7d70e0ecfd | |||
97fff8372e | |||
7f7f28410b | |||
f734bc78ab | |||
7454badfb0 | |||
d49b3f0aae | |||
435d7cbef8 | |||
bee95a2d4a | |||
6b672228ad | |||
eaf5c35ba1 | |||
e850a726b2 | |||
5f86add57c | |||
c9fb7e1286 | |||
56fc91fa68 | |||
a0db8e8df0 | |||
3b97fccc1e | |||
155cad1513 | |||
ca77429b0f | |||
6a43a110b6 | |||
d53b71de95 |
10
.gitignore
vendored
10
.gitignore
vendored
@@ -1,8 +1,2 @@
|
||||
build-output/client-submission/*.md
|
||||
build-output/client-submission/*.pdf
|
||||
build-output/client-submission/*.doc
|
||||
build-output/job-board/*.md
|
||||
build-output/job-board/*.pdf
|
||||
build-output/job-board/*.doc
|
||||
build-temp/*.yml
|
||||
build-temp/*.md
|
||||
build-output/*
|
||||
build-temp/*
|
22
README.md
22
README.md
@@ -2,7 +2,6 @@
|
||||
|
||||
- [MarkdownResume-Pipeline](#markdownresume-pipeline)
|
||||
- [Introduction](#introduction)
|
||||
- [Quickstart](#quickstart)
|
||||
- [Directory Overview](#directory-overview)
|
||||
- [Build pipeline](#build-pipeline)
|
||||
- [Outputs](#outputs)
|
||||
@@ -10,19 +9,9 @@
|
||||
|
||||
## Introduction
|
||||
|
||||
Resume formatting/publication/management is difficult, tedious, annoying etc. The @ReachableCEO has hacked the process and made it easy!
|
||||
Resume formatting/publication/management is difficult, tedious, annoying etc. The @ReachableCEO has hacked the process and made it easy! This repository is the core build scripts, templates etc used for resume management. It's meant as one half of a complete solution.
|
||||
|
||||
## Quickstart
|
||||
|
||||
I recommend doing these steps in order for efficency.
|
||||
|
||||
- Edit build/build.sh and alter the top section to refelct your information.
|
||||
- Edit Templates/WorkHistory/WorkHistory.csv
|
||||
- Create Templates/JobHistoryDetails/<position>.md to match the value in the first field of WorkHistory.csv
|
||||
- Edit SkillsAndProjects/Projects.md
|
||||
- Edit SkillsAndProjects/Skills.csv
|
||||
- Edit Templates/CandidateInfoSheet.md
|
||||
- cd to the build directory and bash build.sh
|
||||
Please see [MarkdownResum-Pipeline-ClientExample repository](https://git.knownelement.com/reachableceo/MarkdownResume-Pipeline-ClientExample) for the other half. You would clone that repository and follow the instructions. That repository has this repository vendored into it.
|
||||
|
||||
## Directory Overview
|
||||
|
||||
@@ -30,7 +19,7 @@ I recommend doing these steps in order for efficency.
|
||||
- build-output: markdown file for pandoc gets placed here. If you want to make formatting changes before conversion to PDF/Word, you can do so.
|
||||
- build-temp: working directory for the build process. In case you need to debug an intermediate step.
|
||||
- Templates
|
||||
- CandidateInfoSHeet: contains the markdown/yaml template files for a candidate information sheet. This allows you to produce a standardized reply to recruiters to eliminate an average of 6 emails/phone calls per inbound lead. It has a rate sheet and all the standard "matrix" tables they need to fill out for submission to an end client (or, in reality, to the US based recruiting team who interfaces with the client).
|
||||
- CandidateInfoSheet: contains the markdown/yaml template files for a candidate information sheet. This allows you to produce a standardized reply to recruiters to eliminate an average of 6 emails/phone calls per inbound lead. It has a rate sheet and all the standard "matrix" tables they need to fill out for submission to an end client (or, in reality, to the US based recruiting team who interfaces with the client).
|
||||
- ContactInfo: contact info (one version for the recruiter facing resume, one version for client facing).
|
||||
- JobHistoryDetails: details for each position listed in WorkHistory/WorkHistory.csv.
|
||||
- SkillsAndProjects: This contains what the name says. Holds a skills.csv file that gets turned into a skills table and a projects file that gets placed at beginning of resume as a career highlights section.
|
||||
@@ -40,7 +29,8 @@ I recommend doing these steps in order for efficency.
|
||||
|
||||
In the build directory:
|
||||
|
||||
- build.sh - Builds three assets:
|
||||
- build-demo.sh - End to end self contained build example for testing the repository after changes to templates.
|
||||
- build-pipeline-server.sh - Used by client repository to builds three assets:
|
||||
- PDF/Word for submitting to job portals
|
||||
- PDF/Word for submitting to end clients (strips cover sheet/contact info)
|
||||
- PDF of the candidate information sheet.
|
||||
@@ -56,7 +46,7 @@ In the build directory:
|
||||
|
||||
This system is in production use by the @ReachableCEO:
|
||||
|
||||
- [MarkdownResume-ReachableCEO](https://git.knownelement.com/reachableceo/MarkdownResume-ReachableCEO)
|
||||
- [MarkdownResume-ClientExample-ReachableCEO](https://git.knownelement.com/reachableceo/MarkdownResume-ReachableCEO)
|
||||
- [ReachableCEO Career Site](https://resume.reachableceo.com)
|
||||
- uploaded to all major job portals
|
||||
|
||||
|
@@ -1,121 +0,0 @@
|
||||
# {{CandidateName}} Candidate Information Sheet
|
||||
|
||||
## Introduction
|
||||
|
||||
Hello,
|
||||
|
||||
I apologize for the form letter response.
|
||||
|
||||
I receive a high volume of recruiter emails every day and I've found this letter to be the most efficient way to
|
||||
handle the high volume of emails and reduce back and forth emails/texts/calls.
|
||||
|
||||
If you have any questions/comments/concerns not covered by this document, please let me know via e-mail and I'm happy to address them!
|
||||
|
||||
If you ask me something answered in this document, I will not respond and will not move forward with the opportunity, so please read it in detail!
|
||||
|
||||
## Re: share my ID over email
|
||||
|
||||
I WILL NOT share my (full or redacted) photo ID over email or any other electronic written
|
||||
communication. If that is "required" then I have no interest in moving forward with this opportunity.
|
||||
|
||||
I am happy to get on a teams/zoom/google meet etc call and show my ID.
|
||||
|
||||
## Re: professional references
|
||||
|
||||
I am happy to provide professional references once an interview with the end client/customer/hiring manager/team has been scheduled. I will NOT provide references up front. If that is "required" then I have no interest in moving forward with this opportunity.
|
||||
|
||||
## Re: relocation
|
||||
|
||||
if the role is not based in **{{CandidateLocation}}** or **Other Location** I will need to re-locate
|
||||
|
||||
| Question | Answer |
|
||||
|-------------------------------------------|--------|
|
||||
| Am I open to relocation? | Yes |
|
||||
| Am I willing to re-locate at own expense? | No |
|
||||
| Am I open to up to 100% travel | Yes |
|
||||
|
||||
Please be aware that:
|
||||
|
||||
- I will **only re-locate at the employer expense**.
|
||||
- I will need **two weeks of time** to re-locate.
|
||||
- The net amount of the re-location benefit **MUST be at least {{CandidateRelocationNetMinimumAmount}}** to fully compensate me for the time/effort to re-locate.
|
||||
- The full re-location benefit **must be provided prior to the confirmed start date**.
|
||||
- I **will NOT** accept a reimbursement based re-location package.
|
||||
- I am happy to come onsite (at client expense (paid up front)) for training/orientation etc.
|
||||
|
||||
\pagebreak
|
||||
|
||||
## Rate Schedule (compensation expectations)
|
||||
|
||||
### Fully remote roles
|
||||
|
||||
I have a **very strong** preference for fully remote roles.
|
||||
|
||||
I am open to (at the absolute bottom of my range):
|
||||
|
||||
- **{{CandidateRateSheetRemoteW2HourlyMinimum}}** per hour(w2)
|
||||
- **{{CandidateRateSheetRemoteW2AnnualMinimum}}** annually
|
||||
- **{{CandidateRateSheetRemote1099HourlyMinimum}}** per hour (1099/corp to corp)
|
||||
|
||||
I have a strong preference for roles that are :
|
||||
|
||||
- **{{CandidateRateSheetRemoteW2HourlyPrefer}}** per hour(w2) or more
|
||||
- **{{CandidateRateSheetRemoteW2AnnualPrefer}}** annually or more
|
||||
- **{{CandidateRateSheetRemote1099HourlyPrefer}}** per hour (1099/corp to corp) or more
|
||||
|
||||
### On-site/hybrid roles
|
||||
|
||||
- **{{CandidateRateSheetRemoteW2HourlyPrefer}}** per hour(w2) or more
|
||||
- **{{CandidateRateSheetRemoteW2AnnualPrefer}}** annually or more
|
||||
- **{{CandidateRateSheetRemote1099HourlyPrefer}}** per hour (1099/corp to corp) or more
|
||||
|
||||
In regards to compensation type, I am open to:
|
||||
|
||||
- w2
|
||||
- corp to corp (I have my own LLC)
|
||||
- 1099
|
||||
|
||||
If you have a rate for any of the compensation options above, send them all. I will pick which one works best for my situation and the opportunity.
|
||||
|
||||
If it's a different rate with/without benefits, send both.
|
||||
|
||||
If the above is in alignment with this opportunity, please feel free to send me an RTR with the best rate you can offer.
|
||||
|
||||
\pagebreak
|
||||
|
||||
## Details needed for submission
|
||||
|
||||
### My resume
|
||||
|
||||
[Download Candidate resume(format)](https://some.resume.somewhere/some-Resume.pdf)
|
||||
|
||||
I am happy to discuss and make edits to the resume content specific to the opportunity if you feel they are needed.
|
||||
|
||||
### Candidate details
|
||||
|
||||
Here are my complete candidate details for submission to the role.
|
||||
|
||||
| Question | Answer |
|
||||
|---------------------------------------|-------------------------------------|
|
||||
| Full name | {{CandidateName}} |
|
||||
| E-mail address | {{CandiateEmail}} |
|
||||
| Phone number | {{CandidatePhone}} |
|
||||
| Preferred form of contact | {{CandidatePreferredContactMethod}} |
|
||||
| Work authorization | {{CandidateWorkAuthorization}} |
|
||||
| Are you employed presently? | {{CandidateEmploymentStatus}} |
|
||||
| Current location | {{CandidateCurrentLocation}} |
|
||||
| Current timezone | {{CandidateCurrentTimezone}} |
|
||||
| Timezones I can work in | {{CandidateWorkableTimezones}} |
|
||||
| Availability to interview | {{CandidateInterviewAvailability}} |
|
||||
| Availability to start | {{CandidateStartAvailability}} |
|
||||
| Highest Education | {{CandidateHighestEducation}} |
|
||||
| Graduated Year | {{CandidateGraduationYear}} |
|
||||
| Name of school | {{CandidateSchoolName}} |
|
||||
| Location of school | {{CandidateSchoolLocation}} |
|
||||
| Linkedin Profile | ({{CandidateLinkedin}}) |
|
||||
| Github Profile | ({{CandidateGithub}}) |
|
||||
| Last project | {{CandidateLastProject}} |
|
||||
| DOB | {{CandidateDOB}} |
|
||||
| Total IT/career experience | {{CandidateTotalExperience}} |
|
||||
| Open to in-office/hybrid/remote | Yes |
|
||||
| Any trips planned in next six months? | No |
|
@@ -1,4 +0,0 @@
|
||||
{{CandidateName}}
|
||||
=====
|
||||
|
||||
{{CandidateOneLinerSummary}}
|
@@ -1,6 +0,0 @@
|
||||
{{CandidateName}}
|
||||
=====
|
||||
|
||||
{{CandidateOneLinerSummary}}
|
||||
|
||||
[ [Github Profile]({{CandidateGithub}}) ] . [ [Linkedin Profile]({{CandidateLinkedin}}) ] . [ {{CandidateEmail}} ] . [ {{CandidatePhone}} ] . [ {{CandidateLocation}} ]
|
@@ -1,3 +0,0 @@
|
||||
- Stuff
|
||||
- Things
|
||||
- Amazing project!
|
@@ -1,3 +0,0 @@
|
||||
- Stuff
|
||||
- Things
|
||||
- Amazing project!
|
@@ -1,2 +0,0 @@
|
||||
- Cool project 1.
|
||||
- cool project 2.
|
@@ -1,2 +0,0 @@
|
||||
skill1|1 years|skill,1,details,and,stuff
|
||||
skill2|2 years|skill2,2,details,and,stuff,and,things
|
|
@@ -1,2 +0,0 @@
|
||||
job1,Title of job 1,January 1 1970 - January 6 1980
|
||||
job2,Title of Job 2,January 1 1970 - January 6 1980
|
|
@@ -1,121 +0,0 @@
|
||||
# First Middle Last Candidate Information Sheet
|
||||
|
||||
## Introduction
|
||||
|
||||
Hello,
|
||||
|
||||
I apologize for the form letter response.
|
||||
|
||||
I receive a high volume of recruiter emails every day and I've found this letter to be the most efficient way to
|
||||
handle the high volume of emails and reduce back and forth emails/texts/calls.
|
||||
|
||||
If you have any questions/comments/concerns not covered by this document, please let me know via e-mail and I'm happy to address them!
|
||||
|
||||
If you ask me something answered in this document, I will not respond and will not move forward with the opportunity, so please read it in detail!
|
||||
|
||||
## Re: share my ID over email
|
||||
|
||||
I WILL NOT share my (full or redacted) photo ID over email or any other electronic written
|
||||
communication. If that is "required" then I have no interest in moving forward with this opportunity.
|
||||
|
||||
I am happy to get on a teams/zoom/google meet etc call and show my ID.
|
||||
|
||||
## Re: professional references
|
||||
|
||||
I am happy to provide professional references once an interview with the end client/customer/hiring manager/team has been scheduled. I will NOT provide references up front. If that is "required" then I have no interest in moving forward with this opportunity.
|
||||
|
||||
## Re: relocation
|
||||
|
||||
if the role is not based in **Place 1/Place 2** or **Other Location** I will need to re-locate
|
||||
|
||||
| Question | Answer |
|
||||
|-------------------------------------------|--------|
|
||||
| Am I open to relocation? | Yes |
|
||||
| Am I willing to re-locate at own expense? | No |
|
||||
| Am I open to up to 100% travel | Yes |
|
||||
|
||||
Please be aware that:
|
||||
|
||||
- I will **only re-locate at the employer expense**.
|
||||
- I will need **two weeks of time** to re-locate.
|
||||
- The net amount of the re-location benefit **MUST be at least 1,987.11** to fully compensate me for the time/effort to re-locate.
|
||||
- The full re-location benefit **must be provided prior to the confirmed start date**.
|
||||
- I **will NOT** accept a reimbursement based re-location package.
|
||||
- I am happy to come onsite (at client expense (paid up front)) for training/orientation etc.
|
||||
|
||||
\pagebreak
|
||||
|
||||
## Rate Schedule (compensation expectations)
|
||||
|
||||
### Fully remote roles
|
||||
|
||||
I have a **very strong** preference for fully remote roles.
|
||||
|
||||
I am open to (at the absolute bottom of my range):
|
||||
|
||||
- **$12.34** per hour(w2)
|
||||
- **$123,456.00** annually
|
||||
- **$56.78** per hour (1099/corp to corp)
|
||||
|
||||
I have a strong preference for roles that are :
|
||||
|
||||
- **$34.56** per hour(w2) or more
|
||||
- **$321,987.00** annually or more
|
||||
- **$78.90** per hour (1099/corp to corp) or more
|
||||
|
||||
### On-site/hybrid roles
|
||||
|
||||
- **$34.56** per hour(w2) or more
|
||||
- **$321,987.00** annually or more
|
||||
- **$78.90** per hour (1099/corp to corp) or more
|
||||
|
||||
In regards to compensation type, I am open to:
|
||||
|
||||
- w2
|
||||
- corp to corp (I have my own LLC)
|
||||
- 1099
|
||||
|
||||
If you have a rate for any of the compensation options above, send them all. I will pick which one works best for my situation and the opportunity.
|
||||
|
||||
If it's a different rate with/without benefits, send both.
|
||||
|
||||
If the above is in alignment with this opportunity, please feel free to send me an RTR with the best rate you can offer.
|
||||
|
||||
\pagebreak
|
||||
|
||||
## Details needed for submission
|
||||
|
||||
### My resume
|
||||
|
||||
[Download Charles resume(pdf)](https://resume.reachableceo.com/job-board/CharlesNWyble-Resume.pdf)
|
||||
|
||||
I am happy to discuss and make edits to the resume content specific to the opportunity if you feel they are needed.
|
||||
|
||||
### Candidate details
|
||||
|
||||
Here are my complete candidate details for submission to the role.
|
||||
|
||||
| Question | Answer |
|
||||
|---------------------------------------|-------------------------------------|
|
||||
| Full name | First Middle Last |
|
||||
| E-mail address | |
|
||||
| Phone number | 1 123 456 7890 |
|
||||
| Preferred form of contact | Email will get the fastest response. |
|
||||
| Work authorization | US Citizen |
|
||||
| Are you employed presently? | Not currently employed |
|
||||
| Current location | City,State,Country etc |
|
||||
| Current timezone | Timezone |
|
||||
| Timezones I can work in | Timezones |
|
||||
| Availability to interview | Sometime |
|
||||
| Availability to start | Sometime |
|
||||
| Highest Education | Some education level |
|
||||
| Graduated Year | Graduation year |
|
||||
| Name of school | School name |
|
||||
| Location of school | School location |
|
||||
| Linkedin Profile | (https://www.linkedin.com/) |
|
||||
| Github Profile | (https://www.github.com/) |
|
||||
| Last project | Last project |
|
||||
| DOB | MM/DD |
|
||||
| Total IT/career experience | epoch |
|
||||
| Open to in-office/hybrid/remote | Yes |
|
||||
| Any trips planned in next six months? | No |
|
Binary file not shown.
@@ -1 +0,0 @@
|
||||
This directory is used by the build process. Ignore it.
|
@@ -1 +0,0 @@
|
||||
Working directory for the pipeline. Don't use.
|
@@ -1 +0,0 @@
|
||||
This directory is used by the build process. Ignore it.
|
@@ -1 +0,0 @@
|
||||
Working directory for the pipeline. Don't use.
|
@@ -1,14 +0,0 @@
|
||||
title: "{{CandidateName}} Candidate Detail Sheet"
|
||||
titlepage: true
|
||||
titlepage-logo: "{{CandidateLogo}}"
|
||||
toc: true
|
||||
toc-own-page: true
|
||||
date: \today
|
||||
header-left: "\\hspace{1cm}"
|
||||
header-center: "\\leftmark"
|
||||
header-right: "Page \\thepage"
|
||||
footer-left: "{{CandidateName}}"
|
||||
footer-center: "{{CandidateTagline}}"
|
||||
footer-right: "[Source code]({{CandidateInfoSheetSourceCode}})"
|
||||
urlcolor: {{URLCOLOR}}
|
||||
page-background: "{{PAGEBACKGROUND}}"
|
@@ -1,7 +0,0 @@
|
||||
title: "{{CandidateName}} Resume"
|
||||
header-left: "\\hspace{1cm}"
|
||||
header-center: "\\leftmark"
|
||||
header-right: "Page \\thepage"
|
||||
footer-left: "{{CandidateName}}"
|
||||
urlcolor: {{URLCOLOR}}
|
||||
page-background: "{{PAGEBACKGROUND}}"
|
@@ -1,12 +0,0 @@
|
||||
title: "{{CandidateName}} Resume"
|
||||
titlepage: true
|
||||
titlepage-logo: "{{CandidateLogo}}"
|
||||
date: \today
|
||||
header-left: "\\hspace{1cm}"
|
||||
header-center: "\\leftmark"
|
||||
header-right: "Page \\thepage"
|
||||
footer-left: "{{CandidateName}}"
|
||||
footer-center: "{{CandidateTagline}}"
|
||||
footer-right: "[Source code for this resume]({{ResumeSourceCode}})"
|
||||
urlcolor: {{URLCOLOR}}
|
||||
page-background: "{{PAGEBACKGROUND}}"
|
339
build/build-pipeline-server-json.sh
Normal file
339
build/build-pipeline-server-json.sh
Normal file
@@ -0,0 +1,339 @@
|
||||
#!/bin/bash
|
||||
|
||||
#####################################################################################################
|
||||
#JSON Resume
|
||||
#####################################################################################################
|
||||
|
||||
####################################################
|
||||
####################################################
|
||||
####################################################
|
||||
#DO NOT CHANGE ANYTHING BELOW THIS LINE
|
||||
####################################################
|
||||
####################################################
|
||||
####################################################
|
||||
|
||||
add_open_section()
|
||||
|
||||
{
|
||||
|
||||
echo "{" > $BUILD_OUTPUT_DIR/resume.json
|
||||
|
||||
}
|
||||
|
||||
add_meta_section()
|
||||
|
||||
{
|
||||
|
||||
cat << META >> $BUILD_OUTPUT_DIR/resume.json
|
||||
"meta": {
|
||||
"theme": "$JSONRESUME_THEME"
|
||||
},
|
||||
META
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
add_basics_section()
|
||||
|
||||
{
|
||||
|
||||
cat << BASICS >> $BUILD_OUTPUT_DIR/resume.json
|
||||
|
||||
"basics": {
|
||||
"name": "$CandidateName",
|
||||
"phone": "$CandidatePhone",
|
||||
"label": "$CandidateRole",
|
||||
"image": "$CandidateAvatar",
|
||||
"summary": "$CandidateOneLineSummary",
|
||||
"website": "$CandidateWebsite",
|
||||
"url": "https://lordajax.com",
|
||||
"email": "$CandidateEmail",
|
||||
"location": {
|
||||
"city": "$CandidateLocation",
|
||||
"countryCode": "$CandidateCountry"
|
||||
},
|
||||
},
|
||||
BASICS
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Bash Function to Append JSON
|
||||
add_profiles_section ()
|
||||
|
||||
{
|
||||
|
||||
echo '{"profiles": [' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
while IFS=, read -r username url network; do
|
||||
cat <<EOF >> $BUILD_OUTPUT_DIR/resume.json
|
||||
{
|
||||
"username": "$username",
|
||||
"url": "$url",
|
||||
"network": "$network"
|
||||
},
|
||||
EOF
|
||||
done < $JSON_TEMPLATE_DIRECTORY/profiles.csv
|
||||
# Remove trailing comma and close JSON array
|
||||
sed -i '$ s/},/}/' $BUILD_OUTPUT_DIR/resume.json
|
||||
echo ']}' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
|
||||
}
|
||||
|
||||
add_certificates_section()
|
||||
|
||||
{
|
||||
|
||||
echo '{"certificates": [' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
while IFS=, read -r name date issuer url; do
|
||||
cat <<EOF >> $BUILD_OUTPUT_DIR/resume.json
|
||||
{
|
||||
"name": "$name",
|
||||
"date": "$date",
|
||||
"issuer": "$issuer",
|
||||
"url": "$url"
|
||||
},
|
||||
EOF
|
||||
done < $JSON_TEMPLATE_DIRECTORY/certificates.csv
|
||||
|
||||
# Remove trailing comma and close JSON array
|
||||
sed -i '$ s/},/}/' $BUILD_OUTPUT_DIR/resume.json
|
||||
echo ']}' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
|
||||
}
|
||||
|
||||
add_education_section()
|
||||
|
||||
{
|
||||
|
||||
echo '{"education": [' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
while IFS=, read -r institution url area studyType startDate endDate score courses; do
|
||||
cat <<EOF >> $BUILD_OUTPUT_DIR/resume.json
|
||||
{
|
||||
"institution": "$institution",
|
||||
"url": "$url",
|
||||
"area": "$area",
|
||||
"studyType": "$studyType",
|
||||
"startDate": "$startDate",
|
||||
"endDate": "$endDate",
|
||||
"score": "$score",
|
||||
"courses": [$(echo "$courses" | sed 's/;/","/g' | sed 's/^/"/;s/$/"/')]
|
||||
},
|
||||
EOF
|
||||
done < $JSON_TEMPLATE_DIRECTORY/education.csv
|
||||
|
||||
# Remove trailing comma and close JSON array
|
||||
sed -i '$ s/},/}/' $BUILD_OUTPUT_DIR/resume.json
|
||||
echo ']}' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
|
||||
}
|
||||
|
||||
add_references_section()
|
||||
|
||||
{
|
||||
|
||||
echo '{"references": [' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
while IFS=, read -r reference name; do
|
||||
cat <<EOF >> $BUILD_OUTPUT_DIR/resume.json
|
||||
{
|
||||
"reference": "$reference",
|
||||
"name": "$name"
|
||||
},
|
||||
EOF
|
||||
done < $JSON_TEMPLATE_DIRECTORY/references.csv
|
||||
|
||||
# Remove trailing comma and close JSON array
|
||||
sed -i '$ s/},/}/' $BUILD_OUTPUT_DIR/resume.json
|
||||
echo ']}' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
|
||||
}
|
||||
|
||||
add_skills_section()
|
||||
|
||||
{
|
||||
|
||||
echo '{"skills": [' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
while IFS=, read -r name level keywords; do
|
||||
cat <<EOF >> $BUILD_OUTPUT_DIR/resume.json
|
||||
{
|
||||
"name": "$name",
|
||||
"level": "$level",
|
||||
"keywords": [$(echo "$keywords" | sed 's/;/","/g' | sed 's/^/"/;s/$/"/')]
|
||||
},
|
||||
EOF
|
||||
done < $JSON_TEMPLATE_DIRECTORY/skills.csv
|
||||
|
||||
# Remove trailing comma and close JSON array
|
||||
sed -i '$ s/},/}/' $BUILD_OUTPUT_DIR/resume.json
|
||||
echo ']}' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
|
||||
}
|
||||
|
||||
add_awards_section()
|
||||
|
||||
{
|
||||
|
||||
echo '{"awards": [' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
while IFS=, read -r title awarder date summary; do
|
||||
cat <<EOF >> $BUILD_OUTPUT_DIR/resume.json
|
||||
{
|
||||
"title": "$title",
|
||||
"awarder": "$awarder",
|
||||
"date": "$date",
|
||||
"summary": "$summary"
|
||||
},
|
||||
EOF
|
||||
done < $JSON_TEMPLATE_DIRECTORY/awards.csv
|
||||
|
||||
# Remove trailing comma and close JSON array
|
||||
sed -i '$ s/},/}/' $BUILD_OUTPUT_DIR/resume.json
|
||||
echo ']}' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
|
||||
}
|
||||
|
||||
add_publications_section()
|
||||
|
||||
{
|
||||
|
||||
echo '{"publications": [' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
while IFS=, read -r name publisher releaseDate url summary; do
|
||||
cat <<EOF >> $BUILD_OUTPUT_DIR/resume.json
|
||||
{
|
||||
"name": "$name",
|
||||
"publisher": "$publisher",
|
||||
"releaseDate": "$releaseDate",
|
||||
"url": "$url",
|
||||
"summary": "$summary"
|
||||
},
|
||||
EOF
|
||||
done < $JSON_TEMPLATE_DIRECTORY/publications.csv
|
||||
|
||||
# Remove trailing comma and close JSON array
|
||||
sed -i '$ s/},/}/' $BUILD_OUTPUT_DIR/resume.json
|
||||
echo ']}' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
|
||||
}
|
||||
|
||||
add_volunteer_section()
|
||||
|
||||
{
|
||||
|
||||
echo '{"volunteer": [' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
while IFS=, read -r organization position url startDate summary highlights; do
|
||||
cat <<EOF >> $BUILD_OUTPUT_DIR/resume.json
|
||||
{
|
||||
"organization": "$organization",
|
||||
"position": "$position",
|
||||
"url": "$url",
|
||||
"startDate": "$startDate",
|
||||
"summary": "$summary",
|
||||
"highlights": [$(echo "$highlights" | sed 's/;/","/g' | sed 's/^/"/;s/$/"/')]
|
||||
},
|
||||
EOF
|
||||
done < $JSON_TEMPLATE_DIRECTORY/volunteer.csv
|
||||
|
||||
# Remove trailing comma and close JSON array
|
||||
sed -i '$ s/},/}/' $BUILD_OUTPUT_DIR/resume.json
|
||||
echo ']}' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
|
||||
}
|
||||
|
||||
add_work_section()
|
||||
|
||||
{
|
||||
|
||||
echo '{"work": [' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
while IFS=, read -r name position location website startDate endDate summary highlights; do
|
||||
cat <<EOF >> $BUILD_OUTPUT_DIR/resume.json
|
||||
{
|
||||
"name": "$name",
|
||||
"position": "$position",
|
||||
"location": "$location",
|
||||
"website": "$website",
|
||||
"startDate": "$startDate",
|
||||
"endDate": "$endDate",
|
||||
"summary": "$summary",
|
||||
"highlights": [$(echo "$highlights" | sed 's/;/","/g' | sed 's/^/"/;s/$/"/')]
|
||||
},
|
||||
EOF
|
||||
done < $JSON_TEMPLATE_DIRECTORY/work.csv
|
||||
|
||||
# Remove trailing comma and close JSON array
|
||||
sed -i '$ s/},/}/' $BUILD_OUTPUT_DIR/resume.json
|
||||
echo ']}' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
|
||||
}
|
||||
|
||||
|
||||
add_languages_section()
|
||||
|
||||
{
|
||||
|
||||
echo '{"languages": [' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
while IFS=, read -r language fluency; do
|
||||
cat <<EOF >> $BUILD_OUTPUT_DIR/resume.json
|
||||
{
|
||||
"language": "$language",
|
||||
"fluency": "$fluency"
|
||||
},
|
||||
EOF
|
||||
done < $JSON_TEMPLATE_DIRECTORY/languages.csv
|
||||
|
||||
# Remove trailing comma and close JSON array
|
||||
sed -i '$ s/},/}/' $BUILD_OUTPUT_DIR/resume.json
|
||||
echo ']}' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
|
||||
}
|
||||
|
||||
add_interests_section()
|
||||
|
||||
{
|
||||
|
||||
echo '{"interests": [' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
while IFS=, read -r name keywords; do
|
||||
cat <<EOF >> $BUILD_OUTPUT_DIR/resume.json
|
||||
{
|
||||
"name": "$name",
|
||||
"keywords": [$(echo "$keywords" | sed 's/;/","/g' | sed 's/^/"/;s/$/"/')]
|
||||
},
|
||||
EOF
|
||||
done < $JSON_TEMPLATE_DIRECTORY/interests.csv
|
||||
|
||||
# Remove trailing comma and close JSON array
|
||||
sed -i '$ s/},/}/' $BUILD_OUTPUT_DIR/resume.json
|
||||
echo ']}' >> $BUILD_OUTPUT_DIR/resume.json
|
||||
|
||||
}
|
||||
|
||||
add_close_section()
|
||||
|
||||
{
|
||||
|
||||
echo "}" >> $BUILD_OUTPUT_DIR/resume.json
|
||||
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
{
|
||||
|
||||
add_open_section
|
||||
add_meta_section
|
||||
add_basics_section
|
||||
add_profiles_section
|
||||
add_work_section
|
||||
add_volunteer_section
|
||||
add_education_section
|
||||
add_awards_section
|
||||
add_certificates_section
|
||||
add_publications_section
|
||||
add_skills_section
|
||||
add_languages_section
|
||||
add_interests_section
|
||||
add_references_section
|
||||
add_close_section
|
||||
|
||||
}
|
||||
|
||||
|
||||
main
|
164
build/build-pipeline-server-markdown.sh
Normal file
164
build/build-pipeline-server-markdown.sh
Normal file
@@ -0,0 +1,164 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
#####################################################################################################
|
||||
#Markdown to PDF/MSWord Resumek and candidate info sheet
|
||||
#####################################################################################################
|
||||
|
||||
#############################################
|
||||
# Create the candidate information PDF
|
||||
#############################################
|
||||
|
||||
# Expand variables into rendered YAML files. These will be used by pandoc to create the output artifacts
|
||||
|
||||
$MO_PATH $YamlInputTemplateFileJobBoard > $BUILDYAML_JOBBOARD
|
||||
$MO_PATH $YamlInputTemplateFileClientSubmission > $BUILDYAML_CLIENTSUBMISSION
|
||||
$MO_PATH $YamlInputTemplateFileClientSubmission > $BUILDYAML_CANDIDATEINFOSHEET
|
||||
|
||||
echo "Creating candidate info sheet..."
|
||||
|
||||
$MO_PATH $PipelineClientWorkingDir/Templates/MarkdownResume/CandidateInfoSheet/CandidateInfoSheet.md > "$CandidateInfoSheetMarkdownOutputFile"
|
||||
|
||||
pandoc \
|
||||
"$CandidateInfoSheetMarkdownOutputFile" \
|
||||
--template $PANDOC_TEMPLATE \
|
||||
--metadata-file="$BUILDYAML_CANDIDATEINFOSHEET" \
|
||||
--from markdown \
|
||||
--to=pdf \
|
||||
--output $CandidateInfoSheetPDFOutputFile
|
||||
|
||||
|
||||
|
||||
echo "Combining markdown files into single input file for pandoc..."
|
||||
|
||||
# Create contact info md file
|
||||
$MO_PATH "$PipelineClientWorkingDir/Templates/MarkdownResume/ContactInfo/ContactInfo-JobBoard.md" > "$BUILD_TEMP_DIR/ContactInfo-JobBoard.md"
|
||||
$MO_PATH "$PipelineClientWorkingDir/Templates/MarkdownResume/ContactInfo/ContactInfo-ClientSubmit.md" > "$BUILD_TEMP_DIR/ContactInfo-ClientSubmit.md"
|
||||
|
||||
#Pull in contact info
|
||||
cat "$BUILD_TEMP_DIR/ContactInfo-JobBoard.md" >> "$JobBoardMarkdownOutputFile"
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
|
||||
cat "$BUILD_TEMP_DIR/ContactInfo-ClientSubmit.md" >> "$ClientSubmissionMarkdownOutputFile"
|
||||
echo " " >> "$ClientSubmissionMarkdownOutputFile"
|
||||
|
||||
echo "## Career Highlights" >> "$JobBoardMarkdownOutputFile"
|
||||
echo "## Career Highlights" >> "$ClientSubmissionMarkdownOutputFile"
|
||||
|
||||
cat "$PipelineClientWorkingDir/Templates/MarkdownResume/SkillsAndProjects/Projects.md" >> "$JobBoardMarkdownOutputFile"
|
||||
echo "\pagebreak" >> "$JobBoardMarkdownOutputFile"
|
||||
|
||||
cat "$PipelineClientWorkingDir/Templates/MarkdownResume/SkillsAndProjects/Projects.md" >> "$ClientSubmissionMarkdownOutputFile"
|
||||
echo "\pagebreak" >> "$ClientSubmissionMarkdownOutputFile"
|
||||
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
echo "## Employment History" >> "$JobBoardMarkdownOutputFile"
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
|
||||
echo " " >> "$ClientSubmissionMarkdownOutputFile"
|
||||
echo "## Employment History" >> "$ClientSubmissionMarkdownOutputFile"
|
||||
echo " " >> "$ClientSubmissionMarkdownOutputFile"
|
||||
|
||||
#And here we do some magic...
|
||||
#Pull in :
|
||||
|
||||
# employer
|
||||
# title
|
||||
# start/end dates of employment
|
||||
# long form position summary data from each position
|
||||
|
||||
IFS=$'\n\t'
|
||||
for position in \
|
||||
$(cat "$PipelineClientWorkingDir/Templates/MarkdownResume/WorkHistory/WorkHistory.csv"); do
|
||||
|
||||
COMPANY="$(echo $position|awk -F ',' '{print $1}')"
|
||||
TITLE="$(echo $position|awk -F ',' '{print $2}')"
|
||||
DATEOFEMPLOY="$(echo $position|awk -F ',' '{print $3}')"
|
||||
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
echo "**$COMPANY | $TITLE | $DATEOFEMPLOY**" >> "$JobBoardMarkdownOutputFile"
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
|
||||
echo "**$COMPANY | $TITLE | $DATEOFEMPLOY**" >> "$ClientSubmissionMarkdownOutputFile"
|
||||
echo " " >> "$ClientSubmissionMarkdownOutputFile"
|
||||
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
cat "$PipelineClientWorkingDir/Templates/MarkdownResume/JobHistoryDetails/$COMPANY.md" >> "$JobBoardMarkdownOutputFile"
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
|
||||
cat "$PipelineClientWorkingDir/Templates/MarkdownResume/JobHistoryDetails/$COMPANY.md" >> "$ClientSubmissionMarkdownOutputFile"
|
||||
echo " " >> "$ClientSubmissionMarkdownOutputFile"
|
||||
done
|
||||
|
||||
#Pull in my skills and generate a beautiful table.
|
||||
|
||||
echo "\pagebreak" >> "$JobBoardMarkdownOutputFile"
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
echo "## Skills" >> "$JobBoardMarkdownOutputFile"
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
|
||||
echo "\pagebreak" >> "$ClientSubmissionMarkdownOutputFile"
|
||||
echo " " >> "$ClientSubmissionMarkdownOutputFile"
|
||||
echo "## Skills" >> "$ClientSubmissionMarkdownOutputFile"
|
||||
echo " " >> "$ClientSubmissionMarkdownOutputFile"
|
||||
|
||||
#Table heading
|
||||
echo "|Skill|Experience|Skill Details|" >> "$JobBoardMarkdownOutputFile"
|
||||
echo "|---|---|---|" >> "$JobBoardMarkdownOutputFile"
|
||||
|
||||
echo "|Skill|Experience|Skill Details|" >> "$ClientSubmissionMarkdownOutputFile"
|
||||
echo "|---|---|---|" >> "$ClientSubmissionMarkdownOutputFile"
|
||||
|
||||
#Table rows
|
||||
IFS=$'\n\t'
|
||||
for skill in \
|
||||
$(cat "$PipelineClientWorkingDir/Templates/MarkdownResume/SkillsAndProjects/Skills.csv"); do
|
||||
SKILL_NAME="$(echo $skill|awk -F '|' '{print $1}')"
|
||||
SKILL_YEARS="$(echo $skill|awk -F '|' '{print $2}')"
|
||||
SKILL_DETAIL="$(echo $skill|awk -F '|' '{print $3}')"
|
||||
echo "|**$SKILL_NAME**|$SKILL_YEARS|$SKILL_DETAIL|" >> "$JobBoardMarkdownOutputFile"
|
||||
echo "|**$SKILL_NAME**|$SKILL_YEARS|$SKILL_DETAIL|" >> "$ClientSubmissionMarkdownOutputFile"
|
||||
|
||||
done
|
||||
unset IFS
|
||||
|
||||
echo "Generating PDF output for job board version..."
|
||||
|
||||
pandoc \
|
||||
"$JobBoardMarkdownOutputFile" \
|
||||
--template $PANDOC_TEMPLATE \
|
||||
--metadata-file="$BUILDYAML_JOBBOARD" \
|
||||
--from markdown \
|
||||
--to=pdf \
|
||||
--output "$JobBoardPDFOutputFile"
|
||||
|
||||
echo "Generating PDF output for client submission version..."
|
||||
|
||||
pandoc \
|
||||
"$ClientSubmissionMarkdownOutputFile" \
|
||||
--template "$PANDOC_TEMPLATE" \
|
||||
--metadata-file="$BUILDYAML_CLIENTSUBMISSION" \
|
||||
--from markdown \
|
||||
--to=pdf \
|
||||
--output "$ClientSubmissionPDFOutputFile"
|
||||
|
||||
echo "Generating MSWord output for job board version..."
|
||||
|
||||
pandoc \
|
||||
"$JobBoardMarkdownOutputFile" \
|
||||
--metadata-file="$BUILDYAML_JOBBOARD" \
|
||||
--from markdown \
|
||||
--to=docx \
|
||||
--reference-doc="$WordOutputReferenceDoc" \
|
||||
--output "$JobBoardMSWordOutputFile"
|
||||
|
||||
echo "Generating MSWord output for client submission version..."
|
||||
|
||||
pandoc \
|
||||
"$ClientSubmissionMarkdownOutputFile" \
|
||||
--metadata-file="$BUILDYAML_CLIENTSUBMISSION" \
|
||||
--from markdown \
|
||||
--to=docx \
|
||||
--reference-doc="$WordOutputReferenceDoc" \
|
||||
--output "$ClientSubmissionMSWordOutputFile"
|
267
build/build.sh
267
build/build.sh
@@ -1,267 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
###################################################
|
||||
# Modify these values to suit
|
||||
###################################################
|
||||
|
||||
|
||||
########################
|
||||
# Contact info
|
||||
########################
|
||||
|
||||
export CandidateName="First Middle Last"
|
||||
export CandidatePhone="1 123 456 7890"
|
||||
export CandidateLocation="Place 1/Place 2"
|
||||
export CandidateEmail="candidate@domain.com"
|
||||
|
||||
########################
|
||||
# Profile information
|
||||
########################
|
||||
|
||||
export CandidateOneLineSummary="Super awesome and stuff."
|
||||
export CandidateLinkedin="https://www.linkedin.com/"
|
||||
export CandidateGithub="https://www.github.com/"
|
||||
export CandidateTagline="Your.Tagline.Here."
|
||||
|
||||
########################
|
||||
# Formatting options
|
||||
########################
|
||||
|
||||
export CandidateLogo=""
|
||||
export ResumeSourceCode="https://git.knownelement.com/reachableceo/MarkdownResume-Pipeline"
|
||||
export CandidateInfoSheetSourceCode="https://git.knownelement.com/reachableceo/MarkdownResume-Pipeline"
|
||||
export URLCOLOR="blue"
|
||||
export PAGEBACKGROUND="../vendor/git.knownelement.com/ExternalVendorCode/pandoc-latex-template/examples/page-background/backgrounds/background3.pdf"
|
||||
|
||||
##########################
|
||||
# Candidate info sheet
|
||||
##########################
|
||||
|
||||
export CandidatePreferredContactMethod="Email will get the fastest response."
|
||||
export CandidateWorkAuthorization="US Citizen"
|
||||
export CandidateEmploymentStatus="Not currently employed"
|
||||
export CandidateCurrentLocation="City,State,Country etc"
|
||||
export CandidateCurrentTimezone="Timezone"
|
||||
export CandidateWorkableTimezones="Timezones"
|
||||
export CandidateInterviewAvailability="Sometime"
|
||||
export CandidateStartAvailability="Sometime"
|
||||
export CandidateHighestEducation="Some education level"
|
||||
export CandidateGraduationYear="Graduation year"
|
||||
export CandidateSchoolName="School name"
|
||||
export CandidateSchoolLocation="School location"
|
||||
export CandidateLastProject="Last project"
|
||||
export CandidateDOB="MM/DD"
|
||||
export CandidateTotalExperience="epoch"
|
||||
|
||||
|
||||
########################
|
||||
#Compensation targets
|
||||
########################
|
||||
|
||||
export CandidateRelocationNetMinimumAmount="1,987.11"
|
||||
|
||||
export CandidateRateSheetRemoteW2HourlyMinimum="\$12.34"
|
||||
export CandidateRateSheetRemoteW2AnnualMinimum="\$123,456.00"
|
||||
export CandidateRateSheetRemote1099HourlyMinimum="\$56.78"
|
||||
|
||||
export CandidateRateSheetRemoteW2HourlyPrefer="\$34.56"
|
||||
export CandidateRateSheetRemoteW2AnnualPrefer="\$321,987.00"
|
||||
export CandidateRateSheetRemote1099HourlyPrefer="\$78.90"
|
||||
|
||||
####################################################
|
||||
#DO NOT CHANGE ANYTHING BELOW THIS LINE
|
||||
####################################################
|
||||
|
||||
############################################################
|
||||
# Setup globals
|
||||
############################################################
|
||||
|
||||
readonly MO_PATH="bash ../vendor/git.knownelement.com/ExternalVendorCode/mo/mo"
|
||||
readonly BUILD_OUTPUT_DIR="../build-output"
|
||||
readonly BUILD_TEMP_DIR="../build-temp"
|
||||
readonly BUILDYAML_JOBBOARD="$BUILD_TEMP_DIR/JobBoard.yml"
|
||||
readonly BUILDYAML_CLIENTSUBMISSION="$BUILD_TEMP_DIR/ClientSubmission.yml"
|
||||
readonly BUILDYAML_CANDIDATEINFOSHEET="$BUILD_TEMP_DIR/CandidateInfoSheet.yml"
|
||||
|
||||
CandidateInfoSheetMarkdownOutputFile="$BUILD_OUTPUT_DIR/CandidateInfoSheet.md"
|
||||
CandidateInfoSheetPDFOutputFIle="$BUILD_OUTPUT_DIR/CandidateInfoSheet.pdf"
|
||||
|
||||
JobBoardMarkdownOutputFile="$BUILD_OUTPUT_DIR/job-board/Resume.md"
|
||||
JobBoardPDFOutputFile="$BUILD_OUTPUT_DIR/job-board/Resume.pdf"
|
||||
JobBoardMSWordOutputFile="$BUILD_OUTPUT_DIR/job-board/Resume.doc"
|
||||
|
||||
ClientSubmissionMarkdownOutputFile="$BUILD_OUTPUT_DIR/client-submission/Resume.md"
|
||||
ClientSubmissionPDFOutputFile="$BUILD_OUTPUT_DIR/client-submission//Resume.pdf"
|
||||
ClientSubmissionMSWordOutputFile="$BUILD_OUTPUT_DIR/client-submission/Resume.doc"
|
||||
|
||||
echo "Cleaning up from previous runs..."
|
||||
|
||||
rm $BUILDYAML_CANDIDATEINFOSHEET
|
||||
rm $CandidateInfoSheetMarkdownOutputFile
|
||||
rm $CandidateInfoSheetPDFOutputFIle
|
||||
|
||||
rm $BUILDYAML_JOBBOARD
|
||||
rm $JobBoardMarkdownOutputFile
|
||||
rm $JobBoardPDFOutputFile
|
||||
rm $JobBoardMSWordOutputFile
|
||||
|
||||
rm $BUILDYAML_CLIENTSUBMISSION
|
||||
rm $ClientSubmissionMarkdownOutputFile
|
||||
rm $ClientSubmissionPDFOutputFile
|
||||
rm $ClientSubmissionMSWordOutputFile
|
||||
|
||||
# Expand variables into rendered YAML files. These will be used by pandoc to create the output artifacts
|
||||
|
||||
$MO_PATH ./BuildTemplate-CandidateInfoSheet.yml > $BUILDYAML_CANDIDATEINFOSHEET
|
||||
$MO_PATH ./BuildTemplate-JobBoard.yml > $BUILDYAML_JOBBOARD
|
||||
$MO_PATH ./BuildTemplate-ClientSubmission.yml > $BUILDYAML_CLIENTSUBMISSION
|
||||
|
||||
echo "Creating candidate info sheet..."
|
||||
|
||||
$MO_PATH ../Templates/CandidateInfoSheet/CandidateInfoSheet.md > $CandidateInfoSheetMarkdownOutputFile
|
||||
|
||||
pandoc \
|
||||
"$CandidateInfoSheetMarkdownOutputFile" \
|
||||
--template eisvogel \
|
||||
--metadata-file="../build-temp/CandidateInfoSheet.yml" \
|
||||
--from markdown \
|
||||
--to=pdf \
|
||||
--output $CandidateInfoSheetPDFOutputFIle
|
||||
|
||||
|
||||
exit
|
||||
|
||||
|
||||
echo "Combining markdown files into single input file for pandoc..."
|
||||
|
||||
# Create contact info md file
|
||||
$MO_PATH ../Templates/ContactInfo/ContactInfo-JobBoard.md > $BUILD_TEMP_DIR/ContactInfo-JobBoard.md
|
||||
$MO_PATH ../Templates/ContactInfo/ContactInfo-ClientSubmit.md > $BUILD_TEMP_DIR/ContactInfo-ClientSubmit.md
|
||||
|
||||
#Pull in contact info
|
||||
cat $BUILD_TEMP_DIR/ContactInfo-JobBoard.md >> $JobBoardMarkdownOutputFile
|
||||
echo " " >> $JobBoardMarkdownOutputFile
|
||||
|
||||
cat $BUILD_TEMP_DIR/ContactInfo-ClientSubmit.md >> $ClientSubmissionMarkdownOutputFile
|
||||
echo " " >> $ClientSubmissionMarkdownOutputFile
|
||||
|
||||
echo "## Career Highlights" >> $JobBoardMarkdownOutputFile
|
||||
echo "## Career Highlights" >> $ClientSubmissionMarkdownOutputFile
|
||||
|
||||
cat ../Templates/SkillsAndProjects/Projects.md >> $JobBoardMarkdownOutputFile
|
||||
echo "\pagebreak" >> $JobBoardMarkdownOutputFile
|
||||
|
||||
cat ../Templates/SkillsAndProjects/Projects.md >> $ClientSubmissionMarkdownOutputFile
|
||||
echo "\pagebreak" >> $ClientSubmissionMarkdownOutputFile
|
||||
|
||||
echo " " >> $JobBoardMarkdownOutputFile
|
||||
echo "## Employment History" >> $JobBoardMarkdownOutputFile
|
||||
echo " " >> $JobBoardMarkdownOutputFile
|
||||
|
||||
echo " " >> $ClientSubmissionMarkdownOutputFile
|
||||
echo "## Employment History" >> $ClientSubmissionMarkdownOutputFile
|
||||
echo " " >> $ClientSubmissionMarkdownOutputFile
|
||||
|
||||
#And here we do some magic...
|
||||
#Pull in :
|
||||
|
||||
# employer
|
||||
# title
|
||||
# start/end dates of employment
|
||||
# long form position summary data from each position
|
||||
|
||||
IFS=$'\n\t'
|
||||
for position in \
|
||||
$(cat ../Templates/WorkHistory/WorkHistory.csv); do
|
||||
|
||||
COMPANY="$(echo $position|awk -F ',' '{print $1}')"
|
||||
TITLE="$(echo $position|awk -F ',' '{print $2}')"
|
||||
DATEOFEMPLOY="$(echo $position|awk -F ',' '{print $3}')"
|
||||
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
echo "**$COMPANY | $TITLE | $DATEOFEMPLOY**" >> $JobBoardMarkdownOutputFile
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
|
||||
echo "**$COMPANY | $TITLE | $DATEOFEMPLOY**" >> $ClientSubmissionMarkdownOutputFile
|
||||
echo " " >> "$ClientSubmissionMarkdownOutputFile"
|
||||
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
cat ../Templates/JobHistoryDetails/$COMPANY.md >> "$JobBoardMarkdownOutputFile"
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
|
||||
cat ../Templates/JobHistoryDetails/$COMPANY.md >> "$ClientSubmissionMarkdownOutputFile"
|
||||
echo " " >> "$ClientSubmissionMarkdownOutputFile"
|
||||
done
|
||||
|
||||
#Pull in my skills and generate a beautiful table.
|
||||
|
||||
echo "\pagebreak" >> $JobBoardMarkdownOutputFile
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
echo "## Skills" >> "$JobBoardMarkdownOutputFile"
|
||||
echo " " >> "$JobBoardMarkdownOutputFile"
|
||||
|
||||
echo "\pagebreak" >> $ClientSubmissionMarkdownOutputFile
|
||||
echo " " >> "$ClientSubmissionMarkdownOutputFile"
|
||||
echo "## Skills" >> "$ClientSubmissionMarkdownOutputFile"
|
||||
echo " " >> "$ClientSubmissionMarkdownOutputFile"
|
||||
|
||||
#Table heading
|
||||
echo "|Skill|Experience|Skill Details|" >> $JobBoardMarkdownOutputFile
|
||||
echo "|---|---|---|" >> $JobBoardMarkdownOutputFile
|
||||
|
||||
echo "|Skill|Experience|Skill Details|" >> $ClientSubmissionMarkdownOutputFile
|
||||
echo "|---|---|---|" >> $ClientSubmissionMarkdownOutputFile
|
||||
|
||||
#Table rows
|
||||
IFS=$'\n\t'
|
||||
for skill in \
|
||||
$(cat ../Templates/SkillsAndProjects/Skills.csv); do
|
||||
SKILL_NAME="$(echo $skill|awk -F '|' '{print $1}')"
|
||||
SKILL_YEARS="$(echo $skill|awk -F '|' '{print $2}')"
|
||||
SKILL_DETAIL="$(echo $skill|awk -F '|' '{print $3}')"
|
||||
echo "|**$SKILL_NAME**|$SKILL_YEARS|$SKILL_DETAIL|" >> $JobBoardMarkdownOutputFile
|
||||
echo "|**$SKILL_NAME**|$SKILL_YEARS|$SKILL_DETAIL|" >> $ClientSubmissionMarkdownOutputFile
|
||||
|
||||
done
|
||||
unset IFS
|
||||
|
||||
echo "Generating PDF output for job board version..."
|
||||
|
||||
pandoc \
|
||||
"$JobBoardMarkdownOutputFile" \
|
||||
--template eisvogel \
|
||||
--metadata-file="../build-temp/JobBoard.yml" \
|
||||
--from markdown \
|
||||
--to=pdf \
|
||||
--output $JobBoardPDFOutputFile
|
||||
|
||||
echo "Generating MSWord output for job board version..."
|
||||
|
||||
pandoc \
|
||||
"$JobBoardMarkdownOutputFile" \
|
||||
--metadata-file="../build-temp/JobBoard.yml" \
|
||||
--from markdown \
|
||||
--to=docx \
|
||||
--reference-doc=resume-docx-reference.docx \
|
||||
--output $JobBoardMSWordOutputFile
|
||||
|
||||
echo "Generating PDF output for client submission version..."
|
||||
|
||||
pandoc \
|
||||
"$ClientSubmissionMarkdownOutputFile" \
|
||||
--template eisvogel \
|
||||
--metadata-file="../build-temp/ClientSubmission.yml" \
|
||||
--from markdown \
|
||||
--to=pdf \
|
||||
--output $ClientSubmissionPDFOutputFile
|
||||
|
||||
echo "Generating MSWord output for client submission version..."
|
||||
|
||||
pandoc \
|
||||
"$ClientSubmissionMarkdownOutputFile" \
|
||||
--metadata-file="../build-temp/ClientSubmission.yml" \
|
||||
--from markdown \
|
||||
--to=docx \
|
||||
--reference-doc=resume-docx-reference.docx \
|
||||
--output $ClientSubmissionMSWordOutputFile
|
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
Thanks for contributing to b3bp! As part of your PR, have you:
|
||||
|
||||
- [ ] Added an item in [CHANGELOG.md](https://github.com/kvz/bash3boilerplate/blob/HEAD/CHANGELOG.md) with attribution?
|
||||
- [ ] Added your name to the [README.md](https://github.com/kvz/bash3boilerplate/blob/HEAD/README.md#authors)
|
||||
- [ ] Linted your code? (`make test` should do the trick)
|
||||
|
||||
If so, great! Feel free to replace this message with a description of your work and hit submit!
|
@@ -1,5 +0,0 @@
|
||||
groups:
|
||||
production-dependencies:
|
||||
dependency-type: 'production'
|
||||
development-dependencies:
|
||||
dependency-type: 'development'
|
30
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/.github/workflows/ci.yml
generated
vendored
30
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/.github/workflows/ci.yml
generated
vendored
@@ -1,30 +0,0 @@
|
||||
name: b3bp CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
jobs:
|
||||
ci:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 18.x
|
||||
- name: Install
|
||||
run: |
|
||||
corepack yarn
|
||||
- name: Lint
|
||||
env:
|
||||
SHELLCHECK_SEVERITY: warning
|
||||
run: |
|
||||
corepack yarn lint
|
||||
- name: Test
|
||||
run: |
|
||||
corepack yarn test
|
5
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/.gitignore
generated
vendored
5
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/.gitignore
generated
vendored
@@ -1,5 +0,0 @@
|
||||
.yarn
|
||||
assets/build
|
||||
env.sh
|
||||
node_modules
|
||||
npm-debug.log
|
3
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/.shellcheckrc
generated
vendored
3
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/.shellcheckrc
generated
vendored
@@ -1,3 +0,0 @@
|
||||
external-sources=true
|
||||
shell=bash
|
||||
color=always
|
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": ".."
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
1
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/.yarnrc.yml
generated
vendored
1
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/.yarnrc.yml
generated
vendored
@@ -1 +0,0 @@
|
||||
nodeLinker: node-modules
|
175
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/CHANGELOG.md
generated
vendored
175
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/CHANGELOG.md
generated
vendored
@@ -1,175 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
Here's is a combined todo/done list. You can see what todos are planned for the upcoming release, as well as ideas that may/may not make into a release in `Ideas`.
|
||||
|
||||
## Ideas
|
||||
|
||||
Unplanned.
|
||||
|
||||
- [ ] Better style guide checking (#84)
|
||||
|
||||
## main
|
||||
|
||||
Released: TBA.
|
||||
[Diff](https://github.com/kvz/bash3boilerplate/compare/2.7.2...main).
|
||||
|
||||
- [ ]
|
||||
|
||||
## 2.7.2
|
||||
|
||||
Released: 2023-08-29
|
||||
[Diff](https://github.com/kvz/bash3boilerplate/compare/v2.4.1...2.7.2).
|
||||
|
||||
- [x] Upgrade and cleanup node dependencies
|
||||
- [x] Remove lanyon-based website in favor of simple redirect to github for bash3boilerplate.sh
|
||||
- [x] Make tests pass again
|
||||
- [x] Make linting and style checking separate actions
|
||||
- [x] Add feature to edit/update comments in ini file (#132, @rfuehrer)
|
||||
- [x] Upgrade to `lanyon@0.1.16`
|
||||
- [x] Capture correct error_code in err_report (#124, @eval)
|
||||
- [x] Enhanced ini file handling: create new file, create new sections, handle default section, read key from given section (@rfuehrer)
|
||||
|
||||
## v2.4.2
|
||||
|
||||
Released: 2019-11-07.
|
||||
[Diff](https://github.com/kvz/bash3boilerplate/compare/v2.4.1...v2.4.2).
|
||||
|
||||
- [x] Upgrade to `lanyon@0.1.16`
|
||||
- [x] Capture correct error_code in err_report (#124, @eval)
|
||||
- [x] Enhanced ini file handling: create new file, create new sections, handle default section, read key from given section (@rfuehrer)
|
||||
|
||||
## v2.4.1
|
||||
|
||||
Released: 2019-11-07.
|
||||
[Diff](https://github.com/kvz/bash3boilerplate/compare/v2.3.0...v2.4.1).
|
||||
|
||||
- [x] Upgrade to `lanyon@0.1.7`
|
||||
- [x] Allow counting how many times an argument is used (@genesiscloud)
|
||||
- [x] Fix typos in megamount (thanks @gsaponaro)
|
||||
- [x] Enable color in screen or tmux (#92, @gmasse)
|
||||
- [x] Change `egrep` to `grep -E` in test and lib scripts to comply with ShellCheck (#92, @gmasse)
|
||||
- [x] Fix typo in FAQ (#92, @gmasse)
|
||||
- [x] Fix Travis CI failure on src/templater.sh (@gmasse)
|
||||
- [x] Add magic variable which contains full command invocation
|
||||
- [x] More contrasted alert and emergency colors (#111 @gmeral)
|
||||
- [x] Add support for repeatable arguments (@genesiscloud)
|
||||
- [x] Fix remaining warnings with shellcheck v0.7.0 (#107, @genesiscloud)
|
||||
|
||||
## v2.4.0
|
||||
|
||||
Released: 2016-12-21.
|
||||
[Diff](https://github.com/kvz/bash3boilerplate/compare/v2.3.0...v2.4.0).
|
||||
|
||||
- [x] Upgrade to `lanyon@0.0.143`
|
||||
|
||||
## v2.3.0
|
||||
|
||||
Released: 2016-12-21.
|
||||
[Diff](https://github.com/kvz/bash3boilerplate/compare/v2.2.0...v2.3.0).
|
||||
|
||||
- [x] Add magic variable `__i_am_main_script` to distinguish if b3bp is being sourced or called directly (#45, @zbeekman)
|
||||
- [x] Add style checks for tab characters and trailing whitespace (@zbeekman)
|
||||
- [x] Add backtracing to help localize errors (#44, @zbeekman)
|
||||
- [x] Additional FAQ entries (#47, suggested by @gdevenyi, implemented by @zbeekman)
|
||||
- [x] Ensure that shifting over `--` doesn't throw an errexit error (#21, @zbeekman)
|
||||
- [x] Add Pull Request template (#83)
|
||||
|
||||
## v2.2.0
|
||||
|
||||
Released: 2016-12-21.
|
||||
[Diff](https://github.com/kvz/bash3boilerplate/compare/v2.1.0...v2.2.0).
|
||||
|
||||
- [x] README and FAQ improvements (#66, @mstreuhofer)
|
||||
- [x] Add support for sourcing b3bp (#61, @mstreuhofer)
|
||||
- [x] Upgrade all Node.js dependencies for development (#78)
|
||||
- [x] Switch to http://lanyon.io for static site building, add a new logo
|
||||
- [x] Cleanup environment variables (#58, @mstreuhofer)
|
||||
- [x] Support multi-line logs (#57, @mstreuhofer)
|
||||
- [x] Run shellcheck as part of the acceptance test (#79, @mstreuhofer)
|
||||
- [x] Brace all variables, used `[[` instead of `[` (#33, #76, @mstreuhofer)
|
||||
- [x] Add automatic usage validation for required args (#22, #65, @mstreuhofer)
|
||||
- [x] Remove all usage of eval (@mstreuhofer)
|
||||
- [x] Get rid of awk, sed & egrep usage (#71, @mstreuhofer)
|
||||
- [x] Fix auto-color-off code (#69, #70, @mstreuhofer)
|
||||
- [x] Use shellcheck to find and fix unclean code (#68, #80, @mstreuhofer)
|
||||
- [x] Allow for multiline opt description in `__usage` (#7, @mstreuhofer)
|
||||
- [x] Allow `__usage` and `__helptext` to be defined before sourcing `main.sh` thus makeing b3bp behave like a library (@mstreuhofer)
|
||||
- [x] Add the same License text to each script header (@mstreuhofer)
|
||||
|
||||
## v2.1.0
|
||||
|
||||
Released: 2016-11-08.
|
||||
[Diff](https://github.com/kvz/bash3boilerplate/compare/v2.0.0...v2.1.0).
|
||||
|
||||
- [x] Cleanup b3bp variables (adds prefixes across the board) (thanks @mstreuhofer)
|
||||
- [x] Add multi-line logging support (thanks @mstreuhofer)
|
||||
- [x] Mangle long-option names to allow dashes (thanks @zbeekman)
|
||||
- [x] Remove OS detection altogether (#38, thx @zbeekman)
|
||||
- [x] Offer the main template for download as http://bash3boilerplate.sh/main.sh
|
||||
- [x] Better OS detection (#38, thx @moviuro)
|
||||
- [x] Improve README copy (#34, thx galaktos)
|
||||
- [x] Fix unquoted variable access within (#34 thx galaktos)
|
||||
- [x] For delete-key-friendliness, bundle the commandline definition block along with its parser
|
||||
- [x] Less verbose header comments
|
||||
- [x] For delete-key-friendliness, don't crash on undeclared help vars
|
||||
- [x] Introduce `errtrace`, which is on by default (BREAKING)
|
||||
- [x] Add a configurable `helptext` that is left alone by the parses and allows you to have a richer help
|
||||
- [x] Add a simple documentation website
|
||||
- [x] Add best practice of using `__double_underscore_prefixed_vars` to indicate global variables that are solely controlled inside your script
|
||||
- [x] Make license more permissive by not requiring distribution of the LICENSE file if the copyright & attribution comments are left intact
|
||||
- [x] Respect `--no-color` by setting the `NO_COLOR` flag in `main.sh` (#25, thx @gdevenyi)
|
||||
- [x] Split out changelog into separate file
|
||||
- [x] Added a [FAQ](./FAQ.md) (#15, #14, thanks @rouson)
|
||||
- [x] Fix Travis OSX testing (before, it would silently pass failures) (#10)
|
||||
- [x] Enable dashes in long, GNU style options, as well as numbers (thanks @zbeekman)
|
||||
|
||||
## v2.0.0
|
||||
|
||||
Released: 2016-02-17.
|
||||
[Diff](https://github.com/kvz/bash3boilerplate/compare/v1.2.1...v2.0.0).
|
||||
|
||||
- [x] Add tests for `templater` and follow Library export best practices
|
||||
- [x] Add tests for `ini_val` and follow Library export best practices
|
||||
- [x] Add tests for `parse_url` and follow Library export best practices
|
||||
- [x] Add tests for `megamount` and follow Library export best practices
|
||||
- [x] Remove `bump` from `src` (BREAKING)
|
||||
- [x] Remove `semver` from `src` (BREAKING)
|
||||
|
||||
## v1.2.1
|
||||
|
||||
Released: 2016-02-17.
|
||||
[Diff](https://github.com/kvz/bash3boilerplate/compare/v1.2.0...v1.2.1).
|
||||
|
||||
- [x] Add Travis CI automated testing for OSX (thanks @zbeekman)
|
||||
|
||||
## v1.2.0
|
||||
|
||||
Released: 2016-02-16.
|
||||
[Diff](https://github.com/kvz/bash3boilerplate/compare/v1.1.0...v1.2.0).
|
||||
|
||||
- [x] Allow disabling colors via `NO_COLOR` environment variable
|
||||
- [x] Enable `errexit`, `nounset` and `pipefail` options at the top of the script already
|
||||
- [x] More refined colors (thanks @arathai)
|
||||
- [x] Add a changelog to the README
|
||||
- [x] Add `__os` magic var (limited to discovering OSX and defaulting to Linux for now)
|
||||
- [x] Add `__base` magic var (`main`, if the source script is `main.sh`)
|
||||
- [x] Enable long, GNU style options (thanks @zbeekman)
|
||||
- [x] Add Travis CI automated testing for Linux
|
||||
|
||||
## v1.1.0
|
||||
|
||||
Released: 2015-06-29.
|
||||
[Diff](https://github.com/kvz/bash3boilerplate/compare/v1.0.3...v1.1.0).
|
||||
|
||||
- [x] Add `ALLOW_REMAINDERS` configuration to templater
|
||||
- [x] Fix typo: 'debugmdoe' to 'debugmode' (thanks @jokajak)
|
||||
- [x] Use `${BASH_SOURCE[0]}` for `__file` instead of `${0}`
|
||||
|
||||
## v1.0.3
|
||||
|
||||
Released: 2014-11-02.
|
||||
[Diff](https://github.com/kvz/bash3boilerplate/compare/5db569125319a89b9561b434db84e4d91faefb63...v1.0.3).
|
||||
|
||||
- [x] Add `ini_val`, `megamount`, `parse_url`
|
||||
- [x] Add re-usable libraries in `./src`
|
||||
- [x] Use npm as an additional distribution channel
|
171
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/FAQ.md
generated
vendored
171
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/FAQ.md
generated
vendored
@@ -1,171 +0,0 @@
|
||||
[This document is formatted with GitHub-Flavored Markdown. ]: #
|
||||
[For better viewing, including hyperlinks, read it online at ]: #
|
||||
[https://github.com/kvz/bash3boilerplate/blob/HEAD/FAQ.md ]: #
|
||||
|
||||
## Contents
|
||||
|
||||
- [What is a CLI](#what-is-a-cli)?
|
||||
- [How do I incorporate BASH3 Boilerplate into my own project](#how-do-i-incorporate-bash3-boilerplate-into-my-own-project)?
|
||||
- [How do I add a command-line flag](#how-do-i-add-a-command-line-flag)?
|
||||
- [How do I access the value of a command-line argument](#how-do-i-access-the-value-of-a-command-line-argument)?
|
||||
- [What is a magic variable](#what-is-a-magic-variable)?
|
||||
- [How do I submit an issue report](#how-do-i-submit-an-issue-report)?
|
||||
- [How can I contribute to this project](#how-can-i-contribute-to-this-project)?
|
||||
- [Why are you typing BASH in all caps](#why-are-you-typing-bash-in-all-caps)?
|
||||
- [You are saying you are portable, but why won't b3bp code run in dash / busybox / posh / ksh / mksh / zsh](#you-are-saying-you-are-portable-but-why-wont-b3bp-code-run-in-dash--busybox--posh--ksh--mksh--zsh)?
|
||||
- [How do I do Operating System detection](#how-do-i-do-operating-system-detection)?
|
||||
- [How do I access a potentially unset (environment) variable](#how-do-i-access-a-potentially-unset-environment-variable)?
|
||||
- [How can I detect or trap CTRL-C and other signals](#how-can-i-detect-or-trap-ctrl-c-and-other-signals)?
|
||||
- [How can I get the PID of my running script](how-can-i-get-the-pid-of-my-running-script)?
|
||||
|
||||
<!--more-->
|
||||
|
||||
# Frequently Asked Questions
|
||||
|
||||
## What is a CLI?
|
||||
|
||||
A "CLI" is a [command-line interface](https://en.wikipedia.org/wiki/Command-line_interface).
|
||||
|
||||
## How do I incorporate BASH3 Boilerplate into my own project?
|
||||
|
||||
You can incorporate BASH3 Boilerplate into your project in one of two ways:
|
||||
|
||||
1. Copy the desired portions of [`main.sh`](http://bash3boilerplate.sh/main.sh) into your own script.
|
||||
1. Download [`main.sh`](http://bash3boilerplate.sh/main.sh) and start pressing the delete-key to remove unwanted things
|
||||
|
||||
Once the `main.sh` has been tailor-made for your project, you can either append your own script in the same file, or source it in the following ways:
|
||||
|
||||
1. Copy [`main.sh`](http://bash3boilerplate.sh/main.sh) into the same directory as your script and then edit and embed it into your script using Bash's `source` include feature, e.g.:
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
source main.sh
|
||||
```
|
||||
|
||||
1. Source [`main.sh`](http://bash3boilerplate.sh/main.sh) in your script or at the command line:
|
||||
|
||||
```bash
|
||||
#!/usr/bin/env bash
|
||||
source main.sh
|
||||
```
|
||||
|
||||
## How do I add a command-line flag?
|
||||
|
||||
1. Copy the line from the `main.sh` [read block](https://github.com/kvz/bash3boilerplate/blob/v2.1.0/main.sh#L109-L115) that most resembles the desired behavior and paste the line into the same block.
|
||||
1. Edit the single-character (e.g., `-d`) and, if present, the multi-character (e.g., `--debug`) versions of the flag in the copied line.
|
||||
1. Omit the `[arg]` text in the copied line, if the desired flag takes no arguments.
|
||||
1. Omit or edit the text after `Default=` to set or not set default values, respectively.
|
||||
1. Omit the `Required.` text, if the flag is optional.
|
||||
|
||||
## How do I access the value of a command-line argument?
|
||||
|
||||
To find out the value of an argument, append the corresponding single-character flag to the text `$arg_`. For example, if the [read block]
|
||||
contains the line
|
||||
|
||||
```bash
|
||||
-t --temp [arg] Location of tempfile. Default="/tmp/bar"
|
||||
```
|
||||
|
||||
then you can evaluate the corresponding argument and assign it to a variable as follows:
|
||||
|
||||
```bash
|
||||
__temp_file_name="${arg_t}"
|
||||
```
|
||||
|
||||
## What is a magic variable?
|
||||
|
||||
The [magic variables](https://github.com/kvz/bash3boilerplate/blob/v2.1.0/main.sh#L26-L28) in `main.sh` are special in that they have a different value, depending on your environment. You can use `${__file}` to get a reference to your current script, and `${__dir}` to get a reference to the directory it lives in. This is not to be confused with the location of the calling script that might be sourcing the `${__file}`, which is accessible via `${0}`, or the current directory of the administrator running the script, accessible via `$(pwd)`.
|
||||
|
||||
## How do I submit an issue report?
|
||||
|
||||
Please visit our [Issues](https://github.com/kvz/bash3boilerplate/issues) page.
|
||||
|
||||
## How can I contribute to this project?
|
||||
|
||||
Please fork this repository. After that, create a branch containing your suggested changes and submit a pull request based on the main branch
|
||||
of <https://github.com/kvz/bash3boilerplate/>. We are always more than happy to accept your contributions!
|
||||
|
||||
## Why are you typing BASH in all caps?
|
||||
|
||||
As an acronym, Bash stands for Bourne-again shell, and is usually written with one uppercase.
|
||||
This project's name, however, is "BASH3 Boilerplate". It is a reference to
|
||||
"[HTML5 Boilerplate](https://html5boilerplate.com/)", which was founded to serve a similar purpose,
|
||||
only for crafting webpages.
|
||||
Somewhat inconsistent – but true to Unix ancestry – the abbreviation for our project is "b3bp".
|
||||
|
||||
## You are saying you are portable, but why won't b3bp code run in dash / busybox / posh / ksh / mksh / zsh?
|
||||
|
||||
When we say _portable_, we mean across Bash versions. Bash is widespread and most systems
|
||||
offer at least version 3 of it. Make sure you have that available and b3bp will work for you.
|
||||
|
||||
We run automated tests to make sure that it will. Here is some proof for the following platforms:
|
||||
|
||||
- [Linux](https://travis-ci.org/kvz/bash3boilerplate/jobs/109804166#L91-L94) `GNU bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu)`
|
||||
- [OSX](https://travis-ci.org/kvz/bash3boilerplate/jobs/109804167#L2453-L2455) `GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)`
|
||||
|
||||
This portability, however, does not mean that we try to be compatible with
|
||||
KornShell, Zsh, posh, yash, dash, or other shells. We allow syntax that would explode if
|
||||
you pasted it in anything but Bash 3 and up.
|
||||
|
||||
## How do I do Operating System detection?
|
||||
|
||||
We used to offer a magic `__os` variable, but we quickly [discovered](https://github.com/kvz/bash3boilerplate/issues/38) that it would be hard
|
||||
to create a satisfactory abstraction that is not only correct, but also covers enough use-cases,
|
||||
while still having a relatively small footprint in `main.sh`.
|
||||
|
||||
For simple OS detection, we recommend using the `${OSTYPE}` variable available in Bash as
|
||||
is demoed in [this stackoverflow post](http://stackoverflow.com/a/8597411/151666):
|
||||
|
||||
```bash
|
||||
if [[ "${OSTYPE}" = "linux-gnu" ]]; then
|
||||
echo "GNU Linux"
|
||||
elif [[ "${OSTYPE}" = "darwin"* ]]; then
|
||||
echo "Mac OSX"
|
||||
elif [[ "${OSTYPE}" = "cygwin" ]]; then
|
||||
echo "POSIX compatibility layer and Linux environment emulation for Windows"
|
||||
elif [[ "${OSTYPE}" = "msys" ]]; then
|
||||
echo "Lightweight shell and GNU utilities compiled for Windows (part of MinGW)"
|
||||
elif [[ "${OSTYPE}" = "win32" ]]; then
|
||||
echo "I'm not sure this can happen."
|
||||
elif [[ "${OSTYPE}" = "freebsd"* ]]; then
|
||||
echo "..."
|
||||
else
|
||||
echo "Unknown."
|
||||
fi
|
||||
```
|
||||
|
||||
## How do I access a potentially unset (environment) variable?
|
||||
|
||||
The set -o nounset line in `main.sh` causes error termination when an unset environment variables is detected as unbound. There are multiple ways to avoid this.
|
||||
|
||||
Some code to illustrate:
|
||||
|
||||
```bash
|
||||
# method 1
|
||||
echo ${NAME1:-Damian} # echos Damian, $NAME1 is still unset
|
||||
# method 2
|
||||
echo ${NAME2:=Damian} # echos Damian, $NAME2 is set to Damian
|
||||
# method 3
|
||||
NAME3=${NAME3:-Damian}; echo ${NAME3} # echos Damian, $NAME3 is set to Damian
|
||||
```
|
||||
|
||||
This subject is briefly touched on as well in the [Safety and Portability section under point 5](README.md#safety-and-portability). b3bp currently uses [method 1](https://github.com/kvz/bash3boilerplate/blob/v2.1.0/main.sh#L252) when we want to access a variable that could be undeclared, and [method 3](https://github.com/kvz/bash3boilerplate/blob/v2.1.0/main.sh#L31) when we also want to set a default to an undeclared variable, because we feel it is more readable than method 2. We feel `:=` is easily overlooked, and not very beginner friendly. Method 3 seems more explicit in that regard in our humble opinion.
|
||||
|
||||
## How can I detect or trap Ctrl-C and other signals?
|
||||
|
||||
You can trap [Unix signals](https://en.wikipedia.org/wiki/Unix_signal) like [Ctrl-C](https://en.wikipedia.org/wiki/Control-C) with code similar to:
|
||||
|
||||
```bash
|
||||
# trap ctrl-c and call ctrl_c()
|
||||
trap ctrl_c INT
|
||||
|
||||
function ctrl_c() {
|
||||
echo "** Trapped CTRL-C"
|
||||
}
|
||||
```
|
||||
|
||||
See http://mywiki.wooledge.org/SignalTrap for a list of signals, examples, and an in depth discussion.
|
||||
|
||||
## How can I get the PID of my running script?
|
||||
|
||||
The PID of a running script is contained in the `${$}` variable. This is _not_ the pid of any subshells. With Bash 4 you can get the PID of your subshell with `${BASHPID}`. For a comprehensive list of Bash built in variables see, e.g., http://www.tldp.org/LDP/abs/html/internalvariables.html
|
21
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/LICENSE
generated
vendored
21
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Kevin van Zonneveld and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
59
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/Makefile
generated
vendored
59
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/Makefile
generated
vendored
@@ -1,59 +0,0 @@
|
||||
# Licensed under MIT.
|
||||
# Copyright (2016) by Kevin van Zonneveld https://twitter.com/kvz
|
||||
#
|
||||
# https://www.npmjs.com/package/fakefile
|
||||
#
|
||||
# Please do not edit this file directly, but propose changed upstream instead:
|
||||
# https://github.com/kvz/fakefile/blob/main/Makefile
|
||||
#
|
||||
# This Makefile offers convience shortcuts into any Node.js project that utilizes npm scripts.
|
||||
# It functions as a wrapper around the actual listed in `package.json`
|
||||
# So instead of typing:
|
||||
#
|
||||
# $ npm script build:assets
|
||||
#
|
||||
# you could also type:
|
||||
#
|
||||
# $ make build-assets
|
||||
#
|
||||
# Notice that colons (:) are replaced by dashes for Makefile compatibility.
|
||||
#
|
||||
# The benefits of this wrapper are:
|
||||
#
|
||||
# - You get to keep the the scripts package.json, which is more portable
|
||||
# (Makefiles & Windows are harder to mix)
|
||||
# - Offer a polite way into the project for developers coming from different
|
||||
# languages (npm scripts is obviously very Node centric)
|
||||
# - Profit from better autocomplete (make <TAB><TAB>) than npm currently offers.
|
||||
# OSX users will have to install bash-completion
|
||||
# (http://davidalger.com/development/bash-completion-on-os-x-with-brew/)
|
||||
|
||||
ifeq ($(shell test -e ./yarn.lock && echo -n yes),yes)
|
||||
RUNNER=yarn
|
||||
INSTALLER=yarn install
|
||||
else
|
||||
RUNNER=npm run
|
||||
INSTALLER=npm install
|
||||
endif
|
||||
|
||||
define npm_script_targets
|
||||
TARGETS := $(shell \
|
||||
node -e 'for (var k in require("./package.json").scripts) {console.log(k.replace(/:/g, "-"));}'
|
||||
| grep -v -E "^install$$"
|
||||
)
|
||||
$$(TARGETS):
|
||||
$(RUNNER) $(shell \
|
||||
node -e 'for (var k in require("./package.json").scripts) {console.log(k.replace(/:/g, "-"), k);}'
|
||||
| grep -E "^$(MAKECMDGOALS)\s"
|
||||
| head -n1
|
||||
| awk '{print $$2}'
|
||||
)
|
||||
|
||||
.PHONY: $$(TARGETS)
|
||||
endef
|
||||
|
||||
$(eval $(call npm_script_targets))
|
||||
|
||||
# These npm run scripts are available, without needing to be mentioned in `package.json`
|
||||
install:
|
||||
$(INSTALLER)
|
175
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/README.md
generated
vendored
175
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/README.md
generated
vendored
@@ -1,175 +0,0 @@
|
||||
[This document is formatted with GitHub-Flavored Markdown. ]: #
|
||||
[For better viewing, including hyperlinks, read it online at ]: #
|
||||
[https://github.com/kvz/bash3boilerplate/blob/HEAD/README.md]: #
|
||||
|
||||
- [Overview](#overview)
|
||||
- [Goals](#goals)
|
||||
- [Features](#features)
|
||||
- [Installation](#installation)
|
||||
- [Changelog](#changelog)
|
||||
- [Frequently Asked Questions](#frequently-asked-questions)
|
||||
- [Best Practices](#best-practices)
|
||||
- [Who uses b3bp](#who-uses-b3bp)
|
||||
- [Authors](#authors)
|
||||
- [License](#license)
|
||||
|
||||
## Overview
|
||||
|
||||
<!--more-->
|
||||
|
||||
When hacking up Bash scripts, there are often things such as logging or command-line argument parsing that:
|
||||
|
||||
- You need every time
|
||||
- Come with a number of pitfalls you want to avoid
|
||||
- Keep you from your actual work
|
||||
|
||||
Here's an attempt to bundle those things in a generalized way so that
|
||||
they are reusable as-is in most scripts.
|
||||
|
||||
We call it "BASH3 Boilerplate" or b3bp for short.
|
||||
|
||||
## Goals
|
||||
|
||||
Delete-Key-**Friendly**. Instead of introducing packages, includes, compilers, etc., we propose using [`main.sh`](https://bash3boilerplate.sh/main.sh) as a base and removing the parts you don't need.
|
||||
While this may feel a bit archaic at first, it is exactly the strength of Bash scripts that we should want to embrace.
|
||||
|
||||
**Portable**. We are targeting Bash 3 (OSX still ships
|
||||
with 3, for instance). If you are going to ask people to install
|
||||
Bash 4 first, you might as well pick a more advanced language as a
|
||||
dependency.
|
||||
|
||||
## Features
|
||||
|
||||
- Conventions that will make sure that all your scripts follow the same, battle-tested structure
|
||||
- Safe by default (break on error, pipefail, etc.)
|
||||
- Configuration by environment variables
|
||||
- Simple command-line argument parsing that requires no external dependencies. Definitions are parsed from help info, ensuring there will be no duplication
|
||||
- Helpful magic variables like `__file` and `__dir`
|
||||
- Logging that supports colors and is compatible with [Syslog Severity levels](https://en.wikipedia.org/wiki/Syslog#Severity_levels), as well as the [twelve-factor](https://12factor.net/) guidelines
|
||||
|
||||
## Installation
|
||||
|
||||
There are three different ways to install b3bp:
|
||||
|
||||
### Option 1: Download the main template
|
||||
|
||||
Use curl or wget to download the source and save it as your script. Then you can start deleting the unwanted bits, and adding your own logic.
|
||||
|
||||
```bash
|
||||
wget https://bash3boilerplate.sh/main.sh
|
||||
vim main.sh
|
||||
```
|
||||
|
||||
### Option 2: Clone the entire project
|
||||
|
||||
Besides `main.sh`, this will also get you the entire b3bp repository. This includes a few extra functions that we keep in the `./src` directory.
|
||||
|
||||
```bash
|
||||
git clone git@github.com:kvz/bash3boilerplate.git
|
||||
```
|
||||
|
||||
### Option 3: Require via npm
|
||||
|
||||
As of `v1.0.3`, b3bp can also be installed as a Node module, meaning you can define it as a dependency in `package.json` via:
|
||||
|
||||
```bash
|
||||
npm init
|
||||
npm install --save --save-exact bash3boilerplate
|
||||
```
|
||||
|
||||
Even though this option introduces a Node.js dependency, it does allow for easy version pinning and distribution in environments that already have this prerequisite. This is, however, entirely optional and nothing prevents you from ignoring this possibility.
|
||||
|
||||
## Changelog
|
||||
|
||||
Please see the [CHANGELOG.md](./CHANGELOG.md) file.
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
Please see the [FAQ.md](./FAQ.md) file.
|
||||
|
||||
## Best practices
|
||||
|
||||
As of `v1.0.3`, b3bp offers some nice re-usable libraries in `./src`. In order to make the snippets in `./src` more useful, we recommend the following guidelines.
|
||||
|
||||
### Function packaging
|
||||
|
||||
It is nice to have a Bash package that can not only be used in the terminal, but also invoked as a command line function. In order to achieve this, the exporting of your functionality _should_ follow this pattern:
|
||||
|
||||
```bash
|
||||
if [[ "${BASH_SOURCE[0]}" = "${0}" ]]; then
|
||||
my_script "${@}"
|
||||
exit $?
|
||||
fi
|
||||
export -f my_script
|
||||
```
|
||||
|
||||
This allows a user to `source` your script or invoke it as a script.
|
||||
|
||||
```bash
|
||||
# Running as a script
|
||||
$ ./my_script.sh some args --blah
|
||||
# Sourcing the script
|
||||
$ source my_script.sh
|
||||
$ my_script some more args --blah
|
||||
```
|
||||
|
||||
(taken from the [bpkg](https://raw.githubusercontent.com/bpkg/bpkg/HEAD/README.md) project)
|
||||
|
||||
### Scoping
|
||||
|
||||
1. In functions, use `local` before every variable declaration.
|
||||
1. Use `UPPERCASE_VARS` to indicate environment variables that can be controlled outside your script.
|
||||
1. Use `__double_underscore_prefixed_vars` to indicate global variables that are solely controlled inside your script, with the exception of arguments that are already prefixed with `arg_`, as well as functions, over which b3bp poses no restrictions.
|
||||
|
||||
### Coding style
|
||||
|
||||
1. Use two spaces for tabs, do not use tab characters.
|
||||
1. Do not introduce whitespace at the end of lines or on blank lines as they obfuscate version control diffs.
|
||||
1. Use long options (`logger --priority` vs `logger -p`). If you are on the CLI, abbreviations make sense for efficiency. Nevertheless, when you are writing reusable scripts, a few extra keystrokes will pay off in readability and avoid ventures into man pages in the future, either by you or your collaborators. Similarly, we prefer `set -o nounset` over `set -u`.
|
||||
1. Use a single equal sign when checking `if [[ "${NAME}" = "Kevin" ]]`; double or triple signs are not needed.
|
||||
1. Use the new bash builtin test operator (`[[ ... ]]`) rather than the old single square bracket test operator or explicit call to `test`.
|
||||
|
||||
### Safety and Portability
|
||||
|
||||
1. Use `{}` to enclose your variables. Otherwise, Bash will try to access the `$ENVIRONMENT_app` variable in `/srv/$ENVIRONMENT_app`, whereas you probably intended `/srv/${ENVIRONMENT}_app`. Since it is easy to miss cases like this, we recommend that you make enclosing a habit.
|
||||
1. Use `set`, rather than relying on a shebang like `#!/usr/bin/env bash -e`, since that is neutralized when someone runs your script as `bash yourscript.sh`.
|
||||
1. Use `#!/usr/bin/env bash`, as it is more portable than `#!/bin/bash`.
|
||||
1. Use `${BASH_SOURCE[0]}` if you refer to current file, even if it is sourced by a parent script. In other cases, use `${0}`.
|
||||
1. Use `:-` if you want to test variables that could be undeclared. For instance, with `if [[ "${NAME:-}" = "Kevin" ]]`, `$NAME` will evaluate to `Kevin` if the variable is empty. The variable itself will remain unchanged. The syntax to assign a default value is `${NAME:=Kevin}`.
|
||||
|
||||
## Who uses b3bp?
|
||||
|
||||
- [Transloadit](https://transloadit.com)
|
||||
- [OpenCoarrays](https://www.opencoarrays.org)
|
||||
- [Sourcery Institute](https://www.sourceryinstitute.org)
|
||||
- [Computational Brain Anatomy Laboratory](https://cobralab.ca/)
|
||||
- [Genesis Cloud](https://genesiscloud.com/)
|
||||
|
||||
We are looking for endorsements! Are you also using b3bp? [Let us know](https://github.com/kvz/bash3boilerplate/issues/new?title=I%20use%20b3bp) and get listed.
|
||||
|
||||
## Authors
|
||||
|
||||
- [Kevin van Zonneveld](https://kvz.io)
|
||||
- [Izaak Beekman](https://izaakbeekman.com/)
|
||||
- [Manuel Streuhofer](https://github.com/mstreuhofer)
|
||||
- [Alexander Rathai](mailto:Alexander.Rathai@gmail.com)
|
||||
- [Dr. Damian Rouson](https://www.sourceryinstitute.org/) (documentation, feedback)
|
||||
- [@jokajak](https://github.com/jokajak) (documentation)
|
||||
- [Gabriel A. Devenyi](https://staticwave.ca/) (feedback)
|
||||
- [@bravo-kernel](https://github.com/bravo-kernel) (feedback)
|
||||
- [@skanga](https://github.com/skanga) (feedback)
|
||||
- [galaktos](https://www.reddit.com/user/galaktos) (feedback)
|
||||
- [@moviuro](https://github.com/moviuro) (feedback)
|
||||
- [Giovanni Saponaro](https://github.com/gsaponaro) (feedback)
|
||||
- [Germain Masse](https://github.com/gmasse)
|
||||
- [A. G. Madi](https://github.com/warpengineer)
|
||||
- [Lukas Stockner](mailto:oss@genesiscloud.com)
|
||||
- [Gert Goet](https://github.com/eval)
|
||||
- [@rfuehrer](https://github.com/rfuehrer)
|
||||
|
||||
## License
|
||||
|
||||
Copyright (c) 2013 Kevin van Zonneveld and [contributors](https://github.com/kvz/bash3boilerplate#authors).
|
||||
Licensed under [MIT](https://raw.githubusercontent.com/kvz/bash3boilerplate/HEAD/LICENSE).
|
||||
You are not obligated to bundle the LICENSE file with your b3bp projects as long
|
||||
as you leave these references intact in the header comments of your source files.
|
1
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/docs/CNAME
generated
vendored
1
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/docs/CNAME
generated
vendored
@@ -1 +0,0 @@
|
||||
bash3boilerplate.sh
|
15
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/docs/index.html
generated
vendored
15
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/docs/index.html
generated
vendored
@@ -1,15 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
http-equiv="refresh"
|
||||
content="0;url=https://github.com/kvz/bash3boilerplate"
|
||||
/>
|
||||
<title>Redirecting...</title>
|
||||
</head>
|
||||
<body>
|
||||
If you are not redirected,
|
||||
<a href="https://github.com/kvz/bash3boilerplate">click here</a>.
|
||||
</body>
|
||||
</html>
|
147
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/example.sh
generated
vendored
147
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/example.sh
generated
vendored
@@ -1,147 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# This file:
|
||||
#
|
||||
# - Demos BASH3 Boilerplate (change this for your script)
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# LOG_LEVEL=7 ./example.sh -f /tmp/x -d (change this for your script)
|
||||
#
|
||||
# Based on a template by BASH3 Boilerplate v2.3.0
|
||||
# http://bash3boilerplate.sh/#authors
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
# Copyright (c) 2013 Kevin van Zonneveld and contributors
|
||||
# You are not obligated to bundle the LICENSE file with your b3bp projects as long
|
||||
# as you leave these references intact in the header comments of your source files.
|
||||
|
||||
|
||||
### BASH3 Boilerplate (b3bp) Header
|
||||
##############################################################################
|
||||
|
||||
# Commandline options. This defines the usage page, and is used to parse cli
|
||||
# opts & defaults from. The parsing is unforgiving so be precise in your syntax
|
||||
# - A short option must be preset for every long option; but every short option
|
||||
# need not have a long option
|
||||
# - `--` is respected as the separator between options and arguments
|
||||
# - We do not bash-expand defaults, so setting '~/app' as a default will not resolve to ${HOME}.
|
||||
# you can use bash variables to work around this (so use ${HOME} instead)
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
read -r -d '' __usage <<-'EOF' || true # exits non-zero when EOF encountered
|
||||
-f --file [arg] Filename to process. Required.
|
||||
-t --temp [arg] Location of tempfile. Default="/tmp/bar"
|
||||
-v Enable verbose mode, print script as it is executed
|
||||
-d --debug Enables debug mode
|
||||
-h --help This page
|
||||
-n --no-color Disable color output
|
||||
-1 --one Do just one thing
|
||||
-i --input [arg] File to process. Can be repeated.
|
||||
-x Specify a flag. Can be repeated.
|
||||
EOF
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
read -r -d '' __helptext <<-'EOF' || true # exits non-zero when EOF encountered
|
||||
This is Bash3 Boilerplate's help text. Feel free to add any description of your
|
||||
program or elaborate more on command-line arguments. This section is not
|
||||
parsed and will be added as-is to the help.
|
||||
EOF
|
||||
|
||||
# shellcheck source=main.sh
|
||||
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/main.sh"
|
||||
|
||||
|
||||
### Signal trapping and backtracing
|
||||
##############################################################################
|
||||
|
||||
function __b3bp_cleanup_before_exit () {
|
||||
info "Cleaning up. Done"
|
||||
}
|
||||
trap __b3bp_cleanup_before_exit EXIT
|
||||
|
||||
# requires `set -o errtrace`
|
||||
__b3bp_err_report() {
|
||||
local error_code=${?}
|
||||
# shellcheck disable=SC2154
|
||||
error "Error in ${__file} in function ${1} on line ${2}"
|
||||
exit ${error_code}
|
||||
}
|
||||
# Uncomment the following line for always providing an error backtrace
|
||||
# trap '__b3bp_err_report "${FUNCNAME:-.}" ${LINENO}' ERR
|
||||
|
||||
|
||||
### Command-line argument switches (like -d for debugmode, -h for showing helppage)
|
||||
##############################################################################
|
||||
|
||||
# debug mode
|
||||
if [[ "${arg_d:?}" = "1" ]]; then
|
||||
set -o xtrace
|
||||
PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
|
||||
LOG_LEVEL="7"
|
||||
# Enable error backtracing
|
||||
trap '__b3bp_err_report "${FUNCNAME:-.}" ${LINENO}' ERR
|
||||
fi
|
||||
|
||||
# verbose mode
|
||||
if [[ "${arg_v:?}" = "1" ]]; then
|
||||
set -o verbose
|
||||
fi
|
||||
|
||||
# no color mode
|
||||
if [[ "${arg_n:?}" = "1" ]]; then
|
||||
NO_COLOR="true"
|
||||
fi
|
||||
|
||||
# help mode
|
||||
if [[ "${arg_h:?}" = "1" ]]; then
|
||||
# Help exists with code 1
|
||||
help "Help using ${0}"
|
||||
fi
|
||||
|
||||
|
||||
### Validation. Error out if the things required for your script are not present
|
||||
##############################################################################
|
||||
|
||||
[[ "${arg_f:-}" ]] || help "Setting a filename with -f or --file is required"
|
||||
[[ "${LOG_LEVEL:-}" ]] || emergency "Cannot continue without LOG_LEVEL. "
|
||||
|
||||
|
||||
### Runtime
|
||||
##############################################################################
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
info "__i_am_main_script: ${__i_am_main_script}"
|
||||
# shellcheck disable=SC2154
|
||||
info "__file: ${__file}"
|
||||
# shellcheck disable=SC2154
|
||||
info "__dir: ${__dir}"
|
||||
# shellcheck disable=SC2154
|
||||
info "__base: ${__base}"
|
||||
info "OSTYPE: ${OSTYPE}"
|
||||
|
||||
info "arg_f: ${arg_f}"
|
||||
info "arg_d: ${arg_d}"
|
||||
info "arg_v: ${arg_v}"
|
||||
info "arg_h: ${arg_h}"
|
||||
if [[ -n "${arg_i:-}" ]]; then
|
||||
info "arg_i: ${#arg_i[@]}"
|
||||
for input_file in "${arg_i[@]}"; do
|
||||
info " - ${input_file}"
|
||||
done
|
||||
else
|
||||
info "arg_i: 0"
|
||||
fi
|
||||
# shellcheck disable=SC2015
|
||||
[[ -n "${arg_x:-}" ]] && info "arg_x: ${#arg_x[@]}" || info "arg_x: 0"
|
||||
|
||||
info "$(echo -e "multiple lines example - line #1\\nmultiple lines example - line #2\\nimagine logging the output of 'ls -al /path/'")"
|
||||
|
||||
# All of these go to STDERR, so you can use STDOUT for piping machine readable information to other software
|
||||
debug "Info useful to developers for debugging the application, not useful during operations."
|
||||
info "Normal operational messages - may be harvested for reporting, measuring throughput, etc. - no action required."
|
||||
notice "Events that are unusual but not error conditions - might be summarized in an email to developers or admins to spot potential problems - no immediate action required."
|
||||
warning "Warning messages, not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full - each item must be resolved within a given time."
|
||||
error "Non-urgent failures, these should be relayed to developers or admins; each item must be resolved within a given time."
|
||||
critical "Should be corrected immediately, but indicates failure in a primary system, an example is a loss of a backup ISP connection."
|
||||
alert "Should be corrected immediately, therefore notify staff who can fix the problem. An example would be the loss of a primary ISP connection."
|
||||
emergency "A \"panic\" condition usually affecting multiple apps/servers/sites. At this level it would usually notify all tech staff on call."
|
453
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/main.sh
generated
vendored
453
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/main.sh
generated
vendored
@@ -1,453 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# This file:
|
||||
#
|
||||
# - Demos BASH3 Boilerplate (change this for your script)
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# LOG_LEVEL=7 ./main.sh -f /tmp/x -d (change this for your script)
|
||||
#
|
||||
# Based on a template by BASH3 Boilerplate vv2.7.2
|
||||
# http://bash3boilerplate.sh/#authors
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
# Copyright (c) 2013 Kevin van Zonneveld and contributors
|
||||
# You are not obligated to bundle the LICENSE file with your b3bp projects as long
|
||||
# as you leave these references intact in the header comments of your source files.
|
||||
|
||||
# Exit on error. Append "|| true" if you expect an error.
|
||||
set -o errexit
|
||||
# Exit on error inside any functions or subshells.
|
||||
set -o errtrace
|
||||
# Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR
|
||||
set -o nounset
|
||||
# Catch the error in case mysqldump fails (but gzip succeeds) in `mysqldump |gzip`
|
||||
set -o pipefail
|
||||
# Turn on traces, useful while debugging but commented out by default
|
||||
# set -o xtrace
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
|
||||
__i_am_main_script="0" # false
|
||||
|
||||
if [[ "${__usage+x}" ]]; then
|
||||
if [[ "${BASH_SOURCE[1]}" = "${0}" ]]; then
|
||||
__i_am_main_script="1" # true
|
||||
fi
|
||||
|
||||
__b3bp_external_usage="true"
|
||||
__b3bp_tmp_source_idx=1
|
||||
fi
|
||||
else
|
||||
__i_am_main_script="1" # true
|
||||
[[ "${__usage+x}" ]] && unset -v __usage
|
||||
[[ "${__helptext+x}" ]] && unset -v __helptext
|
||||
fi
|
||||
|
||||
# Set magic variables for current file, directory, os, etc.
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[${__b3bp_tmp_source_idx:-0}]}")" && pwd)"
|
||||
__file="${__dir}/$(basename "${BASH_SOURCE[${__b3bp_tmp_source_idx:-0}]}")"
|
||||
__base="$(basename "${__file}" .sh)"
|
||||
# shellcheck disable=SC2034,SC2015
|
||||
__invocation="$(printf %q "${__file}")$( (($#)) && printf ' %q' "$@" || true)"
|
||||
|
||||
# Define the environment variables (and their defaults) that this script depends on
|
||||
LOG_LEVEL="${LOG_LEVEL:-6}" # 7 = debug -> 0 = emergency
|
||||
NO_COLOR="${NO_COLOR:-}" # true = disable color. otherwise autodetected
|
||||
|
||||
|
||||
### Functions
|
||||
##############################################################################
|
||||
|
||||
function __b3bp_log () {
|
||||
local log_level="${1}"
|
||||
shift
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
local color_debug="\\x1b[35m"
|
||||
# shellcheck disable=SC2034
|
||||
local color_info="\\x1b[32m"
|
||||
# shellcheck disable=SC2034
|
||||
local color_notice="\\x1b[34m"
|
||||
# shellcheck disable=SC2034
|
||||
local color_warning="\\x1b[33m"
|
||||
# shellcheck disable=SC2034
|
||||
local color_error="\\x1b[31m"
|
||||
# shellcheck disable=SC2034
|
||||
local color_critical="\\x1b[1;31m"
|
||||
# shellcheck disable=SC2034
|
||||
local color_alert="\\x1b[1;37;41m"
|
||||
# shellcheck disable=SC2034
|
||||
local color_emergency="\\x1b[1;4;5;37;41m"
|
||||
|
||||
local colorvar="color_${log_level}"
|
||||
|
||||
local color="${!colorvar:-${color_error}}"
|
||||
local color_reset="\\x1b[0m"
|
||||
|
||||
if [[ "${NO_COLOR:-}" = "true" ]] || { [[ "${TERM:-}" != "xterm"* ]] && [[ "${TERM:-}" != "screen"* ]]; } || [[ ! -t 2 ]]; then
|
||||
if [[ "${NO_COLOR:-}" != "false" ]]; then
|
||||
# Don't use colors on pipes or non-recognized terminals
|
||||
color=""; color_reset=""
|
||||
fi
|
||||
fi
|
||||
|
||||
# all remaining arguments are to be printed
|
||||
local log_line=""
|
||||
|
||||
while IFS=$'\n' read -r log_line; do
|
||||
echo -e "$(date -u +"%Y-%m-%d %H:%M:%S UTC") ${color}$(printf "[%9s]" "${log_level}")${color_reset} ${log_line}" 1>&2
|
||||
done <<< "${@:-}"
|
||||
}
|
||||
|
||||
function emergency () { __b3bp_log emergency "${@}"; exit 1; }
|
||||
function alert () { [[ "${LOG_LEVEL:-0}" -ge 1 ]] && __b3bp_log alert "${@}"; true; }
|
||||
function critical () { [[ "${LOG_LEVEL:-0}" -ge 2 ]] && __b3bp_log critical "${@}"; true; }
|
||||
function error () { [[ "${LOG_LEVEL:-0}" -ge 3 ]] && __b3bp_log error "${@}"; true; }
|
||||
function warning () { [[ "${LOG_LEVEL:-0}" -ge 4 ]] && __b3bp_log warning "${@}"; true; }
|
||||
function notice () { [[ "${LOG_LEVEL:-0}" -ge 5 ]] && __b3bp_log notice "${@}"; true; }
|
||||
function info () { [[ "${LOG_LEVEL:-0}" -ge 6 ]] && __b3bp_log info "${@}"; true; }
|
||||
function debug () { [[ "${LOG_LEVEL:-0}" -ge 7 ]] && __b3bp_log debug "${@}"; true; }
|
||||
|
||||
function help () {
|
||||
echo "" 1>&2
|
||||
echo " ${*}" 1>&2
|
||||
echo "" 1>&2
|
||||
echo " ${__usage:-No usage available}" 1>&2
|
||||
echo "" 1>&2
|
||||
|
||||
if [[ "${__helptext:-}" ]]; then
|
||||
echo " ${__helptext}" 1>&2
|
||||
echo "" 1>&2
|
||||
fi
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
### Parse commandline options
|
||||
##############################################################################
|
||||
|
||||
# Commandline options. This defines the usage page, and is used to parse cli
|
||||
# opts & defaults from. The parsing is unforgiving so be precise in your syntax
|
||||
# - A short option must be preset for every long option; but every short option
|
||||
# need not have a long option
|
||||
# - `--` is respected as the separator between options and arguments
|
||||
# - We do not bash-expand defaults, so setting '~/app' as a default will not resolve to ${HOME}.
|
||||
# you can use bash variables to work around this (so use ${HOME} instead)
|
||||
|
||||
# shellcheck disable=SC2015
|
||||
[[ "${__usage+x}" ]] || read -r -d '' __usage <<-'EOF' || true # exits non-zero when EOF encountered
|
||||
-f --file [arg] Filename to process. Required.
|
||||
-t --temp [arg] Location of tempfile. Default="/tmp/bar"
|
||||
-v Enable verbose mode, print script as it is executed
|
||||
-d --debug Enables debug mode
|
||||
-h --help This page
|
||||
-n --no-color Disable color output
|
||||
-1 --one Do just one thing
|
||||
-i --input [arg] File to process. Can be repeated.
|
||||
-x Specify a flag. Can be repeated.
|
||||
EOF
|
||||
|
||||
# shellcheck disable=SC2015
|
||||
[[ "${__helptext+x}" ]] || read -r -d '' __helptext <<-'EOF' || true # exits non-zero when EOF encountered
|
||||
This is Bash3 Boilerplate's help text. Feel free to add any description of your
|
||||
program or elaborate more on command-line arguments. This section is not
|
||||
parsed and will be added as-is to the help.
|
||||
EOF
|
||||
|
||||
# Translate usage string -> getopts arguments, and set $arg_<flag> defaults
|
||||
while read -r __b3bp_tmp_line; do
|
||||
if [[ "${__b3bp_tmp_line}" =~ ^- ]]; then
|
||||
# fetch single character version of option string
|
||||
__b3bp_tmp_opt="${__b3bp_tmp_line%% *}"
|
||||
__b3bp_tmp_opt="${__b3bp_tmp_opt:1}"
|
||||
|
||||
# fetch long version if present
|
||||
__b3bp_tmp_long_opt=""
|
||||
|
||||
if [[ "${__b3bp_tmp_line}" = *"--"* ]]; then
|
||||
__b3bp_tmp_long_opt="${__b3bp_tmp_line#*--}"
|
||||
__b3bp_tmp_long_opt="${__b3bp_tmp_long_opt%% *}"
|
||||
fi
|
||||
|
||||
# map opt long name to+from opt short name
|
||||
printf -v "__b3bp_tmp_opt_long2short_${__b3bp_tmp_long_opt//-/_}" '%s' "${__b3bp_tmp_opt}"
|
||||
printf -v "__b3bp_tmp_opt_short2long_${__b3bp_tmp_opt}" '%s' "${__b3bp_tmp_long_opt//-/_}"
|
||||
|
||||
# check if option takes an argument
|
||||
if [[ "${__b3bp_tmp_line}" =~ \[.*\] ]]; then
|
||||
__b3bp_tmp_opt="${__b3bp_tmp_opt}:" # add : if opt has arg
|
||||
__b3bp_tmp_init="" # it has an arg. init with ""
|
||||
printf -v "__b3bp_tmp_has_arg_${__b3bp_tmp_opt:0:1}" '%s' "1"
|
||||
elif [[ "${__b3bp_tmp_line}" =~ \{.*\} ]]; then
|
||||
__b3bp_tmp_opt="${__b3bp_tmp_opt}:" # add : if opt has arg
|
||||
__b3bp_tmp_init="" # it has an arg. init with ""
|
||||
# remember that this option requires an argument
|
||||
printf -v "__b3bp_tmp_has_arg_${__b3bp_tmp_opt:0:1}" '%s' "2"
|
||||
else
|
||||
__b3bp_tmp_init="0" # it's a flag. init with 0
|
||||
printf -v "__b3bp_tmp_has_arg_${__b3bp_tmp_opt:0:1}" '%s' "0"
|
||||
fi
|
||||
__b3bp_tmp_opts="${__b3bp_tmp_opts:-}${__b3bp_tmp_opt}"
|
||||
|
||||
if [[ "${__b3bp_tmp_line}" =~ ^Can\ be\ repeated\. ]] || [[ "${__b3bp_tmp_line}" =~ \.\ *Can\ be\ repeated\. ]]; then
|
||||
# remember that this option can be repeated
|
||||
printf -v "__b3bp_tmp_is_array_${__b3bp_tmp_opt:0:1}" '%s' "1"
|
||||
else
|
||||
printf -v "__b3bp_tmp_is_array_${__b3bp_tmp_opt:0:1}" '%s' "0"
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ "${__b3bp_tmp_opt:-}" ]] || continue
|
||||
|
||||
if [[ "${__b3bp_tmp_line}" =~ ^Default= ]] || [[ "${__b3bp_tmp_line}" =~ \.\ *Default= ]]; then
|
||||
# ignore default value if option does not have an argument
|
||||
__b3bp_tmp_varname="__b3bp_tmp_has_arg_${__b3bp_tmp_opt:0:1}"
|
||||
if [[ "${!__b3bp_tmp_varname}" != "0" ]]; then
|
||||
# take default
|
||||
__b3bp_tmp_init="${__b3bp_tmp_line##*Default=}"
|
||||
# strip double quotes from default argument
|
||||
__b3bp_tmp_re='^"(.*)"$'
|
||||
if [[ "${__b3bp_tmp_init}" =~ ${__b3bp_tmp_re} ]]; then
|
||||
__b3bp_tmp_init="${BASH_REMATCH[1]}"
|
||||
else
|
||||
# strip single quotes from default argument
|
||||
__b3bp_tmp_re="^'(.*)'$"
|
||||
if [[ "${__b3bp_tmp_init}" =~ ${__b3bp_tmp_re} ]]; then
|
||||
__b3bp_tmp_init="${BASH_REMATCH[1]}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "${__b3bp_tmp_line}" =~ ^Required\. ]] || [[ "${__b3bp_tmp_line}" =~ \.\ *Required\. ]]; then
|
||||
# remember that this option requires an argument
|
||||
printf -v "__b3bp_tmp_has_arg_${__b3bp_tmp_opt:0:1}" '%s' "2"
|
||||
fi
|
||||
|
||||
# Init var with value unless it is an array / a repeatable
|
||||
__b3bp_tmp_varname="__b3bp_tmp_is_array_${__b3bp_tmp_opt:0:1}"
|
||||
[[ "${!__b3bp_tmp_varname}" = "0" ]] && printf -v "arg_${__b3bp_tmp_opt:0:1}" '%s' "${__b3bp_tmp_init}"
|
||||
done <<< "${__usage:-}"
|
||||
|
||||
# run getopts only if options were specified in __usage
|
||||
if [[ "${__b3bp_tmp_opts:-}" ]]; then
|
||||
# Allow long options like --this
|
||||
__b3bp_tmp_opts="${__b3bp_tmp_opts}-:"
|
||||
|
||||
# Reset in case getopts has been used previously in the shell.
|
||||
OPTIND=1
|
||||
|
||||
# start parsing command line
|
||||
set +o nounset # unexpected arguments will cause unbound variables
|
||||
# to be dereferenced
|
||||
# Overwrite $arg_<flag> defaults with the actual CLI options
|
||||
while getopts "${__b3bp_tmp_opts}" __b3bp_tmp_opt; do
|
||||
[[ "${__b3bp_tmp_opt}" = "?" ]] && help "Invalid use of script: ${*} "
|
||||
|
||||
if [[ "${__b3bp_tmp_opt}" = "-" ]]; then
|
||||
# OPTARG is long-option-name or long-option=value
|
||||
if [[ "${OPTARG}" =~ .*=.* ]]; then
|
||||
# --key=value format
|
||||
__b3bp_tmp_long_opt=${OPTARG/=*/}
|
||||
# Set opt to the short option corresponding to the long option
|
||||
__b3bp_tmp_varname="__b3bp_tmp_opt_long2short_${__b3bp_tmp_long_opt//-/_}"
|
||||
printf -v "__b3bp_tmp_opt" '%s' "${!__b3bp_tmp_varname}"
|
||||
OPTARG=${OPTARG#*=}
|
||||
else
|
||||
# --key value format
|
||||
# Map long name to short version of option
|
||||
__b3bp_tmp_varname="__b3bp_tmp_opt_long2short_${OPTARG//-/_}"
|
||||
printf -v "__b3bp_tmp_opt" '%s' "${!__b3bp_tmp_varname}"
|
||||
# Only assign OPTARG if option takes an argument
|
||||
__b3bp_tmp_varname="__b3bp_tmp_has_arg_${__b3bp_tmp_opt}"
|
||||
__b3bp_tmp_varvalue="${!__b3bp_tmp_varname}"
|
||||
[[ "${__b3bp_tmp_varvalue}" != "0" ]] && __b3bp_tmp_varvalue="1"
|
||||
printf -v "OPTARG" '%s' "${@:OPTIND:${__b3bp_tmp_varvalue}}"
|
||||
# shift over the argument if argument is expected
|
||||
((OPTIND+=__b3bp_tmp_varvalue))
|
||||
fi
|
||||
# we have set opt/OPTARG to the short value and the argument as OPTARG if it exists
|
||||
fi
|
||||
|
||||
__b3bp_tmp_value="${OPTARG}"
|
||||
|
||||
__b3bp_tmp_varname="__b3bp_tmp_is_array_${__b3bp_tmp_opt:0:1}"
|
||||
if [[ "${!__b3bp_tmp_varname}" != "0" ]]; then
|
||||
# repeatables
|
||||
# shellcheck disable=SC2016
|
||||
if [[ -z "${OPTARG}" ]]; then
|
||||
# repeatable flags, they increcemnt
|
||||
__b3bp_tmp_varname="arg_${__b3bp_tmp_opt:0:1}"
|
||||
debug "cli arg ${__b3bp_tmp_varname} = (${__b3bp_tmp_default}) -> ${!__b3bp_tmp_varname}"
|
||||
# shellcheck disable=SC2004
|
||||
__b3bp_tmp_value=$((${!__b3bp_tmp_varname} + 1))
|
||||
printf -v "${__b3bp_tmp_varname}" '%s' "${__b3bp_tmp_value}"
|
||||
else
|
||||
# repeatable args, they get appended to an array
|
||||
__b3bp_tmp_varname="arg_${__b3bp_tmp_opt:0:1}[@]"
|
||||
debug "cli arg ${__b3bp_tmp_varname} append ${__b3bp_tmp_value}"
|
||||
declare -a "${__b3bp_tmp_varname}"='("${!__b3bp_tmp_varname}" "${__b3bp_tmp_value}")'
|
||||
fi
|
||||
else
|
||||
# non-repeatables
|
||||
__b3bp_tmp_varname="arg_${__b3bp_tmp_opt:0:1}"
|
||||
__b3bp_tmp_default="${!__b3bp_tmp_varname}"
|
||||
|
||||
if [[ -z "${OPTARG}" ]]; then
|
||||
__b3bp_tmp_value=$((__b3bp_tmp_default + 1))
|
||||
fi
|
||||
|
||||
printf -v "${__b3bp_tmp_varname}" '%s' "${__b3bp_tmp_value}"
|
||||
|
||||
debug "cli arg ${__b3bp_tmp_varname} = (${__b3bp_tmp_default}) -> ${!__b3bp_tmp_varname}"
|
||||
fi
|
||||
done
|
||||
set -o nounset # no more unbound variable references expected
|
||||
|
||||
shift $((OPTIND-1))
|
||||
|
||||
if [[ "${1:-}" = "--" ]] ; then
|
||||
shift
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
### Automatic validation of required option arguments
|
||||
##############################################################################
|
||||
|
||||
for __b3bp_tmp_varname in ${!__b3bp_tmp_has_arg_*}; do
|
||||
# validate only options which required an argument
|
||||
[[ "${!__b3bp_tmp_varname}" = "2" ]] || continue
|
||||
|
||||
__b3bp_tmp_opt_short="${__b3bp_tmp_varname##*_}"
|
||||
__b3bp_tmp_varname="arg_${__b3bp_tmp_opt_short}"
|
||||
[[ "${!__b3bp_tmp_varname}" ]] && continue
|
||||
|
||||
__b3bp_tmp_varname="__b3bp_tmp_opt_short2long_${__b3bp_tmp_opt_short}"
|
||||
printf -v "__b3bp_tmp_opt_long" '%s' "${!__b3bp_tmp_varname}"
|
||||
[[ "${__b3bp_tmp_opt_long:-}" ]] && __b3bp_tmp_opt_long=" (--${__b3bp_tmp_opt_long//_/-})"
|
||||
|
||||
help "Option -${__b3bp_tmp_opt_short}${__b3bp_tmp_opt_long:-} requires an argument"
|
||||
done
|
||||
|
||||
|
||||
### Cleanup Environment variables
|
||||
##############################################################################
|
||||
|
||||
for __tmp_varname in ${!__b3bp_tmp_*}; do
|
||||
unset -v "${__tmp_varname}"
|
||||
done
|
||||
|
||||
unset -v __tmp_varname
|
||||
|
||||
|
||||
### Externally supplied __usage. Nothing else to do here
|
||||
##############################################################################
|
||||
|
||||
if [[ "${__b3bp_external_usage:-}" = "true" ]]; then
|
||||
unset -v __b3bp_external_usage
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
### Signal trapping and backtracing
|
||||
##############################################################################
|
||||
|
||||
function __b3bp_cleanup_before_exit () {
|
||||
info "Cleaning up. Done"
|
||||
}
|
||||
trap __b3bp_cleanup_before_exit EXIT
|
||||
|
||||
# requires `set -o errtrace`
|
||||
__b3bp_err_report() {
|
||||
local error_code=${?}
|
||||
error "Error in ${__file} in function ${1} on line ${2}"
|
||||
exit ${error_code}
|
||||
}
|
||||
# Uncomment the following line for always providing an error backtrace
|
||||
# trap '__b3bp_err_report "${FUNCNAME:-.}" ${LINENO}' ERR
|
||||
|
||||
|
||||
### Command-line argument switches (like -d for debugmode, -h for showing helppage)
|
||||
##############################################################################
|
||||
|
||||
# debug mode
|
||||
if [[ "${arg_d:?}" = "1" ]]; then
|
||||
set -o xtrace
|
||||
PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
|
||||
LOG_LEVEL="7"
|
||||
# Enable error backtracing
|
||||
trap '__b3bp_err_report "${FUNCNAME:-.}" ${LINENO}' ERR
|
||||
fi
|
||||
|
||||
# verbose mode
|
||||
if [[ "${arg_v:?}" = "1" ]]; then
|
||||
set -o verbose
|
||||
fi
|
||||
|
||||
# no color mode
|
||||
if [[ "${arg_n:?}" = "1" ]]; then
|
||||
NO_COLOR="true"
|
||||
fi
|
||||
|
||||
# help mode
|
||||
if [[ "${arg_h:?}" = "1" ]]; then
|
||||
# Help exists with code 1
|
||||
help "Help using ${0}"
|
||||
fi
|
||||
|
||||
|
||||
### Validation. Error out if the things required for your script are not present
|
||||
##############################################################################
|
||||
|
||||
[[ "${arg_f:-}" ]] || help "Setting a filename with -f or --file is required"
|
||||
[[ "${LOG_LEVEL:-}" ]] || emergency "Cannot continue without LOG_LEVEL. "
|
||||
|
||||
|
||||
### Runtime
|
||||
##############################################################################
|
||||
|
||||
info "__i_am_main_script: ${__i_am_main_script}"
|
||||
info "__file: ${__file}"
|
||||
info "__dir: ${__dir}"
|
||||
info "__base: ${__base}"
|
||||
info "OSTYPE: ${OSTYPE}"
|
||||
|
||||
info "arg_f: ${arg_f}"
|
||||
info "arg_d: ${arg_d}"
|
||||
info "arg_v: ${arg_v}"
|
||||
info "arg_h: ${arg_h}"
|
||||
|
||||
# shellcheck disable=SC2015
|
||||
if [[ -n "${arg_i:-}" ]] && declare -p arg_i 2> /dev/null | grep -q '^declare \-a'; then
|
||||
info "arg_i:"
|
||||
for input_file in "${arg_i[@]}"; do
|
||||
info " - ${input_file}"
|
||||
done
|
||||
elif [[ -n "${arg_i:-}" ]]; then
|
||||
info "arg_i: ${arg_i}"
|
||||
else
|
||||
info "arg_i: 0"
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2015
|
||||
if [[ -n "${arg_x:-}" ]] && declare -p arg_x 2> /dev/null | grep -q '^declare \-a'; then
|
||||
info "arg_x: ${#arg_x[@]}"
|
||||
elif [[ -n "${arg_x:-}" ]]; then
|
||||
info "arg_x: ${arg_x}"
|
||||
else
|
||||
info "arg_x: 0"
|
||||
fi
|
||||
|
||||
info "$(echo -e "multiple lines example - line #1\\nmultiple lines example - line #2\\nimagine logging the output of 'ls -al /path/'")"
|
||||
|
||||
# All of these go to STDERR, so you can use STDOUT for piping machine readable information to other software
|
||||
debug "Info useful to developers for debugging the application, not useful during operations."
|
||||
info "Normal operational messages - may be harvested for reporting, measuring throughput, etc. - no action required."
|
||||
notice "Events that are unusual but not error conditions - might be summarized in an email to developers or admins to spot potential problems - no immediate action required."
|
||||
warning "Warning messages, not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full - each item must be resolved within a given time."
|
||||
error "Non-urgent failures, these should be relayed to developers or admins; each item must be resolved within a given time."
|
||||
critical "Should be corrected immediately, but indicates failure in a primary system, an example is a loss of a backup ISP connection."
|
||||
alert "Should be corrected immediately, therefore notify staff who can fix the problem. An example would be the loss of a primary ISP connection."
|
||||
emergency "A \"panic\" condition usually affecting multiple apps/servers/sites. At this level it would usually notify all tech staff on call."
|
29
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/package.json
generated
vendored
29
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/package.json
generated
vendored
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"name": "bash3boilerplate",
|
||||
"description": "Copypastable templates to write better bash scripts",
|
||||
"version": "2.7.2",
|
||||
"packageManager": "yarn@3.6.0+sha224.19e47520fa56c6146388fdeb438d9dcf6630c3f277a2e1180995c3bb",
|
||||
"engines": {
|
||||
"node": ">= 18",
|
||||
"yarn": "3.6.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint:shellcheck": "shellcheck --severity=${SHELLCHECK_SEVERITY:-info} $(find . -name '*.sh' -maxdepth 2)",
|
||||
"lint:style": "test/style.pl $(find . -name '*.sh' -maxdepth 2)",
|
||||
"lint": "npm-run-all -l 'lint:**'",
|
||||
"release:major": "env SEMANTIC=major yarn release",
|
||||
"release:minor": "env SEMANTIC=minor yarn release",
|
||||
"release:patch": "env SEMANTIC=patch yarn release",
|
||||
"release": "npm version ${SEMANTIC:-patch} -m \"Release %s\" && yarn version:replace && git commit main.sh src/*.sh -m 'Update version' && git push && git push --tags -f && npm publish",
|
||||
"test:debug:main:repeated": "env LOG_LEVEL=7 test/acceptance.sh main-repeated",
|
||||
"test:update": "env SAVE_FIXTURES=true yarn test",
|
||||
"test": "test/acceptance.sh",
|
||||
"version:current": "node -e 'console.log(require(\"./package.json\").version)'",
|
||||
"version:replace": "replace 'v\\d+\\.\\d+\\.\\d+' \"v$(npm run --silent version:current)\" main.sh src/*.sh"
|
||||
},
|
||||
"devDependencies": {
|
||||
"fakefile": "1.1.0",
|
||||
"npm-run-all": "4.1.5",
|
||||
"replace": "1.2.2"
|
||||
}
|
||||
}
|
113
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/src/ini_val.sh
generated
vendored
113
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/src/ini_val.sh
generated
vendored
@@ -1,113 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# BASH3 Boilerplate: ini_val
|
||||
#
|
||||
# This file:
|
||||
#
|
||||
# - Can read and write .ini files using pure bash
|
||||
#
|
||||
# Limitations:
|
||||
#
|
||||
# - All keys inside a section of the .ini file must be unique
|
||||
# - Optional comment parameter for the creation of new entries
|
||||
#
|
||||
# Usage as a function:
|
||||
#
|
||||
# source ini_val.sh
|
||||
# ini_val data.ini connection.host 127.0.0.1 "Host name or IP address"
|
||||
#
|
||||
# Usage as a command:
|
||||
#
|
||||
# ini_val.sh data.ini connection.host 127.0.0.1 "Host name or IP address"
|
||||
#
|
||||
# Based on a template by BASH3 Boilerplate vv2.7.2
|
||||
# http://bash3boilerplate.sh/#authors
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
# Copyright (c) 2013 Kevin van Zonneveld and contributors
|
||||
# You are not obligated to bundle the LICENSE file with your b3bp projects as long
|
||||
# as you leave these references intact in the header comments of your source files.
|
||||
|
||||
function ini_val() {
|
||||
local file="${1:-}"
|
||||
local sectionkey="${2:-}"
|
||||
local val="${3:-}"
|
||||
local comment="${4:-}"
|
||||
local delim="="
|
||||
local comment_delim=";"
|
||||
local section=""
|
||||
local key=""
|
||||
local current=""
|
||||
# add default section
|
||||
local section_default="default"
|
||||
|
||||
if [[ ! -f "${file}" ]]; then
|
||||
# touch file if not exists
|
||||
touch "${file}"
|
||||
fi
|
||||
|
||||
# Split on . for section. However, section is optional
|
||||
IFS='.' read -r section key <<< "${sectionkey}"
|
||||
if [[ ! "${key}" ]]; then
|
||||
key="${section}"
|
||||
# default section if not given
|
||||
section="${section_default}"
|
||||
fi
|
||||
|
||||
# get current value (if exists)
|
||||
current=$(sed -En "/^\[/{h;d;};G;s/^${key}([[:blank:]]*)${delim}(.*)\n\[${section}\]$/\2/p" "${file}"|awk '{$1=$1};1')
|
||||
# get current comment (if exists)
|
||||
current_comment=$(sed -En "/^\[${section}\]/,/^\[.*\]/ s|^(${comment_delim}\[${key}\])(.*)|\2|p" "${file}"|awk '{$1=$1};1')
|
||||
|
||||
if ! grep -q "\[${section}\]" "${file}"; then
|
||||
# create section if not exists (empty line to seperate new section for better readability)
|
||||
echo >> "${file}"
|
||||
echo "[${section}]" >> "${file}"
|
||||
fi
|
||||
|
||||
if [[ ! "${val}" ]]; then
|
||||
# get a value
|
||||
echo "${current}"
|
||||
else
|
||||
# set a value
|
||||
if [[ ! "${section}" ]]; then
|
||||
# if no section is given, propagate the default section
|
||||
section=${section_default}
|
||||
fi
|
||||
|
||||
if [[ ! "${comment}" ]]; then
|
||||
# if no comment given, keep old comment
|
||||
comment="${current_comment}"
|
||||
fi
|
||||
# maintenance area
|
||||
# a) remove comment if new given / respect section
|
||||
sed -i.bak "/^\[${section}\]/,/^\[.*\]/ s|^\(${comment_delim}\[${key}\] \).*$||" "${file}"
|
||||
# b) remove old key / respect section
|
||||
sed -i.bak "/^\[${section}\]/,/^\[.*\]/ s|^\(${key}=\).*$||" "${file}"
|
||||
# c) remove all empty lines in ini file
|
||||
sed -i.bak '/^[[:space:]]*$/d' "${file}"
|
||||
# d) insert line break before every section for better readability
|
||||
sed -i.bak $'s/^\\[/\\\n\\[/g' "${file}"
|
||||
|
||||
# add to section
|
||||
if [[ ! "${comment}" ]]; then
|
||||
# add new key/value _without_ comment
|
||||
RET="/\\[${section}\\]/a\\
|
||||
${key}${delim}${val}"
|
||||
else
|
||||
# add new key/value _with_ preceeding comment
|
||||
RET="/\\[${section}\\]/a\\
|
||||
${comment_delim}[${key}] ${comment}\\
|
||||
${key}${delim}${val}"
|
||||
fi
|
||||
sed -i.bak -e "${RET}" "${file}"
|
||||
# this .bak dance is done for BSD/GNU portability: http://stackoverflow.com/a/22084103/151666
|
||||
rm -f "${file}.bak"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
|
||||
export -f ini_val
|
||||
else
|
||||
ini_val "${@}"
|
||||
exit ${?}
|
||||
fi
|
78
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/src/megamount.sh
generated
vendored
78
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/src/megamount.sh
generated
vendored
@@ -1,78 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# BASH3 Boilerplate: megamount
|
||||
#
|
||||
# This file:
|
||||
#
|
||||
# - Takes a URL (smb, nfs, afs) and tries to mount it at a given target directory
|
||||
# - Forcefully unmounts any active mount at the target directory first
|
||||
# - Displays the mount's contents for verification
|
||||
#
|
||||
# Depends on:
|
||||
#
|
||||
# - ./parse_url.sh
|
||||
#
|
||||
# Usage as a function:
|
||||
#
|
||||
# source megamount.sh
|
||||
# megamount smb://janedoe:abc123@192.168.0.1/documents /mnt/documents
|
||||
#
|
||||
# Usage as a command:
|
||||
#
|
||||
# megamount.sh smb://janedoe:abc123@192.168.0.1/documents /mnt/documents
|
||||
#
|
||||
# Based on a template by BASH3 Boilerplate vv2.7.2
|
||||
# http://bash3boilerplate.sh/#authors
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
# Copyright (c) 2013 Kevin van Zonneveld and contributors
|
||||
# You are not obligated to bundle the LICENSE file with your b3bp projects as long
|
||||
# as you leave these references intact in the header comments of your source files.
|
||||
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# shellcheck source=src/parse_url.sh
|
||||
source "${__dir}/parse_url.sh"
|
||||
|
||||
function megamount () {
|
||||
local url="${1}"
|
||||
local target="${2}"
|
||||
|
||||
local proto
|
||||
local user
|
||||
local pass
|
||||
local host
|
||||
local port
|
||||
local path
|
||||
|
||||
proto=$(parse_url "${url}" "proto")
|
||||
user=$(parse_url "${url}" "user")
|
||||
pass=$(parse_url "${url}" "pass")
|
||||
host=$(parse_url "${url}" "host")
|
||||
port=$(parse_url "${url}" "port")
|
||||
path=$(parse_url "${url}" "path")
|
||||
|
||||
(umount -lf "${target}" || umount -f "${target}") > /dev/null 2>&1 || true
|
||||
mkdir -p "${target}"
|
||||
if [[ "${proto}" = "smb://" ]]; then
|
||||
mount -t cifs --verbose -o "username=${user},password=${pass},hard" "//${host}/${path}" "${target}"
|
||||
elif [[ "${proto}" = "afp://" ]]; then
|
||||
# start syslog-ng
|
||||
# afpfsd || echo "Unable to run afpfsd. Does /dev/log exist?" && exit 1
|
||||
mount_afp "${url}" "${target}"
|
||||
elif [[ "${proto}" = "nfs://" ]]; then
|
||||
mount -t nfs --verbose -o "vers=3,nolock,soft,intr,rsize=32768,wsize=32768" "${host}:/${path}" "${target}"
|
||||
else
|
||||
echo "ERR: Unknown protocol: '${proto}'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# chmod 777 "${target}"
|
||||
ls -al "${target}/"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
|
||||
export -f megamount
|
||||
else
|
||||
megamount "${@}"
|
||||
exit ${?}
|
||||
fi
|
84
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/src/parse_url.sh
generated
vendored
84
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/src/parse_url.sh
generated
vendored
@@ -1,84 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# BASH3 Boilerplate: parse_url
|
||||
#
|
||||
# This file:
|
||||
#
|
||||
# - Takes a URL and parses protocol, user, pass, host, port, path.
|
||||
#
|
||||
# Based on:
|
||||
#
|
||||
# - http://stackoverflow.com/a/6174447/151666
|
||||
#
|
||||
# Usage as a function:
|
||||
#
|
||||
# source parse_url.sh
|
||||
# parse_url 'http://johndoe:abc123@example.com:8080/index.html' pass
|
||||
#
|
||||
# Usage as a command:
|
||||
#
|
||||
# parse_url.sh 'http://johndoe:abc123@example.com:8080/index.html'
|
||||
#
|
||||
# Based on a template by BASH3 Boilerplate vv2.7.2
|
||||
# http://bash3boilerplate.sh/#authors
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
# Copyright (c) 2013 Kevin van Zonneveld and contributors
|
||||
# You are not obligated to bundle the LICENSE file with your b3bp projects as long
|
||||
# as you leave these references intact in the header comments of your source files.
|
||||
|
||||
function parse_url() {
|
||||
local parse="${1}"
|
||||
local need="${2:-}"
|
||||
|
||||
local proto
|
||||
local url
|
||||
local userpass
|
||||
local user
|
||||
local pass
|
||||
local hostport
|
||||
local host
|
||||
local port
|
||||
local path
|
||||
|
||||
proto="$(echo "${parse}" | grep :// | sed -e's,^\(.*://\).*,\1,g')"
|
||||
url="${parse/${proto}/}"
|
||||
userpass="$(echo "${url}" | grep @ | cut -d@ -f1)"
|
||||
user="$(echo "${userpass}" | grep : | cut -d: -f1)"
|
||||
pass="$(echo "${userpass}" | grep : | cut -d: -f2)"
|
||||
hostport="$(echo "${url/${userpass}@/}" | cut -d/ -f1)"
|
||||
host="$(echo "${hostport}" | grep : | cut -d: -f1)"
|
||||
port="$(echo "${hostport}" | grep : | cut -d: -f2)"
|
||||
path="$(echo "${url}" | grep / | cut -d/ -f2-)"
|
||||
|
||||
[[ ! "${user}" ]] && user="${userpass}"
|
||||
[[ ! "${host}" ]] && host="${hostport}"
|
||||
if [[ ! "${port}" ]]; then
|
||||
[[ "${proto}" = "http://" ]] && port="80"
|
||||
[[ "${proto}" = "https://" ]] && port="443"
|
||||
[[ "${proto}" = "mysql://" ]] && port="3306"
|
||||
[[ "${proto}" = "redis://" ]] && port="6379"
|
||||
fi
|
||||
|
||||
if [[ "${need}" ]]; then
|
||||
echo "${!need}"
|
||||
else
|
||||
echo ""
|
||||
echo " Use second argument to return just 1 variable."
|
||||
echo " parse_url() demo: "
|
||||
echo ""
|
||||
echo " proto: ${proto}"
|
||||
echo " user: ${user}"
|
||||
echo " pass: ${pass}"
|
||||
echo " host: ${host}"
|
||||
echo " port: ${port}"
|
||||
echo " path: ${path}"
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
|
||||
export -f parse_url
|
||||
else
|
||||
parse_url "${@}"
|
||||
exit ${?}
|
||||
fi
|
68
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/src/templater.sh
generated
vendored
68
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/src/templater.sh
generated
vendored
@@ -1,68 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# BASH3 Boilerplate: templater
|
||||
#
|
||||
# This file:
|
||||
#
|
||||
# - takes a source (template) & destination (config) filepath argument
|
||||
# - then replaces placeholders with variables found in the environment
|
||||
#
|
||||
# Usage as a function:
|
||||
#
|
||||
# source templater.sh
|
||||
# export NAME=kevin
|
||||
# templater input.cfg output.cfg
|
||||
#
|
||||
# Usage as a command:
|
||||
#
|
||||
# ALLOW_REMAINDERS=1 templater.sh input.cfg output.cfg
|
||||
#
|
||||
# Based on a template by BASH3 Boilerplate vv2.7.2
|
||||
# http://bash3boilerplate.sh/#authors
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
# Copyright (c) 2013 Kevin van Zonneveld and contributors
|
||||
# You are not obligated to bundle the LICENSE file with your b3bp projects as long
|
||||
# as you leave these references intact in the header comments of your source files.
|
||||
|
||||
function templater() {
|
||||
ALLOW_REMAINDERS="${ALLOW_REMAINDERS:-0}"
|
||||
|
||||
templateSrc="${1:-}"
|
||||
templateDst="${2:-}"
|
||||
|
||||
if [[ ! -f "${templateSrc}" ]]; then
|
||||
echo "ERROR: Template source '${templateSrc}' needs to exist"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! "${templateDst}" ]]; then
|
||||
echo "ERROR: Template destination '${templateDst}' needs to be specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$(command -v perl)" ]]; then
|
||||
perl -p -e 's/\$\{(\w+)\}/(exists $ENV{$1} ? $ENV{$1} : "\${$1}")/eg' < "${templateSrc}" > "${templateDst}"
|
||||
else
|
||||
cp -f "${templateSrc}" "${templateDst}"
|
||||
|
||||
for var in $(env |awk -F= '{print $1}' |grep -E '^(_[A-Z0-9_]+|[A-Z0-9][A-Z0-9_]*)$'); do
|
||||
sed -i.bak -e "s#\${${var}}#${!var//#/\\#/}#g" "${templateDst}"
|
||||
# this .bak dance is done for BSD/GNU portability: http://stackoverflow.com/a/22084103/151666
|
||||
rm -f "${templateDst}.bak"
|
||||
done
|
||||
fi
|
||||
|
||||
# cat "${templateDst}"
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
if grep '${' "${templateDst}" && [[ "${ALLOW_REMAINDERS}" = "0" ]]; then
|
||||
echo "ERROR: Unable to replace the above template vars"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
|
||||
export -f templater
|
||||
else
|
||||
templater "${@}"
|
||||
exit ${?}
|
||||
fi
|
232
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/test/acceptance.sh
generated
vendored
232
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/test/acceptance.sh
generated
vendored
@@ -1,232 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# This file:
|
||||
#
|
||||
# - Executes one (or all) test scenarios
|
||||
# - Replaces dynamic things like hostnames, IPs, dates, etc
|
||||
# - Optionally saves the results as fixtures, that later runs will be compared against
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# ./deploy.sh
|
||||
#
|
||||
# Based on a template by BASH3 Boilerplate v2.0.0
|
||||
# http://bash3boilerplate.sh/#authors
|
||||
#
|
||||
# The MIT License (MIT)
|
||||
# Copyright (c) 2013 Kevin van Zonneveld and contributors
|
||||
# You are not obligated to bundle the LICENSE file with your b3bp projects as long
|
||||
# as you leave these references intact in the header comments of your source files.
|
||||
|
||||
# Exit on error. Append || true if you expect an error.
|
||||
set -o errexit
|
||||
# Exit on error inside any functions or subshells.
|
||||
set -o errtrace
|
||||
# Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR
|
||||
set -o nounset
|
||||
# Catch the error in case mysqldump fails (but gzip succeeds) in `mysqldump |gzip`
|
||||
set -o pipefail
|
||||
# Turn on traces, useful while debugging but commented out by default
|
||||
# set -o xtrace
|
||||
|
||||
# Set magic variables for current file, directory, os, etc.
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
|
||||
__base="$(basename "${__file}" .sh)"
|
||||
__root="$(cd "$(dirname "${__dir}")" && pwd)"
|
||||
|
||||
__sysTmpDir="${TMPDIR:-/tmp}"
|
||||
__sysTmpDir="${__sysTmpDir%/}" # <-- remove trailing slash on macosx
|
||||
__accptstTmpDir=$(mktemp -d "${__sysTmpDir}/${__base}.XXXXXX")
|
||||
|
||||
function cleanup_before_exit () { rm -r "${__accptstTmpDir:?}"; }
|
||||
trap cleanup_before_exit EXIT
|
||||
|
||||
cmdSed="sed"
|
||||
cmdTimeout="timeout"
|
||||
|
||||
if [[ "${OSTYPE}" = "darwin"* ]]; then
|
||||
cmdSed="gsed"
|
||||
cmdTimeout="gtimeout"
|
||||
fi
|
||||
|
||||
if [[ ! "$(command -v ${cmdSed})" ]]; then
|
||||
echo "Please install ${cmdSed}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! "$(command -v ${cmdTimeout})" ]]; then
|
||||
echo "Please install ${cmdTimeout}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
__node="$(command -v node)"
|
||||
__arch="amd64"
|
||||
|
||||
# explicitly setting NO_COLOR to false will make b3bp ignore TERM
|
||||
# not being "xterm*" or "screen*" and STDERR not being connected to a terminal
|
||||
# it's the opposite of NO_COLOR="true" - it forces color, no matter what
|
||||
export NO_COLOR="false"
|
||||
|
||||
# Running prepare before other scenarios is important on Travis,
|
||||
# so that stdio can diverge - and we can enforce stricter
|
||||
# stdio comparison on all other tests.
|
||||
while IFS=$'\n' read -r scenario; do
|
||||
scenario="$(dirname "${scenario}")"
|
||||
scenario="${scenario##${__dir}/scenario/}"
|
||||
|
||||
[[ "${scenario}" = "prepare" ]] && continue
|
||||
[[ "${1:-}" ]] && [[ "${scenario}" != "${1}" ]] && continue
|
||||
|
||||
echo "==> Scenario: ${scenario}"
|
||||
pushd "${__dir}/scenario/${scenario}" > /dev/null
|
||||
|
||||
# Run scenario
|
||||
(${cmdTimeout} --kill-after=6m 5m bash ./run.sh \
|
||||
> "${__accptstTmpDir}/${scenario}.stdio" 2>&1; \
|
||||
echo "${?}" > "${__accptstTmpDir}/${scenario}.exitcode" \
|
||||
) || true
|
||||
|
||||
# Clear out environmental specifics
|
||||
for typ in stdio exitcode; do
|
||||
curFile="${__accptstTmpDir}/${scenario}.${typ}"
|
||||
"${cmdSed}" -i \
|
||||
-e "s@${__node}@{node}@g" "${curFile}" \
|
||||
-e "s@${__root}@{root}@g" "${curFile}" \
|
||||
-e "s@${__sysTmpDir}@{tmpdir}@g" "${curFile}" \
|
||||
-e "s@/tmp@{tmpdir}@g" "${curFile}" \
|
||||
-e "s@${HOME:-/home/travis}@{home}@g" "${curFile}" \
|
||||
-e "s@${USER:-travis}@{user}@g" "${curFile}" \
|
||||
-e "s@travis@{user}@g" "${curFile}" \
|
||||
-e "s@kvz@{user}@g" "${curFile}" \
|
||||
-e "s@{root}/node_modules/\\.bin/node@{node}@g" "${curFile}" \
|
||||
-e "s@{home}/build/{user}/fre{node}@{node}@g" "${curFile}" \
|
||||
-e "s@${HOSTNAME}@{hostname}@g" "${curFile}" \
|
||||
-e "s@${__arch}@{arch}@g" "${curFile}" \
|
||||
-e "s@${OSTYPE}@{OSTYPE}@g" "${curFile}" \
|
||||
-e "s@OSX@{os}@g" "${curFile}" \
|
||||
-e "s@Linux@{os}@g" "${curFile}" \
|
||||
|| false
|
||||
|
||||
if grep -q 'ACCPTST:STDIO_REPLACE_IPS' "${curFile}"; then
|
||||
"${cmdSed}" -i \
|
||||
-r 's@[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}@{ip}@g' \
|
||||
"${curFile}"
|
||||
|
||||
# IPs vary in length. Ansible uses padding. {ip} does not vary in length
|
||||
# so kill the padding after it for consistent output
|
||||
"${cmdSed}" -i \
|
||||
-r 's@\{ip\}\s+@{ip} @g' \
|
||||
"${curFile}"
|
||||
fi
|
||||
if grep -q 'ACCPTST:STDIO_REPLACE_UUIDS' "${curFile}"; then
|
||||
"${cmdSed}" -i \
|
||||
-r 's@[0-9a-f\-]{32,40}@{uuid}@g' \
|
||||
"${curFile}"
|
||||
fi
|
||||
if grep -q 'ACCPTST:STDIO_REPLACE_BIGINTS' "${curFile}"; then
|
||||
# Such as: 3811298194
|
||||
"${cmdSed}" -i \
|
||||
-r 's@[0-9]{7,64}@{bigint}@g' \
|
||||
"${curFile}"
|
||||
fi
|
||||
if grep -q 'ACCPTST:STDIO_REPLACE_DATETIMES' "${curFile}"; then
|
||||
# Such as: 2016-02-10 15:38:44.420094
|
||||
"${cmdSed}" -i \
|
||||
-r 's@[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}@{datetime}@g' \
|
||||
"${curFile}"
|
||||
fi
|
||||
if grep -q 'ACCPTST:STDIO_REPLACE_LONGTIMES' "${curFile}"; then
|
||||
# Such as: 2016-02-10 15:38:44.420094
|
||||
"${cmdSed}" -i \
|
||||
-r 's@[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6}@{longtime}@g' \
|
||||
"${curFile}"
|
||||
fi
|
||||
if grep -q 'ACCPTST:STDIO_REPLACE_DURATIONS' "${curFile}"; then
|
||||
# Such as: 0:00:00.001991
|
||||
"${cmdSed}" -i \
|
||||
-r 's@[0-9]{1,2}:[0-9]{2}:[0-9]{2}.[0-9]{6}@{duration}@g' \
|
||||
"${curFile}"
|
||||
fi
|
||||
if grep -q 'ACCPTST:STDIO_REPLACE_REMOTE_EXEC' "${curFile}"; then
|
||||
grep -Ev 'remote-exec\): [ a-zA-Z]' "${curFile}" > "${__sysTmpDir}/accptst-filtered.txt"
|
||||
mv "${__sysTmpDir}/accptst-filtered.txt" "${curFile}"
|
||||
fi
|
||||
done
|
||||
|
||||
# Save these as new fixtures?
|
||||
if [[ "${SAVE_FIXTURES:-}" = "true" ]]; then
|
||||
for typ in stdio exitcode; do
|
||||
curFile="${__accptstTmpDir}/${scenario}.${typ}"
|
||||
cp -f \
|
||||
"${curFile}" \
|
||||
"${__dir}/fixture/${scenario}.${typ}"
|
||||
done
|
||||
fi
|
||||
|
||||
# Compare
|
||||
for typ in stdio exitcode; do
|
||||
curFile="${__accptstTmpDir}/${scenario}.${typ}"
|
||||
|
||||
echo -n " comparing ${typ}.. "
|
||||
|
||||
if [[ "${typ}" = "stdio" ]]; then
|
||||
if grep -q 'ACCPTST:STDIO_SKIP_COMPARE' "${curFile}"; then
|
||||
echo "skip"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! diff --strip-trailing-cr "${__dir}/fixture/${scenario}.${typ}" "${curFile}"; then
|
||||
echo -e "\\n\\n==> MISMATCH OF: ${scenario}.${typ} ---^"
|
||||
echo -e "\\n\\n==> EXPECTED STDIO: "
|
||||
cat "${__dir}/fixture/${scenario}.stdio" || true
|
||||
echo -e "\\n\\n==> ACTUAL STDIO: "
|
||||
cat "${__accptstTmpDir}/${scenario}.stdio" || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✓"
|
||||
done
|
||||
|
||||
popd > /dev/null
|
||||
done <<< "$(find "${__dir}/scenario" -type f -iname 'run.sh')"
|
||||
|
||||
[[ "${1:-}" ]] && exit 0
|
||||
|
||||
# Ensure correct syntax with all available bashes
|
||||
|
||||
# shellcheck disable=SC2230
|
||||
# "command -v" is not a substitute for "which -a"
|
||||
while IFS=$'\n' read -r bash; do
|
||||
if [[ "${bash:-}" = "" ]]; then
|
||||
continue
|
||||
fi
|
||||
# shellcheck disable=SC2016
|
||||
echo "==> ${bash} -n $(${bash} -c 'echo "(${BASH_VERSION})"')"
|
||||
pushd "${__root}" > /dev/null
|
||||
|
||||
failed="false"
|
||||
|
||||
while IFS=$'\n' read -r file; do
|
||||
[[ "${file}" =~ ^\./node_modules/ ]] && continue
|
||||
|
||||
echo -n " ${file}.. "
|
||||
|
||||
if ! "${bash}" -n "${file}" 2>> "${__accptstTmpDir}/${bash//\//.}.err"; then
|
||||
echo "✗"
|
||||
failed="true"
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "✓"
|
||||
done <<< "$(find . -type f -iname '*.sh')"
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
if [[ "${failed}" = "true" ]]; then
|
||||
cat "${__accptstTmpDir}/${bash//\//.}.err"
|
||||
exit 1
|
||||
fi
|
||||
done <<< "$(which -a bash 2>/dev/null)"
|
||||
|
||||
exit 0
|
0
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/test/fixture/.empty
generated
vendored
0
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/test/fixture/.empty
generated
vendored
@@ -1 +0,0 @@
|
||||
1
|
@@ -1,25 +0,0 @@
|
||||
ACCPTST:STDIO_REPLACE_DATETIMES
|
||||
{datetime} UTC [35m[ debug][0m cli arg arg_f = () -> {tmpdir}/x
|
||||
{datetime} UTC [32m[ info][0m __i_am_main_script: 0
|
||||
{datetime} UTC [32m[ info][0m __file: {root}/example.sh
|
||||
{datetime} UTC [32m[ info][0m __dir: {root}
|
||||
{datetime} UTC [32m[ info][0m __base: example
|
||||
{datetime} UTC [32m[ info][0m OSTYPE: {OSTYPE}
|
||||
{datetime} UTC [32m[ info][0m arg_f: {tmpdir}/x
|
||||
{datetime} UTC [32m[ info][0m arg_d: 0
|
||||
{datetime} UTC [32m[ info][0m arg_v: 0
|
||||
{datetime} UTC [32m[ info][0m arg_h: 0
|
||||
{datetime} UTC [32m[ info][0m arg_i: 0
|
||||
{datetime} UTC [32m[ info][0m arg_x: 0
|
||||
{datetime} UTC [32m[ info][0m multiple lines example - line #1
|
||||
{datetime} UTC [32m[ info][0m multiple lines example - line #2
|
||||
{datetime} UTC [32m[ info][0m imagine logging the output of 'ls -al /path/'
|
||||
{datetime} UTC [35m[ debug][0m Info useful to developers for debugging the application, not useful during operations.
|
||||
{datetime} UTC [32m[ info][0m Normal operational messages - may be harvested for reporting, measuring throughput, etc. - no action required.
|
||||
{datetime} UTC [34m[ notice][0m Events that are unusual but not error conditions - might be summarized in an email to developers or admins to spot potential problems - no immediate action required.
|
||||
{datetime} UTC [33m[ warning][0m Warning messages, not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full - each item must be resolved within a given time.
|
||||
{datetime} UTC [31m[ error][0m Non-urgent failures, these should be relayed to developers or admins; each item must be resolved within a given time.
|
||||
{datetime} UTC [1;31m[ critical][0m Should be corrected immediately, but indicates failure in a primary system, an example is a loss of a backup ISP connection.
|
||||
{datetime} UTC [1;37;41m[ alert][0m Should be corrected immediately, therefore notify staff who can fix the problem. An example would be the loss of a primary ISP connection.
|
||||
{datetime} UTC [1;4;5;37;41m[emergency][0m A "panic" condition usually affecting multiple apps/servers/sites. At this level it would usually notify all tech staff on call.
|
||||
{datetime} UTC [32m[ info][0m Cleaning up. Done
|
@@ -1 +0,0 @@
|
||||
0
|
@@ -1,42 +0,0 @@
|
||||
--> command: Read 3 values
|
||||
exists
|
||||
127.0.0.1
|
||||
nginx, nodejs
|
||||
|
||||
--> command: Replace three values in-place and show result
|
||||
|
||||
[default]
|
||||
orphan=no more
|
||||
|
||||
[connection]
|
||||
host=192.168.0.1
|
||||
|
||||
[software]
|
||||
packages=vim
|
||||
|
||||
[comment]
|
||||
;[command] got this new comment
|
||||
command=works like a chame
|
||||
;[new_command] last addition will be moved downwards again after next command
|
||||
new_command=commented too
|
||||
--> function: Read 3 values
|
||||
exists
|
||||
127.0.0.1
|
||||
nginx, nodejs
|
||||
|
||||
--> function: Replace three values in-place and show result
|
||||
|
||||
[default]
|
||||
orphan=no more
|
||||
|
||||
[connection]
|
||||
host=192.168.0.1
|
||||
|
||||
[software]
|
||||
packages=vim
|
||||
|
||||
[comment]
|
||||
;[command] got this new comment
|
||||
command=works like a chame
|
||||
;[new_command] last addition will be moved downwards again after next command
|
||||
new_command=commented too
|
@@ -1 +0,0 @@
|
||||
1
|
@@ -1,25 +0,0 @@
|
||||
ACCPTST:STDIO_REPLACE_DATETIMES
|
||||
{datetime} UTC [35m[ debug][0m cli arg arg_f = () -> {tmpdir}/x
|
||||
{datetime} UTC [32m[ info][0m __i_am_main_script: 1
|
||||
{datetime} UTC [32m[ info][0m __file: {root}/main.sh
|
||||
{datetime} UTC [32m[ info][0m __dir: {root}
|
||||
{datetime} UTC [32m[ info][0m __base: main
|
||||
{datetime} UTC [32m[ info][0m OSTYPE: {OSTYPE}
|
||||
{datetime} UTC [32m[ info][0m arg_f: {tmpdir}/x
|
||||
{datetime} UTC [32m[ info][0m arg_d: 0
|
||||
{datetime} UTC [32m[ info][0m arg_v: 0
|
||||
{datetime} UTC [32m[ info][0m arg_h: 0
|
||||
{datetime} UTC [32m[ info][0m arg_i: 0
|
||||
{datetime} UTC [32m[ info][0m arg_x: 0
|
||||
{datetime} UTC [32m[ info][0m multiple lines example - line #1
|
||||
{datetime} UTC [32m[ info][0m multiple lines example - line #2
|
||||
{datetime} UTC [32m[ info][0m imagine logging the output of 'ls -al /path/'
|
||||
{datetime} UTC [35m[ debug][0m Info useful to developers for debugging the application, not useful during operations.
|
||||
{datetime} UTC [32m[ info][0m Normal operational messages - may be harvested for reporting, measuring throughput, etc. - no action required.
|
||||
{datetime} UTC [34m[ notice][0m Events that are unusual but not error conditions - might be summarized in an email to developers or admins to spot potential problems - no immediate action required.
|
||||
{datetime} UTC [33m[ warning][0m Warning messages, not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full - each item must be resolved within a given time.
|
||||
{datetime} UTC [31m[ error][0m Non-urgent failures, these should be relayed to developers or admins; each item must be resolved within a given time.
|
||||
{datetime} UTC [1;31m[ critical][0m Should be corrected immediately, but indicates failure in a primary system, an example is a loss of a backup ISP connection.
|
||||
{datetime} UTC [1;37;41m[ alert][0m Should be corrected immediately, therefore notify staff who can fix the problem. An example would be the loss of a primary ISP connection.
|
||||
{datetime} UTC [1;4;5;37;41m[emergency][0m A "panic" condition usually affecting multiple apps/servers/sites. At this level it would usually notify all tech staff on call.
|
||||
{datetime} UTC [32m[ info][0m Cleaning up. Done
|
@@ -1 +0,0 @@
|
||||
1
|
@@ -1,19 +0,0 @@
|
||||
ACCPTST:STDIO_REPLACE_DATETIMES
|
||||
|
||||
Help using {root}/main.sh
|
||||
|
||||
-f --file [arg] Filename to process. Required.
|
||||
-t --temp [arg] Location of tempfile. Default="{tmpdir}/bar"
|
||||
-v Enable verbose mode, print script as it is executed
|
||||
-d --debug Enables debug mode
|
||||
-h --help This page
|
||||
-n --no-color Disable color output
|
||||
-1 --one Do just one thing
|
||||
-i --input [arg] File to process. Can be repeated.
|
||||
-x Specify a flag. Can be repeated.
|
||||
|
||||
This is Bash3 Boilerplate's help text. Feel free to add any description of your
|
||||
program or elaborate more on command-line arguments. This section is not
|
||||
parsed and will be added as-is to the help.
|
||||
|
||||
{datetime} UTC [32m[ info][0m Cleaning up. Done
|
@@ -1 +0,0 @@
|
||||
0
|
@@ -1,4 +0,0 @@
|
||||
ACCPTST:STDIO_REPLACE_DATETIMES
|
||||
{datetime} UTC [32m[ info][0m arg_f: {tmpdir}/x
|
||||
{datetime} UTC [32m[ info][0m arg_f: {tmpdir}/x
|
||||
{datetime} UTC [32m[ info][0m arg_f: {tmpdir}/x
|
@@ -1 +0,0 @@
|
||||
1
|
@@ -1,25 +0,0 @@
|
||||
ACCPTST:STDIO_REPLACE_DATETIMES
|
||||
{datetime} UTC [ debug] cli arg arg_f = () -> {tmpdir}/x
|
||||
{datetime} UTC [ info] __i_am_main_script: 1
|
||||
{datetime} UTC [ info] __file: {root}/main.sh
|
||||
{datetime} UTC [ info] __dir: {root}
|
||||
{datetime} UTC [ info] __base: main
|
||||
{datetime} UTC [ info] OSTYPE: {OSTYPE}
|
||||
{datetime} UTC [ info] arg_f: {tmpdir}/x
|
||||
{datetime} UTC [ info] arg_d: 0
|
||||
{datetime} UTC [ info] arg_v: 0
|
||||
{datetime} UTC [ info] arg_h: 0
|
||||
{datetime} UTC [ info] arg_i: 0
|
||||
{datetime} UTC [ info] arg_x: 0
|
||||
{datetime} UTC [ info] multiple lines example - line #1
|
||||
{datetime} UTC [ info] multiple lines example - line #2
|
||||
{datetime} UTC [ info] imagine logging the output of 'ls -al /path/'
|
||||
{datetime} UTC [ debug] Info useful to developers for debugging the application, not useful during operations.
|
||||
{datetime} UTC [ info] Normal operational messages - may be harvested for reporting, measuring throughput, etc. - no action required.
|
||||
{datetime} UTC [ notice] Events that are unusual but not error conditions - might be summarized in an email to developers or admins to spot potential problems - no immediate action required.
|
||||
{datetime} UTC [ warning] Warning messages, not an error, but indication that an error will occur if action is not taken, e.g. file system 85% full - each item must be resolved within a given time.
|
||||
{datetime} UTC [ error] Non-urgent failures, these should be relayed to developers or admins; each item must be resolved within a given time.
|
||||
{datetime} UTC [ critical] Should be corrected immediately, but indicates failure in a primary system, an example is a loss of a backup ISP connection.
|
||||
{datetime} UTC [ alert] Should be corrected immediately, therefore notify staff who can fix the problem. An example would be the loss of a primary ISP connection.
|
||||
{datetime} UTC [emergency] A "panic" condition usually affecting multiple apps/servers/sites. At this level it would usually notify all tech staff on call.
|
||||
{datetime} UTC [ info] Cleaning up. Done
|
@@ -1 +0,0 @@
|
||||
0
|
@@ -1,9 +0,0 @@
|
||||
ACCPTST:STDIO_REPLACE_DATETIMES
|
||||
{datetime} UTC [32m[ info][0m arg_i:
|
||||
{datetime} UTC [32m[ info][0m - simple_input
|
||||
{datetime} UTC [32m[ info][0m - input_in_quotes
|
||||
{datetime} UTC [32m[ info][0m - input with spaces
|
||||
{datetime} UTC [32m[ info][0m - input with "quotes"
|
||||
{datetime} UTC [32m[ info][0m - last_input
|
||||
{datetime} UTC [32m[ info][0m arg_x: 3
|
||||
{datetime} UTC [32m[ info][0m arg_x: 4
|
@@ -1 +0,0 @@
|
||||
0
|
@@ -1,7 +0,0 @@
|
||||
ACCPTST:STDIO_REPLACE_DATETIMES
|
||||
{datetime} UTC [32m[ info][0m arg_1: 0
|
||||
{datetime} UTC [32m[ info][0m arg_2: 0
|
||||
{datetime} UTC [32m[ info][0m arg_3: 'THREE'
|
||||
{datetime} UTC [32m[ info][0m arg_4: "FOUR"
|
||||
{datetime} UTC [32m[ info][0m arg_5: OOOPS
|
||||
{datetime} UTC [32m[ info][0m arg_6:
|
@@ -1 +0,0 @@
|
||||
0
|
@@ -1,169 +0,0 @@
|
||||
ACCPTST:STDIO_REPLACE_DATETIMES
|
||||
# complain about -3
|
||||
|
||||
Option -3 (--three) requires an argument
|
||||
|
||||
-0 --zero Do nothing.
|
||||
-1 --one Do one thing. Required.
|
||||
More description.
|
||||
-2 --two Do two things.
|
||||
More. Required. Description.
|
||||
-3 --three [arg] Do three things.
|
||||
Required.
|
||||
-4 --four {arg} Do four things.
|
||||
-5 --five {arg} Do five things. Required. Maybe.
|
||||
-6 --six [arg] Do six things. Not Required.
|
||||
Required, it is not.
|
||||
-7 --seven [arg] Required. Or bust.
|
||||
-8 --eight [arg] Do eight things.
|
||||
More.Required.Description.
|
||||
-a [arg] Do A. Required.
|
||||
Default="do-a"
|
||||
-b {arg} Do B.Default="do-b"
|
||||
-c [arg] Required. Default="do-c"
|
||||
-d {arg} Default="do-d"
|
||||
|
||||
This is Bash3 Boilerplate's help text. Feel free to add any description of your
|
||||
program or elaborate more on command-line arguments. This section is not
|
||||
parsed and will be added as-is to the help.
|
||||
|
||||
# complain about -4
|
||||
|
||||
Option -4 (--four) requires an argument
|
||||
|
||||
-0 --zero Do nothing.
|
||||
-1 --one Do one thing. Required.
|
||||
More description.
|
||||
-2 --two Do two things.
|
||||
More. Required. Description.
|
||||
-3 --three [arg] Do three things.
|
||||
Required.
|
||||
-4 --four {arg} Do four things.
|
||||
-5 --five {arg} Do five things. Required. Maybe.
|
||||
-6 --six [arg] Do six things. Not Required.
|
||||
Required, it is not.
|
||||
-7 --seven [arg] Required. Or bust.
|
||||
-8 --eight [arg] Do eight things.
|
||||
More.Required.Description.
|
||||
-a [arg] Do A. Required.
|
||||
Default="do-a"
|
||||
-b {arg} Do B.Default="do-b"
|
||||
-c [arg] Required. Default="do-c"
|
||||
-d {arg} Default="do-d"
|
||||
|
||||
This is Bash3 Boilerplate's help text. Feel free to add any description of your
|
||||
program or elaborate more on command-line arguments. This section is not
|
||||
parsed and will be added as-is to the help.
|
||||
|
||||
# complain about -5
|
||||
|
||||
Option -5 (--five) requires an argument
|
||||
|
||||
-0 --zero Do nothing.
|
||||
-1 --one Do one thing. Required.
|
||||
More description.
|
||||
-2 --two Do two things.
|
||||
More. Required. Description.
|
||||
-3 --three [arg] Do three things.
|
||||
Required.
|
||||
-4 --four {arg} Do four things.
|
||||
-5 --five {arg} Do five things. Required. Maybe.
|
||||
-6 --six [arg] Do six things. Not Required.
|
||||
Required, it is not.
|
||||
-7 --seven [arg] Required. Or bust.
|
||||
-8 --eight [arg] Do eight things.
|
||||
More.Required.Description.
|
||||
-a [arg] Do A. Required.
|
||||
Default="do-a"
|
||||
-b {arg} Do B.Default="do-b"
|
||||
-c [arg] Required. Default="do-c"
|
||||
-d {arg} Default="do-d"
|
||||
|
||||
This is Bash3 Boilerplate's help text. Feel free to add any description of your
|
||||
program or elaborate more on command-line arguments. This section is not
|
||||
parsed and will be added as-is to the help.
|
||||
|
||||
# complain about -8 (because -7 syntax is not supported)
|
||||
|
||||
Option -8 (--eight) requires an argument
|
||||
|
||||
-0 --zero Do nothing.
|
||||
-1 --one Do one thing. Required.
|
||||
More description.
|
||||
-2 --two Do two things.
|
||||
More. Required. Description.
|
||||
-3 --three [arg] Do three things.
|
||||
Required.
|
||||
-4 --four {arg} Do four things.
|
||||
-5 --five {arg} Do five things. Required. Maybe.
|
||||
-6 --six [arg] Do six things. Not Required.
|
||||
Required, it is not.
|
||||
-7 --seven [arg] Required. Or bust.
|
||||
-8 --eight [arg] Do eight things.
|
||||
More.Required.Description.
|
||||
-a [arg] Do A. Required.
|
||||
Default="do-a"
|
||||
-b {arg} Do B.Default="do-b"
|
||||
-c [arg] Required. Default="do-c"
|
||||
-d {arg} Default="do-d"
|
||||
|
||||
This is Bash3 Boilerplate's help text. Feel free to add any description of your
|
||||
program or elaborate more on command-line arguments. This section is not
|
||||
parsed and will be added as-is to the help.
|
||||
|
||||
# complain about -d (because -d syntax is not supported)
|
||||
|
||||
Option -d requires an argument
|
||||
|
||||
-0 --zero Do nothing.
|
||||
-1 --one Do one thing. Required.
|
||||
More description.
|
||||
-2 --two Do two things.
|
||||
More. Required. Description.
|
||||
-3 --three [arg] Do three things.
|
||||
Required.
|
||||
-4 --four {arg} Do four things.
|
||||
-5 --five {arg} Do five things. Required. Maybe.
|
||||
-6 --six [arg] Do six things. Not Required.
|
||||
Required, it is not.
|
||||
-7 --seven [arg] Required. Or bust.
|
||||
-8 --eight [arg] Do eight things.
|
||||
More.Required.Description.
|
||||
-a [arg] Do A. Required.
|
||||
Default="do-a"
|
||||
-b {arg} Do B.Default="do-b"
|
||||
-c [arg] Required. Default="do-c"
|
||||
-d {arg} Default="do-d"
|
||||
|
||||
This is Bash3 Boilerplate's help text. Feel free to add any description of your
|
||||
program or elaborate more on command-line arguments. This section is not
|
||||
parsed and will be added as-is to the help.
|
||||
|
||||
# complain about nothing
|
||||
{datetime} UTC [ info] arg_0: 0
|
||||
{datetime} UTC [ info] arg_1: 0
|
||||
{datetime} UTC [ info] arg_2: 0
|
||||
{datetime} UTC [ info] arg_3: arg3
|
||||
{datetime} UTC [ info] arg_4: arg4
|
||||
{datetime} UTC [ info] arg_5: arg5
|
||||
{datetime} UTC [ info] arg_6:
|
||||
{datetime} UTC [ info] arg_7:
|
||||
{datetime} UTC [ info] arg_8: arg8
|
||||
{datetime} UTC [ info] arg_a: do-a
|
||||
{datetime} UTC [ info] arg_b: do-b
|
||||
{datetime} UTC [ info] arg_c: do-c
|
||||
{datetime} UTC [ info] arg_d: argd
|
||||
# test for issue #108
|
||||
{datetime} UTC [ info] arg_0: 1
|
||||
{datetime} UTC [ info] arg_1: 0
|
||||
{datetime} UTC [ info] arg_2: 0
|
||||
{datetime} UTC [ info] arg_3: arg3
|
||||
{datetime} UTC [ info] arg_4: value
|
||||
{datetime} UTC [ info] arg_5: arg5
|
||||
{datetime} UTC [ info] arg_6:
|
||||
{datetime} UTC [ info] arg_7:
|
||||
{datetime} UTC [ info] arg_8: arg8
|
||||
{datetime} UTC [ info] arg_a: do-a
|
||||
{datetime} UTC [ info] arg_b: do-b
|
||||
{datetime} UTC [ info] arg_c: do-c
|
||||
{datetime} UTC [ info] arg_d: argd
|
@@ -1 +0,0 @@
|
||||
1
|
@@ -1,2 +0,0 @@
|
||||
ERR: Unknown protocol: 'foobarfs://'
|
||||
ERR: Unknown protocol: 'foobarfs://'
|
@@ -1 +0,0 @@
|
||||
0
|
@@ -1,24 +0,0 @@
|
||||
abc123
|
||||
|
||||
Use second argument to return just 1 variable.
|
||||
parse_url() demo:
|
||||
|
||||
proto: http://
|
||||
user: johndoe
|
||||
pass: abc123
|
||||
host: example.com
|
||||
port: 8080
|
||||
path: index.html
|
||||
|
||||
abc123
|
||||
|
||||
Use second argument to return just 1 variable.
|
||||
parse_url() demo:
|
||||
|
||||
proto: http://
|
||||
user: johndoe
|
||||
pass: abc123
|
||||
host: example.com
|
||||
port: 8080
|
||||
path: index.html
|
||||
|
@@ -1 +0,0 @@
|
||||
1
|
@@ -1,14 +0,0 @@
|
||||
--
|
||||
[connection]
|
||||
host = 127.0.0.1
|
||||
--
|
||||
[connection]
|
||||
host = 127.0.0.1
|
||||
--
|
||||
port = ${I_DONT_EXIST}
|
||||
[connection]
|
||||
host = 127.0.0.1
|
||||
port = ${I_DONT_EXIST}
|
||||
--
|
||||
port = ${I_DONT_EXIST}
|
||||
ERROR: Unable to replace the above template vars
|
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o pipefail
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set -o xtrace
|
||||
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__root="$(cd "$(dirname "$(dirname "$(dirname "${__dir}")")")" && pwd)"
|
||||
|
||||
export LOG_LEVEL=7
|
||||
|
||||
echo "ACCPTST:STDIO_REPLACE_DATETIMES"
|
||||
|
||||
# shellcheck source=example.sh
|
||||
source "${__root}/example.sh" -f /tmp/x
|
@@ -1,8 +0,0 @@
|
||||
[default]
|
||||
orphan=exists
|
||||
|
||||
[connection]
|
||||
host=127.0.0.1
|
||||
|
||||
[software]
|
||||
packages=nginx, nodejs
|
@@ -1,54 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o pipefail
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set -o xtrace
|
||||
|
||||
# Set magic variables for current FILE & DIR
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__root="$(cd "$(dirname "$(dirname "$(dirname "${__dir}")")")" && pwd)"
|
||||
|
||||
# echo "ACCPTST:STDIO_REPLACE_DATETIMES"
|
||||
|
||||
|
||||
# Use as standalone:
|
||||
cp -f data.ini dummy.ini
|
||||
echo "--> command: Read 3 values"
|
||||
bash "${__root}/src/ini_val.sh" ./dummy.ini orphan
|
||||
bash "${__root}/src/ini_val.sh" ./dummy.ini connection.host
|
||||
bash "${__root}/src/ini_val.sh" ./dummy.ini software.packages
|
||||
bash "${__root}/src/ini_val.sh" ./dummy.ini comment.command
|
||||
|
||||
echo "--> command: Replace three values in-place and show result"
|
||||
bash "${__root}/src/ini_val.sh" ./dummy.ini orphan "no more"
|
||||
bash "${__root}/src/ini_val.sh" ./dummy.ini connection.host "192.168.0.1"
|
||||
bash "${__root}/src/ini_val.sh" ./dummy.ini software.packages "vim"
|
||||
|
||||
bash "${__root}/src/ini_val.sh" ./dummy.ini comment.command "commented" "this key is commented"
|
||||
bash "${__root}/src/ini_val.sh" ./dummy.ini comment.new_command "commented too" "last addition will be moved downwards again after next command"
|
||||
bash "${__root}/src/ini_val.sh" ./dummy.ini comment.command "works like a chame" "got this new comment"
|
||||
cat dummy.ini
|
||||
rm -f dummy.ini
|
||||
|
||||
# Use as include:
|
||||
cp -f data.ini dummy.ini
|
||||
|
||||
# shellcheck source=main.sh
|
||||
source "${__root}/src/ini_val.sh"
|
||||
|
||||
echo "--> function: Read 3 values"
|
||||
ini_val ./dummy.ini orphan
|
||||
ini_val ./dummy.ini connection.host
|
||||
ini_val ./dummy.ini software.packages
|
||||
ini_val ./dummy.ini comment.command
|
||||
|
||||
echo "--> function: Replace three values in-place and show result"
|
||||
ini_val ./dummy.ini orphan "no more"
|
||||
ini_val ./dummy.ini connection.host "192.168.0.1"
|
||||
ini_val ./dummy.ini software.packages "vim"
|
||||
|
||||
ini_val ./dummy.ini comment.command "commented" "this key is commited"
|
||||
ini_val ./dummy.ini comment.new_command "commented too" "last addition will be moved downwards again after next command"
|
||||
ini_val ./dummy.ini comment.command "works like a chame" "got this new comment"
|
||||
cat dummy.ini
|
||||
rm -f dummy.ini
|
@@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o pipefail
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set -o xtrace
|
||||
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__root="$(cd "$(dirname "$(dirname "$(dirname "${__dir}")")")" && pwd)"
|
||||
|
||||
echo "ACCPTST:STDIO_REPLACE_DATETIMES"
|
||||
|
||||
env LOG_LEVEL=7 bash "${__root}/main.sh" -f /tmp/x
|
@@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o pipefail
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set -o xtrace
|
||||
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__root="$(cd "$(dirname "$(dirname "$(dirname "${__dir}")")")" && pwd)"
|
||||
|
||||
echo "ACCPTST:STDIO_REPLACE_DATETIMES"
|
||||
|
||||
bash "${__root}/main.sh" -f /tmp/x -h
|
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# set -o pipefail
|
||||
# set -o errexit
|
||||
set -o nounset
|
||||
# set -o xtrace
|
||||
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__root="$(cd "$(dirname "$(dirname "$(dirname "${__dir}")")")" && pwd)"
|
||||
|
||||
echo "ACCPTST:STDIO_REPLACE_DATETIMES"
|
||||
|
||||
(
|
||||
env LOG_LEVEL=6 bash "${__root}/main.sh" --file /tmp/x;
|
||||
env LOG_LEVEL=6 bash "${__root}/main.sh" --file=/tmp/x;
|
||||
env LOG_LEVEL=6 bash "${__root}/main.sh" -f /tmp/x
|
||||
) 2>&1 |grep arg_f
|
@@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o pipefail
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set -o xtrace
|
||||
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__root="$(cd "$(dirname "$(dirname "$(dirname "${__dir}")")")" && pwd)"
|
||||
|
||||
echo "ACCPTST:STDIO_REPLACE_DATETIMES"
|
||||
|
||||
env LOG_LEVEL=7 NO_COLOR=true bash "${__root}/main.sh" -f /tmp/x
|
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# set -o pipefail
|
||||
# set -o errexit
|
||||
set -o nounset
|
||||
# set -o xtrace
|
||||
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__root="$(cd "$(dirname "$(dirname "$(dirname "${__dir}")")")" && pwd)"
|
||||
|
||||
echo "ACCPTST:STDIO_REPLACE_DATETIMES"
|
||||
|
||||
(
|
||||
env LOG_LEVEL="${LOG_LEVEL:-6}" bash "${__root}/main.sh" -f dummy -i simple_input -i "input_in_quotes" -i "input with spaces" -i "input with \"quotes\"" -i last_input
|
||||
) 2>&1 |grep arg_i -A 5
|
||||
|
||||
(
|
||||
env LOG_LEVEL="${LOG_LEVEL:-6}" bash "${__root}/main.sh" -x -f dummy -x -x
|
||||
env LOG_LEVEL="${LOG_LEVEL:-6}" bash "${__root}/main.sh" -f dummy -xxxx
|
||||
) 2>&1 |grep arg_x
|
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o pipefail
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set -o xtrace
|
||||
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__root="$(cd "$(dirname "$(dirname "$(dirname "${__dir}")")")" && pwd)"
|
||||
|
||||
read -r -d '' __usage <<-'EOF' || true # exits non-zero when EOF encountered
|
||||
-1 --one Do one thing. Default="ONE"
|
||||
More description.
|
||||
-2 --two Do two things.
|
||||
More description. Default="TWO"
|
||||
-3 --three [arg] Do three things. Default="'THREE'"
|
||||
More description.
|
||||
-4 --four [arg] Do four things.
|
||||
More description. Default='"FOUR"'
|
||||
-5 --five [arg] Do five things. Default="FIVE"
|
||||
More description. Default='OOOPS'
|
||||
-6 --six [arg] Do six things.
|
||||
More description.
|
||||
EOF
|
||||
|
||||
export __usage
|
||||
|
||||
echo "ACCPTST:STDIO_REPLACE_DATETIMES"
|
||||
|
||||
# shellcheck source=main.sh
|
||||
source "${__root}/main.sh"
|
||||
|
||||
for argument in ${!arg_*}; do info "${argument}: ${!argument}"; done
|
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# shellcheck source=main.sh
|
||||
|
||||
set -o pipefail
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set -o xtrace
|
||||
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__root="$(cd "$(dirname "$(dirname "$(dirname "${__dir}")")")" && pwd)"
|
||||
|
||||
read -r -d '' __usage <<-'EOF' || true # exits non-zero when EOF encountered
|
||||
-0 --zero Do nothing.
|
||||
-1 --one Do one thing. Required.
|
||||
More description.
|
||||
-2 --two Do two things.
|
||||
More. Required. Description.
|
||||
-3 --three [arg] Do three things.
|
||||
Required.
|
||||
-4 --four {arg} Do four things.
|
||||
-5 --five {arg} Do five things. Required. Maybe.
|
||||
-6 --six [arg] Do six things. Not Required.
|
||||
Required, it is not.
|
||||
-7 --seven [arg] Required. Or bust.
|
||||
-8 --eight [arg] Do eight things.
|
||||
More.Required.Description.
|
||||
-a [arg] Do A. Required.
|
||||
Default="do-a"
|
||||
-b {arg} Do B.Default="do-b"
|
||||
-c [arg] Required. Default="do-c"
|
||||
-d {arg} Default="do-d"
|
||||
EOF
|
||||
|
||||
export __usage
|
||||
export NO_COLOR="true"
|
||||
|
||||
echo "ACCPTST:STDIO_REPLACE_DATETIMES"
|
||||
|
||||
echo "# complain about -3"
|
||||
(source "${__root}/main.sh") || true
|
||||
|
||||
echo "# complain about -4"
|
||||
(source "${__root}/main.sh" -3 arg3) || true
|
||||
|
||||
echo "# complain about -5"
|
||||
(source "${__root}/main.sh" -3 arg3 -4 arg4) || true
|
||||
|
||||
echo "# complain about -8 (because -7 syntax is not supported)"
|
||||
(source "${__root}/main.sh" -3 arg3 -4 arg4 -5 arg5) || true
|
||||
|
||||
echo "# complain about -d (because -d syntax is not supported)"
|
||||
(source "${__root}/main.sh" -3 arg3 -4 arg4 -5 arg5 -8 arg8) || true
|
||||
|
||||
echo "# complain about nothing"
|
||||
(
|
||||
source "${__root}/main.sh" -3 arg3 -4 arg4 -5 arg5 -8 arg8 -d argd
|
||||
for argument in ${!arg_*}; do info "${argument}: ${!argument}"; done
|
||||
)
|
||||
|
||||
echo "# test for issue #108"
|
||||
(
|
||||
source "${__root}/main.sh" -3 arg3 -5 arg5 -8 arg8 -d argd --four value --zero
|
||||
for argument in ${!arg_*}; do info "${argument}: ${!argument}"; done
|
||||
)
|
@@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o pipefail
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set -o xtrace
|
||||
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__root="$(cd "$(dirname "$(dirname "$(dirname "${__dir}")")")" && pwd)"
|
||||
|
||||
__sysTmpDir="${TMPDIR:-/tmp}"
|
||||
__sysTmpDir="${__sysTmpDir%/}" # <-- remove trailing slash on macosx
|
||||
|
||||
# Currently I only know how to test a failing condition here since
|
||||
# it's too invasive to create actual mounts to play with on a system
|
||||
|
||||
bash "${__root}/src/megamount.sh" 'foobarfs://janedoe:abc123@192.168.0.1/documents' "${__sysTmpDir}/mnt/documents" || true
|
||||
|
||||
# shellcheck source=src/megamount.sh
|
||||
source "${__root}/src/megamount.sh"
|
||||
|
||||
megamount 'foobarfs://janedoe:abc123@192.168.0.1/documents' "${__sysTmpDir}/mnt/documents"
|
@@ -1,17 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o pipefail
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set -o xtrace
|
||||
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__root="$(cd "$(dirname "$(dirname "$(dirname "${__dir}")")")" && pwd)"
|
||||
|
||||
bash "${__root}/src/parse_url.sh" 'http://johndoe:abc123@example.com:8080/index.html' pass
|
||||
bash "${__root}/src/parse_url.sh" 'http://johndoe:abc123@example.com:8080/index.html'
|
||||
|
||||
# shellcheck source=src/parse_url.sh
|
||||
source "${__root}/src/parse_url.sh"
|
||||
|
||||
parse_url 'http://johndoe:abc123@example.com:8080/index.html' pass
|
||||
parse_url 'http://johndoe:abc123@example.com:8080/index.html'
|
@@ -1,2 +0,0 @@
|
||||
[connection]
|
||||
host = ${TARGET_HOST}
|
@@ -1,3 +0,0 @@
|
||||
[connection]
|
||||
host = ${TARGET_HOST}
|
||||
port = ${I_DONT_EXIST}
|
@@ -1,36 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -o pipefail
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
# set -o xtrace
|
||||
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
|
||||
__base="$(basename "${__file}" .sh)"
|
||||
|
||||
__root="$(cd "$(dirname "$(dirname "$(dirname "${__dir}")")")" && pwd)"
|
||||
|
||||
__templaterTmpFile=$(mktemp "${TMPDIR:-/tmp}/${__base}.XXXXXX")
|
||||
function cleanup_before_exit () { rm "${__templaterTmpFile:?}"; }
|
||||
trap cleanup_before_exit EXIT
|
||||
|
||||
echo "--"
|
||||
env TARGET_HOST="127.0.0.1" bash "${__root}/src/templater.sh" ./app.template.cfg "${__templaterTmpFile}"
|
||||
cat "${__templaterTmpFile}"
|
||||
|
||||
echo "--"
|
||||
export TARGET_HOST="127.0.0.1"
|
||||
|
||||
# shellcheck source=src/templater.sh
|
||||
source "${__root}/src/templater.sh"
|
||||
|
||||
templater ./app.template.cfg "${__templaterTmpFile}"
|
||||
cat "${__templaterTmpFile}"
|
||||
|
||||
echo "--"
|
||||
env ALLOW_REMAINDERS="1" TARGET_HOST="127.0.0.1" bash "${__root}/src/templater.sh" ./break.template.cfg "${__templaterTmpFile}"
|
||||
cat "${__templaterTmpFile}"
|
||||
|
||||
echo "--"
|
||||
env TARGET_HOST="127.0.0.1" bash "${__root}/src/templater.sh" ./break.template.cfg "${__templaterTmpFile}"
|
||||
cat "${__templaterTmpFile}"
|
45
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/test/style.pl
generated
vendored
45
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/test/style.pl
generated
vendored
@@ -1,45 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
die "usage: $0 <file>\n" if (not @ARGV);
|
||||
|
||||
my $rc = 0;
|
||||
my $file = shift;
|
||||
|
||||
open(my $fh, '<', $file) or die "Cannot open \`$file' for read: $!\n";
|
||||
while (<$fh>) {
|
||||
next if (/^\s*#/);
|
||||
|
||||
my $errors = 0;
|
||||
|
||||
# remove everything between single quotes
|
||||
# this will remove too much in case of: echo "var='$var'"
|
||||
# and thus miss an opportunity to complain later on
|
||||
# also it mangles the input line irreversible
|
||||
s/'[^']+'/'___'/g;
|
||||
|
||||
# highlight unbraced variables--
|
||||
# unless properly backslash'ed
|
||||
$errors += s/((?:^|[^\\]))(((\\\\)+)?\$\w)/$1\033[31m$2\033[0m/g;
|
||||
|
||||
# highlight single square brackets
|
||||
$errors += s/((?:^|\s+))\[([^\[].+[^\]])\](\s*(;|&&|\|\|))/$1\033[31m\[\033[0m$2\033[31m\]\033[0m$3/g;
|
||||
|
||||
# highlight double equal sign
|
||||
$errors += s/(\[\[.*)(==)(.*\]\])/$1\033[31m$2\033[0m$3/g;
|
||||
|
||||
# highlight tabs mixed with whitespace at beginning of lines
|
||||
$errors += s/^( *)(\t+ *)/\033[31m\[$2\]\033[0m/;
|
||||
|
||||
# highlight trailing whitespace
|
||||
$errors += s/([ \t]+)$/\033[31m\[$1\]\033[0m/;
|
||||
|
||||
next if (not $errors);
|
||||
print "${file}[$.]: $_";
|
||||
$rc = 1;
|
||||
}
|
||||
close($fh);
|
||||
|
||||
exit $rc;
|
1372
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/yarn.lock
generated
vendored
1372
vendor/git.knownelement.com/ExternalVendorCode/bash3boilerplate/yarn.lock
generated
vendored
File diff suppressed because it is too large
Load Diff
10
vendor/git.knownelement.com/ExternalVendorCode/markdown-resume/README.md
generated
vendored
10
vendor/git.knownelement.com/ExternalVendorCode/markdown-resume/README.md
generated
vendored
@@ -1,10 +0,0 @@
|
||||
# markdown-resume
|
||||
The simplest possible resume workflow from markdown source.
|
||||
|
||||
Changing the content or styling of a resume or CV is a relatively common event that can be a frustrating, time-consuming hassle. This repo contains starter files for the simplest possible workflow where resume *content* is maintained in a simple markdown file and generating `.html`, `.pdf` and `.docx` output formats can be automated with two tools: `pandoc` and `wkhtmltopdf`.
|
||||
|
||||
**Still trying to decide if this is the workflow for you? Here are the original markdown files and the three output files for your persual**:
|
||||
|
||||
[Markdown](resume.md) . [HTML](resume.html) . [PDF](resume.pdf) . [Word Doc](resume.docx)
|
||||
|
||||
[Full work flow details](http://sdsawtelle.github.io/blog/output/simple-markdown-resume-with-pandoc-and-wkhtmltopdf.html) are contained in a short blog post.
|
440
vendor/git.knownelement.com/ExternalVendorCode/markdown-resume/resume-css-stylesheet.css
generated
vendored
440
vendor/git.knownelement.com/ExternalVendorCode/markdown-resume/resume-css-stylesheet.css
generated
vendored
File diff suppressed because one or more lines are too long
BIN
vendor/git.knownelement.com/ExternalVendorCode/markdown-resume/resume-docx-reference.docx
generated
vendored
BIN
vendor/git.knownelement.com/ExternalVendorCode/markdown-resume/resume-docx-reference.docx
generated
vendored
Binary file not shown.
BIN
vendor/git.knownelement.com/ExternalVendorCode/markdown-resume/resume.docx
generated
vendored
BIN
vendor/git.knownelement.com/ExternalVendorCode/markdown-resume/resume.docx
generated
vendored
Binary file not shown.
53
vendor/git.knownelement.com/ExternalVendorCode/markdown-resume/resume.html
generated
vendored
53
vendor/git.knownelement.com/ExternalVendorCode/markdown-resume/resume.html
generated
vendored
@@ -1,53 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Content-Style-Type" content="text/css" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<title></title>
|
||||
<style type="text/css">code{white-space: pre;}</style>
|
||||
<link rel="stylesheet" href="resume-css-stylesheet.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="sonya-sawtelle">Sonya Sawtelle</h1>
|
||||
<h4 id="data-enthusiast-with-a-strong-background-in-math-science-and-programming.">Data enthusiast with a strong background in math, science and programming.</h4>
|
||||
<h6 id="sdsawtelle.github.io-.-sonya.sawtelleyale.edu-.-802-461-3429">[ <a href="http://sdsawtelle.github.io">sdsawtelle.github.io</a> ] . [ sonya.sawtelle@yale.edu ] . [ 802 461 3429 ]</h6>
|
||||
<h2 id="education">Education</h2>
|
||||
<p><strong>Ph.D. program in Applied Physics, Yale University</strong> (2012-present)</p>
|
||||
<ul>
|
||||
<li>Research on transport in metal nanostructures.</li>
|
||||
<li>Coursework in physics, engineering, and statistics.</li>
|
||||
</ul>
|
||||
<p><strong>B.S. in Physics, Indiana University</strong> (2008-2011)</p>
|
||||
<ul>
|
||||
<li>Baccalaureate with Departmental Honors and Highest Distinction, 3.98/4.0 GPA</li>
|
||||
</ul>
|
||||
<p><strong>MOOCs</strong> (ongoing)</p>
|
||||
<ul>
|
||||
<li>Machine Learning (Stanford, Andrew Ng)</li>
|
||||
</ul>
|
||||
<h2 id="experience">Experience</h2>
|
||||
<p><strong>Independent Researcher, Yale University</strong> (2012-present, New Haven CT)</p>
|
||||
<ul>
|
||||
<li>Data analysis and simulation in Python and MATLAB, and instrument control in C++. Designed and executed experiments across four projects and managed several undegraduate students.</li>
|
||||
</ul>
|
||||
<p><strong>MCAT Instructor, Kaplan Test Prep</strong> (2011-2012, New Haven CT)</p>
|
||||
<ul>
|
||||
<li>Planned and delivered lectures on core content in undergraduate Physics, Chemistry and Biology to medium-sized groups of undergraduates.</li>
|
||||
</ul>
|
||||
<h2 id="skills">Skills</h2>
|
||||
<p><strong>Programming:</strong> Python, MATLAB, SQL, R, git, HTML/CSS</p>
|
||||
<p><strong>Python SciPy Tools:</strong> Pandas, Numpy, Matplotlib, Scikit-learn</p>
|
||||
<h2 id="awards">Awards</h2>
|
||||
<ul>
|
||||
<li><strong>Sterling Prize Fellowship</strong>, Yale University (2013). Awarded to 30 out of 10,500 applicants.</li>
|
||||
<li><strong>IU Founders Scholar</strong>, Indiana University (2012)</li>
|
||||
<li><strong>Baccalaureate with Highest Distinction</strong>, Indiana University (2012). Granted to 5 students out of 498 in the class.</li>
|
||||
</ul>
|
||||
<h2 id="projects">Projects</h2>
|
||||
<p><strong><a href="http://sdsawtelle.github.io/blog/output/index.html"><em>Evening Sessions: Explorations in Data Science and Python</em> Blog</a></strong> (2015-present)</p>
|
||||
<ul>
|
||||
<li>Authored a series of articles covering a wide variety of topics and tools related to pure Python programming, data science and statistics.</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
49
vendor/git.knownelement.com/ExternalVendorCode/markdown-resume/resume.md
generated
vendored
49
vendor/git.knownelement.com/ExternalVendorCode/markdown-resume/resume.md
generated
vendored
@@ -1,49 +0,0 @@
|
||||
Sonya Sawtelle
|
||||
======
|
||||
|
||||
#### Data enthusiast with a strong background in math, science and programming.
|
||||
###### [ [sdsawtelle.github.io](http://sdsawtelle.github.io) ] . [ sonya.sawtelle@yale.edu ] . [ 802 461 3429 ]
|
||||
|
||||
|
||||
Education
|
||||
---------
|
||||
**Ph.D. program in Applied Physics, Yale University** (2012-present)
|
||||
|
||||
- Research on transport in metal nanostructures.
|
||||
- Coursework in physics, engineering, and statistics.
|
||||
|
||||
**B.S. in Physics, Indiana University** (2008-2011)
|
||||
|
||||
- Baccalaureate with Departmental Honors and Highest Distinction, 3.98/4.0 GPA
|
||||
|
||||
**MOOCs** (ongoing)
|
||||
|
||||
- Machine Learning (Stanford, Andrew Ng)
|
||||
|
||||
Experience
|
||||
---------
|
||||
**Independent Researcher, Yale University** (2012-present, New Haven CT)
|
||||
|
||||
- Data analysis and simulation in Python and MATLAB, and instrument control in C++. Designed and executed experiments across four projects and managed several undegraduate students.
|
||||
|
||||
**MCAT Instructor, Kaplan Test Prep** (2011-2012, New Haven CT)
|
||||
|
||||
- Planned and delivered lectures on core content in undergraduate Physics, Chemistry and Biology to medium-sized groups of undergraduates.
|
||||
|
||||
Skills
|
||||
------
|
||||
**Programming:** Python, MATLAB, SQL, R, git, HTML/CSS
|
||||
|
||||
**Python SciPy Tools:** Pandas, Numpy, Matplotlib, Scikit-learn
|
||||
|
||||
Awards
|
||||
------
|
||||
- **Sterling Prize Fellowship**, Yale University (2013). Awarded to 30 out of 10,500 applicants.
|
||||
- **IU Founders Scholar**, Indiana University (2012)
|
||||
- **Baccalaureate with Highest Distinction**, Indiana University (2012). Granted to 5 students out of 498 in the class.
|
||||
|
||||
Projects
|
||||
--------
|
||||
**[*Evening Sessions: Explorations in Data Science and Python* Blog](http://sdsawtelle.github.io/blog/output/index.html)** (2015-present)
|
||||
|
||||
- Authored a series of articles covering a wide variety of topics and tools related to pure Python programming, data science and statistics.
|
BIN
vendor/git.knownelement.com/ExternalVendorCode/markdown-resume/resume.pdf
generated
vendored
BIN
vendor/git.knownelement.com/ExternalVendorCode/markdown-resume/resume.pdf
generated
vendored
Binary file not shown.
@@ -1,75 +0,0 @@
|
||||
name: Build Example PDF files
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
|
||||
- name: Setup pandoc
|
||||
env:
|
||||
PANDOC_VERSION: "3.4"
|
||||
run: |
|
||||
wget -qO- https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz | sudo tar xzf - --strip-components 1 -C /usr/local/
|
||||
- name: Setup TexLive
|
||||
env:
|
||||
REMOTE: http://mirror.ctan.org/systems/texlive/tlnet
|
||||
INSTALL: '/tmp/install-texlive'
|
||||
run: |
|
||||
mkdir -p ${INSTALL}
|
||||
curl -sSL ${REMOTE}/install-tl-unx.tar.gz | tar -xzv -C $INSTALL --strip-components=1
|
||||
sudo ${INSTALL}/install-tl -no-gui -profile .texlife.profile
|
||||
VERSION=$($INSTALL/install-tl --version | grep 'version' | grep -o '[0-9]\{4\}')
|
||||
PLATFORM=$($INSTALL/install-tl --print-platform)
|
||||
TEXLIVE_DIR="/usr/local/texlive/${VERSION}"
|
||||
TEXBIN="/usr/local/texlive/${VERSION}/bin/${PLATFORM}"
|
||||
echo "${TEXBIN}" >> $GITHUB_PATH
|
||||
sudo chown -hR $(whoami) "$TEXLIVE_DIR"
|
||||
- name: Initialization for tlmgr
|
||||
run: |
|
||||
sudo apt-get update -qq && sudo apt-get install xzdec -y
|
||||
tlmgr init-usertree
|
||||
- name: Setup fonts and image convertion tool
|
||||
run: sudo apt-get update -qq && sudo apt-get install fonts-noto-cjk poppler-utils -y
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install python filters
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pandoc-latex-environment
|
||||
- name: Install LaTeX packages
|
||||
run: |
|
||||
tlmgr install adjustbox background bidi csquotes footmisc footnotebackref fvextra mdframed pagecolor sourcecodepro sourcesanspro titling ulem upquote xurl hardwrap catchfile
|
||||
# trial and error
|
||||
tlmgr install letltxmacro zref everypage framed collectbox
|
||||
# packages needed for the template
|
||||
tlmgr install xecjk filehook unicode-math ucharcat pagecolor babel-german ly1 mweights sourcecodepro sourcesanspro mdframed needspace fvextra footmisc footnotebackref background
|
||||
# packages only needed for some examples (that include packages via header-includes)
|
||||
tlmgr install awesomebox fontawesome5
|
||||
# packages only needed for some examples (example boxes-with-pandoc-latex-environment-and-tcolorbox)
|
||||
tlmgr install tcolorbox pgf etoolbox environ trimspaces
|
||||
- name: Build examples
|
||||
run: cd examples && bash build-examples.sh && cd ..
|
||||
- name: Add generated example files
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: build-files
|
||||
path: |
|
||||
examples/*/document.pdf
|
||||
examples/*/preview.png
|
||||
- name: Commit files
|
||||
run: |
|
||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git commit -m "Add generated example files" -a
|
||||
- name: Push changes
|
||||
uses: ad-m/github-push-action@master
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: ${{ github.ref }}
|
358
vendor/git.knownelement.com/ExternalVendorCode/pandoc-latex-template/.gitignore
generated
vendored
358
vendor/git.knownelement.com/ExternalVendorCode/pandoc-latex-template/.gitignore
generated
vendored
@@ -1,358 +0,0 @@
|
||||
|
||||
# contains all sorts of unfinished changes
|
||||
private/
|
||||
|
||||
# build folder
|
||||
dist/
|
||||
|
||||
.idea
|
||||
|
||||
# contains unit tests (incomplete at the moment, so don't include them)
|
||||
test/
|
||||
test/.idea/
|
||||
test/eisvogel-tests.iml
|
||||
|
||||
|
||||
# Created by https://www.gitignore.io/api/linux,macos,latex,windows
|
||||
# Edit at https://www.gitignore.io/?templates=linux,macos,latex,windows
|
||||
|
||||
### LaTeX ###
|
||||
## Core latex/pdflatex auxiliary files:
|
||||
*.aux
|
||||
*.lof
|
||||
*.log
|
||||
*.lot
|
||||
*.fls
|
||||
*.out
|
||||
*.toc
|
||||
*.fmt
|
||||
*.fot
|
||||
*.cb
|
||||
*.cb2
|
||||
.*.lb
|
||||
|
||||
## Intermediate documents:
|
||||
*.dvi
|
||||
*.xdv
|
||||
*-converted-to.*
|
||||
# these rules might exclude image files for figures etc.
|
||||
# *.ps
|
||||
# *.eps
|
||||
# *.pdf
|
||||
|
||||
## Generated if empty string is given at "Please type another file name for output:"
|
||||
.pdf
|
||||
|
||||
## Bibliography auxiliary files (bibtex/biblatex/biber):
|
||||
*.bbl
|
||||
*.bcf
|
||||
*.blg
|
||||
*-blx.aux
|
||||
*-blx.bib
|
||||
*.run.xml
|
||||
|
||||
## Build tool auxiliary files:
|
||||
*.fdb_latexmk
|
||||
*.synctex
|
||||
*.synctex(busy)
|
||||
*.synctex.gz
|
||||
*.synctex.gz(busy)
|
||||
*.pdfsync
|
||||
|
||||
## Build tool directories for auxiliary files
|
||||
# latexrun
|
||||
latex.out/
|
||||
|
||||
## Auxiliary and intermediate files from other packages:
|
||||
# algorithms
|
||||
*.alg
|
||||
*.loa
|
||||
|
||||
# achemso
|
||||
acs-*.bib
|
||||
|
||||
# amsthm
|
||||
*.thm
|
||||
|
||||
# beamer
|
||||
*.nav
|
||||
*.pre
|
||||
*.snm
|
||||
*.vrb
|
||||
|
||||
# changes
|
||||
*.soc
|
||||
|
||||
# comment
|
||||
*.cut
|
||||
|
||||
# cprotect
|
||||
*.cpt
|
||||
|
||||
# elsarticle (documentclass of Elsevier journals)
|
||||
*.spl
|
||||
|
||||
# endnotes
|
||||
*.ent
|
||||
|
||||
# fixme
|
||||
*.lox
|
||||
|
||||
# feynmf/feynmp
|
||||
*.mf
|
||||
*.mp
|
||||
*.t[1-9]
|
||||
*.t[1-9][0-9]
|
||||
*.tfm
|
||||
|
||||
#(r)(e)ledmac/(r)(e)ledpar
|
||||
*.end
|
||||
*.?end
|
||||
*.[1-9]
|
||||
*.[1-9][0-9]
|
||||
*.[1-9][0-9][0-9]
|
||||
*.[1-9]R
|
||||
*.[1-9][0-9]R
|
||||
*.[1-9][0-9][0-9]R
|
||||
*.eledsec[1-9]
|
||||
*.eledsec[1-9]R
|
||||
*.eledsec[1-9][0-9]
|
||||
*.eledsec[1-9][0-9]R
|
||||
*.eledsec[1-9][0-9][0-9]
|
||||
*.eledsec[1-9][0-9][0-9]R
|
||||
|
||||
# glossaries
|
||||
*.acn
|
||||
*.acr
|
||||
*.glg
|
||||
*.glo
|
||||
*.gls
|
||||
*.glsdefs
|
||||
|
||||
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
|
||||
# *.ist
|
||||
|
||||
# gnuplottex
|
||||
*-gnuplottex-*
|
||||
|
||||
# gregoriotex
|
||||
*.gaux
|
||||
*.gtex
|
||||
|
||||
# htlatex
|
||||
*.4ct
|
||||
*.4tc
|
||||
*.idv
|
||||
*.lg
|
||||
*.trc
|
||||
*.xref
|
||||
|
||||
# hyperref
|
||||
*.brf
|
||||
|
||||
# knitr
|
||||
*-concordance.tex
|
||||
# TODO Comment the next line if you want to keep your tikz graphics files
|
||||
*.tikz
|
||||
*-tikzDictionary
|
||||
|
||||
# listings
|
||||
*.lol
|
||||
|
||||
# luatexja-ruby
|
||||
*.ltjruby
|
||||
|
||||
# makeidx
|
||||
*.idx
|
||||
*.ilg
|
||||
*.ind
|
||||
|
||||
# minitoc
|
||||
*.maf
|
||||
*.mlf
|
||||
*.mlt
|
||||
*.mtc[0-9]*
|
||||
*.slf[0-9]*
|
||||
*.slt[0-9]*
|
||||
*.stc[0-9]*
|
||||
|
||||
# minted
|
||||
_minted*
|
||||
*.pyg
|
||||
|
||||
# morewrites
|
||||
*.mw
|
||||
|
||||
# nomencl
|
||||
*.nlg
|
||||
*.nlo
|
||||
*.nls
|
||||
|
||||
# pax
|
||||
*.pax
|
||||
|
||||
# pdfpcnotes
|
||||
*.pdfpc
|
||||
|
||||
# sagetex
|
||||
*.sagetex.sage
|
||||
*.sagetex.py
|
||||
*.sagetex.scmd
|
||||
|
||||
# scrwfile
|
||||
*.wrt
|
||||
|
||||
# sympy
|
||||
*.sout
|
||||
*.sympy
|
||||
sympy-plots-for-*.tex/
|
||||
|
||||
# pdfcomment
|
||||
*.upa
|
||||
*.upb
|
||||
|
||||
# pythontex
|
||||
*.pytxcode
|
||||
pythontex-files-*/
|
||||
|
||||
# tcolorbox
|
||||
*.listing
|
||||
|
||||
# thmtools
|
||||
*.loe
|
||||
|
||||
# TikZ & PGF
|
||||
*.dpth
|
||||
*.md5
|
||||
*.auxlock
|
||||
|
||||
# todonotes
|
||||
*.tdo
|
||||
|
||||
# vhistory
|
||||
*.hst
|
||||
*.ver
|
||||
|
||||
# easy-todo
|
||||
*.lod
|
||||
|
||||
# xcolor
|
||||
*.xcp
|
||||
|
||||
# xmpincl
|
||||
*.xmpi
|
||||
|
||||
# xindy
|
||||
*.xdy
|
||||
|
||||
# xypic precompiled matrices
|
||||
*.xyc
|
||||
|
||||
# endfloat
|
||||
*.ttt
|
||||
*.fff
|
||||
|
||||
# Latexian
|
||||
TSWLatexianTemp*
|
||||
|
||||
## Editors:
|
||||
# WinEdt
|
||||
*.bak
|
||||
*.sav
|
||||
|
||||
# Texpad
|
||||
.texpadtmp
|
||||
|
||||
# LyX
|
||||
*.lyx~
|
||||
|
||||
# Kile
|
||||
*.backup
|
||||
|
||||
# KBibTeX
|
||||
*~[0-9]*
|
||||
|
||||
# auto folder when using emacs and auctex
|
||||
./auto/*
|
||||
*.el
|
||||
|
||||
# expex forward references with \gathertags
|
||||
*-tags.tex
|
||||
|
||||
# standalone packages
|
||||
*.sta
|
||||
|
||||
### LaTeX Patch ###
|
||||
# glossaries
|
||||
*.glstex
|
||||
|
||||
### Linux ###
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
### macOS ###
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
### Windows ###
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
# End of https://www.gitignore.io/api/linux,macos,latex,windows
|
15
vendor/git.knownelement.com/ExternalVendorCode/pandoc-latex-template/.texlife.profile
generated
vendored
15
vendor/git.knownelement.com/ExternalVendorCode/pandoc-latex-template/.texlife.profile
generated
vendored
@@ -1,15 +0,0 @@
|
||||
selected_scheme scheme-basic
|
||||
instopt_adjustpath 1
|
||||
collection-basic 1
|
||||
collection-bibtexextra 0
|
||||
collection-fontsextra 0
|
||||
collection-fontsrecommended 1
|
||||
collection-langchinese 0
|
||||
collection-latex 1
|
||||
collection-latexextra 0
|
||||
collection-latexrecommended 1
|
||||
collection-mathscience 0
|
||||
collection-xetex 1
|
||||
tlpdbopt_autobackup 0
|
||||
tlpdbopt_install_docfiles 0
|
||||
tlpdbopt_install_srcfiles 0
|
202
vendor/git.knownelement.com/ExternalVendorCode/pandoc-latex-template/CHANGELOG.md
generated
vendored
202
vendor/git.knownelement.com/ExternalVendorCode/pandoc-latex-template/CHANGELOG.md
generated
vendored
@@ -1,202 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project are documented in this file. On the [releases page](https://github.com/Wandmalfarbe/pandoc-latex-template/releases/) you can see all released versions of the Eisvogel template and download the [latest version](https://github.com/Wandmalfarbe/pandoc-latex-template/releases/latest).
|
||||
|
||||
## [2.5.0] - 2024-10-03
|
||||
|
||||
- Merge changes from the pandoc default LaTeX template from version 3.4 ([7e8aafa](https://github.com/jgm/pandoc-templates/commit/7e8aafa049700a849b41c53cf1afeb17324040c7)).
|
||||
|
||||
## [2.4.2] - 2023-11-25
|
||||
|
||||
- Merge changes from the pandoc default LaTeX template from version 3.1.9 ([f7d8b62](https://github.com/jgm/pandoc-templates/commit/f7d8b629330074a4400d1f2795b101d14491c968)).
|
||||
- Merge changes from the pandoc default LaTeX template from version 3.1.8 ([2d42e04](https://github.com/jgm/pandoc-templates/commit/2d42e04cbd65dd36c4469156b00f636e7f31623e)) (#364, David Mehren).
|
||||
- Add fix for `table-use-row-colors` which previously stopped working (#301, Chris Fenner).
|
||||
|
||||
## [2.4.1] - 2023-09-06
|
||||
|
||||
- Merge changes from the pandoc default LaTeX template from version 3.1.7 (as of 2023-08-31, [8a5b381](https://github.com/jgm/pandoc-templates/blob/8a5b381c156c974b485197208c6dc86fce94b5c3/default.latex)).
|
||||
|
||||
## [2.4.0] - 2023-04-17
|
||||
|
||||
- Merge changes from the pandoc default LaTeX template (as of 2023-03-29, [a5159c2](https://github.com/jgm/pandoc/blob/a5159c2c505cd9a87856877b3287aa0b88e4e0ba/data/templates/default.latex)).
|
||||
- Fix placement of float figures (tables, images, etc.). Float figures should now appear
|
||||
exactly where they are included. The option `float-placement-figure` is also restored.
|
||||
- Remove Travis CI build
|
||||
- Fix wrong font sizes on the title page. The problem went away on its own, likely because
|
||||
of an updated LaTeX package.
|
||||
|
||||
## [2.3.0] - 2023-03-13
|
||||
|
||||
The Eisvogel template is now available in the Docker image [pandoc/extra](https://hub.docker.com/r/pandoc/extra)!
|
||||
For more Information refer to the [documentation in the Readme](https://github.com/Wandmalfarbe/pandoc-latex-template#docker-image) or
|
||||
the [documentation on docker hub](https://hub.docker.com/r/pandoc/extra).
|
||||
|
||||
- Merge changes from the pandoc default LaTeX template (as of 2023-03-10, [9b04036](https://github.com/jgm/pandoc/blob/9b04036f6b0745c6ce0cb027683e94b648da3a9c/data/templates/default.latex)).
|
||||
- Add `CJKsansfont` and `CJKmonofont` for XeLaTeX. `CJKsansfont` and `CJKmonofont` will be set
|
||||
for XeLaTeX only if `CJKmainfont` is also provided (#328, Yudong Jin).
|
||||
- Add documentation in the README on how to use the `pandoc/extra` docker image (#319, damien clochard).
|
||||
- Fix wrong literate of characters `è` and `È` in listings. The character `è` was wrongly
|
||||
converted to `é` and `È` to `É` (#324, damien clochard).
|
||||
|
||||
## [2.2.0] - 2023-01-22
|
||||
|
||||
- Merge changes from the pandoc default LaTeX template (as of 2023-01-13, [909ced5](https://github.com/jgm/pandoc/blob/909ced5153e2c7cefd5018c39f83231824940fb8/data/templates/default.latex)).
|
||||
- This change adds support for pandoc 3.
|
||||
|
||||
## [2.1.0] - 2022-12-04
|
||||
|
||||
- Merge changes from the pandoc default LaTeX template (as of 2022-11-19, [144bf90ab9](https://github.com/jgm/pandoc/blob/144bf90ab92b517dd721baf80f121f86187ccd61/data/templates/default.latex)).
|
||||
- Restructure the examples. Any example folder now contains at least the following files:
|
||||
- `document.md`: the Markdown document to convert to a PDF
|
||||
- `document.pdf`: the resulting PDF document
|
||||
- `build.sh`: a shell script to convert the document `document.md` with pandoc. This script might call pandoc with additional arguments (e.g. filters or template variables).
|
||||
- `preview.png`: a PNG image of the resulting PDF document intended as a quick preview
|
||||
- Use the Koma-Script package `scrlayer-scrpage` for the headers and footers instead of the package `fancyhdr` (#174, khaveesh).
|
||||
- Fix a header and footer bug when using `oneside` introduced by the migration to `scrlayer-scrpage` (#248, ret2src).
|
||||
- Restore pagestyle `plain` for chapters (#275). Headers and footers are removed from chapter pages, as it has been before the migration to `scrlayer-scrpage`.
|
||||
- Correct the examples and documentation (#239, mprobson), (#261, supcik).
|
||||
- Exclude title page from page count (#230, shmalebx9).
|
||||
- Make code-block-font-size not affect inline listings (#229, LudvigHz).
|
||||
- Rename the Eisvogel template variable `logo` to `titlepage-logo`.
|
||||
- `logo` is already used by beamer, and one might want to use both
|
||||
formats (beamer and latex) without the logo appearing as a
|
||||
background image on beamer slides.
|
||||
- Add an example for a table of contents (#283).
|
||||
|
||||
## [2.0.0] - 2021-01-31
|
||||
|
||||
**This release includes breaking changes.**
|
||||
|
||||
- Merged changes from the pandoc default LaTeX template.
|
||||
- Fix broken travis build by modifying the `--resource-path`
|
||||
|
||||
When specifying the resource path via `--resource-path` the template will be searched there since pandoc 2.9.2.1.
|
||||
To fix the broken travis build (`Could not find data file templates/eisvogel.latex`) the current working directory `.` is included in the resource path for pandoc to find the template again.
|
||||
|
||||
For more information visit the pandoc issue <https://github.com/jgm/pandoc/issues/6618>.
|
||||
- Rename template to `eisvogel.latex` after release (#182). There is no need for renaming the template file after the download.
|
||||
|
||||
This is a breaking change because there will be no file `eisvogel.latex` in the released artifacts anymore.
|
||||
|
||||
- Option `logo-width` has no hard coded unit `pt` anymore (#221).
|
||||
|
||||
The width of the logo can be specified with various units e.g. `pt`, `in`, `mm`.
|
||||
|
||||
This is a breaking change because a previously specified `logo-width` without a unit needs a unit now. If there is no unit LaTeX will emit an error `Illegal unit of measure (pt inserted)` and no document will be created.
|
||||
|
||||
The default value for `logo-width` has also changed from `100pt` to `35mm`.
|
||||
|
||||
## [1.6.1] - 2020-11-26
|
||||
|
||||
- Merged changes from the pandoc default LaTeX template (https://github.com/jgm/pandoc/blob/master/data/templates/default.latex).
|
||||
- This merge should fix a compilation error when using tables because of the missing `calc` package.
|
||||
|
||||
## [1.6.0] - 2020-11-02
|
||||
|
||||
- Merged changes from the pandoc default LaTeX template (https://github.com/jgm/pandoc/blob/master/data/templates/default.latex).
|
||||
- This merge should fix problems related to using CSL bibliographies (#201).
|
||||
- Added documentation about common errors to the readme.
|
||||
- The command `\thedate` can be used in the source document or metadata fields (#163).
|
||||
|
||||
## [1.5.0] - 2020-06-14
|
||||
|
||||
- Create release assets with and without version number for easy access (#175).
|
||||
- Added example `boxes-with-pandoc-latex-environment-and-tcolorbox` This example shows how to render beautiful boxes with the filter `pandoc-latex-environment` and the package `tcolorbox`.
|
||||
- Fix LaTeX installation problems on Travis by installing everything manually.
|
||||
- Fixed a couple of LuaLaTeX warnings (#169, khaveesh)
|
||||
- Mention required LaTeX package for option `footnotes-disable-backlinks` in the Readme (#148, salim-b).
|
||||
- Remove `graphicx` dependency (#149, noraj). Please see https://github.com/jgm/pandoc/issues/5848 for the full discussion.
|
||||
|
||||
## [1.4.0] - 2020-02-02
|
||||
|
||||
- Added support for a page background (#138, evildead).
|
||||
- The variable `page-background` specifies the path to a background image for any page. The background image is scaled to cover the entire page.
|
||||
- The variable `page-background-opacity` specifies the background image opacity.
|
||||
- Added an example on how to generate admonition boxes (#115). The example demonstrates the use of the filter `pandoc-latex-environments` to create custom admonition boxes with the `awesomebox` package.
|
||||
- Added an example on how to compile Chinese documents (#140).
|
||||
- Added a section on *required LaTeX packages* to the readme (#141). The section explains how to install the required packages with TeX Live and MiKtEX.
|
||||
- Corrected the command `tlmgr` in `README.md` (#143).
|
||||
|
||||
## [1.3.1] - 2019-12-08
|
||||
|
||||
- Fixed wrong margins when not using the titlepage option (#135).
|
||||
|
||||
## [1.3.0] - 2019-10-26
|
||||
|
||||
- Clarified the location of the pandoc templates directory in the readme.
|
||||
- Added missing `$endif$` that caused a compilation failure (#125, 0az).
|
||||
- Merged changes from the pandoc default LaTeX template.
|
||||
- Fixed a bug where specifying a font via `mainfont` when using pdfLaTeX would not apply the default font Source Sans Pro.
|
||||
- Improve formatting of footnotes with the variables `footnotes-pretty` and `footnotes-disable-backlinks` (#107, salim-b).
|
||||
- Added the variable `code-block-font-size` to change the font size for code blocks via the supplied LaTeX command (#123, #17).
|
||||
- Improve Japanese dummy text (#86, JKPOKE)
|
||||
- Added an example on how to change header and footer (#109).
|
||||
- Added example backgrounds to the titlepage example.
|
||||
- Added support for background images on the title page with the variable `titlepage-background` (#31, #41).
|
||||
- Disabled striped tables per default. Enable them with the variable `table-use-row-colors: true` (#29).
|
||||
- Updated listings definition for Java which is the default language when using listings. This means that more keywords such as `var` from Java 10 are highlighted.
|
||||
- Added support for additional keyword colors when using `listings` for syntax highlighting. The support depends on the used language. Some languages like `motorola68k`, `x86masm`, `inform`, `llvm`, `lua`, `metapost`, `mupad`, `ocl`, `python`, `verrilog`, `basic`, `cil`, `fortran` and `hansl` will have additional colors for some keywords.
|
||||
- Fixed: Long lines in code blocks (verbatim environment) wrap automatically (#2).
|
||||
|
||||
## [1.2.4] - 2019-06-16
|
||||
|
||||
- Fixed: The template now compiles with the output format `beamer` (#99). The styling for the generated slides is currently not customized.
|
||||
|
||||
## [1.2.3] - 2019-06-12
|
||||
|
||||
- Fixed: Code blocks were too close to the text above.
|
||||
- Fixed: The default float placement of figures can be changed with the variable `float-placement-figure`.
|
||||
- Changed: Merged changes from the pandoc default LaTeX template.
|
||||
- Added: A changelog is available as `CHANGELOG.md`.
|
||||
- Changed: Updated installation instructions in the README with new XDG support (#89, Andrew Zhou).
|
||||
|
||||
## [1.2.2] - 2019-04-09
|
||||
|
||||
- Merged changes from the pandoc default LaTeX template.
|
||||
- Fixed: Support custom values for `secnumdepth` and `toc-depth` (#87, Juan Grigera).
|
||||
|
||||
## [1.2.1] - 2019-03-10
|
||||
|
||||
- Removed double inclusion of package `xcolor` and cleaned up some comments.
|
||||
- Removed unused `\captionsetup[longtable]`.
|
||||
- Moved listing colors to the listings block in the template.
|
||||
- Changed the top and bottom spacing of listings.
|
||||
- Merged changes from the pandoc default LaTeX template.
|
||||
- Changed the release script to also create a `tar.gz` archive.
|
||||
|
||||
## [1.2.0] - 2019-03-03
|
||||
|
||||
- Fixed curly quotes in code listings under XeTeX engine (#79, Andrew Hodgkinson).
|
||||
- Merged changes from the pandoc default LaTeX template `default.latex`.
|
||||
- Updated the installation instructions in the README and moved the release script to the `tools` folder.
|
||||
|
||||
## [1.1.0] - 2019-02-17
|
||||
|
||||
- Defined a default pagestyle to make it easier to change the pagestyle on certain pages or define a custom one (#77).
|
||||
- Add support for `first-chapter` variable in case it's desirable for a book not to begin with chapter 1 (#74, umanovskis).
|
||||
|
||||
## [1.0.0] - 2018-12-07
|
||||
|
||||
- First release of the template as a ZIP file with the examples.
|
||||
|
||||
[2.5.0]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v2.4.2...v2.5.0
|
||||
[2.4.2]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v2.4.1...v2.4.2
|
||||
[2.4.1]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v2.4.0...v2.4.1
|
||||
[2.4.0]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v2.3.0...v2.4.0
|
||||
[2.3.0]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v2.2.0...v2.3.0
|
||||
[2.2.0]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v2.1.0...v2.2.0
|
||||
[2.1.0]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v2.0.0...v2.1.0
|
||||
[2.0.0]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v1.6.1...v2.0.0
|
||||
[1.6.1]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v1.6.0...v1.6.1
|
||||
[1.6.0]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v1.5.0...v1.6.0
|
||||
[1.5.0]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v1.4.0...v1.5.0
|
||||
[1.4.0]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v1.3.1...v1.4.0
|
||||
[1.3.1]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v1.3.0...v1.3.1
|
||||
[1.3.0]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v1.2.4...v1.3.0
|
||||
[1.2.4]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v1.2.3...v1.2.4
|
||||
[1.2.3]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v1.2.2...v1.2.3
|
||||
[1.2.2]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v1.2.1...v1.2.2
|
||||
[1.2.1]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v1.2.0...v1.2.1
|
||||
[1.2.0]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/1.1.0...v1.2.0
|
||||
[1.1.0]: https://github.com/Wandmalfarbe/pandoc-latex-template/compare/v1.0.0...1.1.0
|
||||
[1.0.0]: https://github.com/Wandmalfarbe/pandoc-latex-template/releases/tag/v1.0.0
|
28
vendor/git.knownelement.com/ExternalVendorCode/pandoc-latex-template/LICENSE
generated
vendored
28
vendor/git.knownelement.com/ExternalVendorCode/pandoc-latex-template/LICENSE
generated
vendored
@@ -1,28 +0,0 @@
|
||||
Copyright (c) 2017 - 2021, Pascal Wagler;
|
||||
Copyright (c) 2014 - 2021, John MacFarlane
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
481
vendor/git.knownelement.com/ExternalVendorCode/pandoc-latex-template/README.md
generated
vendored
481
vendor/git.knownelement.com/ExternalVendorCode/pandoc-latex-template/README.md
generated
vendored
@@ -1,481 +0,0 @@
|
||||
<img src="icon.png" align="right" height="110"/>
|
||||
|
||||
# Eisvogel
|
||||
|
||||
A clean **pandoc LaTeX template** to convert your markdown files to PDF or LaTeX. It is designed for lecture notes and exercises with a focus on computer science. The template is compatible with pandoc 3.
|
||||
|
||||
## Preview
|
||||
|
||||
| A custom title page | A basic example page |
|
||||
| :------------------: | :------------------: |
|
||||
| [](examples/title-page-custom/document.pdf) | [](examples/basic-example/document.pdf) |
|
||||
|
||||
## Installation
|
||||
|
||||
1. Install pandoc from <http://pandoc.org/>. You also need to install [LaTeX](https://en.wikibooks.org/wiki/LaTeX/Installation#Distributions).
|
||||
2. Download the latest version of the Eisvogel template from [the release page](https://github.com/Wandmalfarbe/pandoc-latex-template/releases/latest).
|
||||
3. Extract the downloaded ZIP archive and open the folder.
|
||||
4. Move the template `eisvogel.latex` to your pandoc templates folder. The location of the templates folder depends on your operating system:
|
||||
- Unix, Linux, macOS: `/Users/USERNAME/.local/share/pandoc/templates/` or `/Users/USERNAME/.pandoc/templates/`
|
||||
- Windows Vista or later: `C:\Users\USERNAME\AppData\Roaming\pandoc\templates\`
|
||||
|
||||
If there are no folders called `templates` or `pandoc` you need to create them and put the template `eisvogel.latex` inside. You can find the default user data directory on your system by looking at the output of `pandoc --version`.
|
||||
|
||||
|
||||
### Docker image
|
||||
|
||||
Alternatively, if you don't want to install LaTeX, you can use the Docker
|
||||
image named [pandoc/extra]. The image contains pandoc, LaTeX and a curated
|
||||
selection of components such as the eisvogel template, pandoc filters and
|
||||
open source fonts. A common use of the image looks like this
|
||||
(line breaks for readability):
|
||||
|
||||
``` bash
|
||||
docker run --rm \
|
||||
--volume "$(pwd):/data" \
|
||||
--user $(id -u):$(id -g) \
|
||||
pandoc/extra example.md -o example.pdf --template eisvogel --listings
|
||||
```
|
||||
|
||||
For frequent command line use, you can define the following shell alias:
|
||||
|
||||
``` bash
|
||||
alias pandock='docker run --rm -v "$(pwd):/data" -u $(id -u):$(id -g) pandoc/extra'
|
||||
```
|
||||
|
||||
The example invocation with Docker from above now looks like this:
|
||||
|
||||
``` bash
|
||||
pandock example.md -o example.pdf --template eisvogel --listings
|
||||
```
|
||||
|
||||
[pandoc/extra]: https://hub.docker.com/r/pandoc/extra
|
||||
|
||||
## Usage
|
||||
|
||||
1. Open the terminal and navigate to the folder where your markdown file is located.
|
||||
|
||||
2. Execute the following command
|
||||
|
||||
``` bash
|
||||
pandoc example.md -o example.pdf --from markdown --template eisvogel --listings
|
||||
```
|
||||
|
||||
where `example.md` is the markdown file you want to convert to PDF.
|
||||
|
||||
In order to have nice headers and footers you need to supply metadata to your document. You can do that with a [YAML metadata block](http://pandoc.org/MANUAL.html#extension-yaml_metadata_block) at the top of your markdown document (see the [example markdown file](examples/basic-example/document.md)). Your markdown document may look like the following:
|
||||
|
||||
``` markdown
|
||||
---
|
||||
title: "The Document Title"
|
||||
author: [Example Author, Another Author]
|
||||
date: "2017-02-20"
|
||||
keywords: [Markdown, Example]
|
||||
...
|
||||
|
||||
Here is the actual document text...
|
||||
```
|
||||
|
||||
### Custom Template Variables
|
||||
|
||||
This template defines some new variables to control the appearance of the resulting PDF document. The existing template variables from pandoc are all supported and their documentation can be found in [the pandoc manual](https://pandoc.org/MANUAL.html#variables-for-latex).
|
||||
|
||||
- `titlepage` (defaults to `false`)
|
||||
|
||||
turns on the title page when `true`
|
||||
|
||||
- `titlepage-color`
|
||||
|
||||
the background color of the title page. The color value must be given as an HTML hex color like `D8DE2C` without the leading number sign (`#`). When specifying the color in YAML, it is advisable to enclose it in quotes like so `titlepage-color: "D8DE2C"` to avoid the truncation of the color (e.g. `000000` becoming `0`).
|
||||
|
||||
- `titlepage-text-color` (defaults to `5F5F5F`)
|
||||
|
||||
the text color of the title page
|
||||
|
||||
- `titlepage-rule-color` (defaults to `435488`)
|
||||
|
||||
the color of the rule on the top of the title page
|
||||
|
||||
- `titlepage-rule-height` (defaults to `4`)
|
||||
|
||||
the height of the rule on the top of the title page (in points)
|
||||
|
||||
- `titlepage-logo`
|
||||
|
||||
path to an image that will be displayed on the title page. The path is always relative to where pandoc is executed. The option `--resource-path` has no effect.
|
||||
|
||||
- `titlepage-background`
|
||||
|
||||
the path to a background image for the title page. The background image is scaled to cover the entire page. In the examples folder under `titlepage-background` are a few example background images.
|
||||
|
||||
- `page-background`
|
||||
|
||||
the path to a background image for any page. The background image is scaled to cover the entire page. In the examples folder under `page-background` are a few example background images.
|
||||
|
||||
- `page-background-opacity` (defaults to `0.2`)
|
||||
|
||||
the background image opacity
|
||||
|
||||
- `caption-justification` (defaults to `raggedright`)
|
||||
|
||||
justification setting for captions (uses the `justification` parameter of the [caption](https://ctan.org/pkg/caption?lang=en) package)
|
||||
|
||||
- `toc-own-page` (defaults to `false`)
|
||||
|
||||
begin new page after table of contents, when `true`
|
||||
|
||||
- `listings-disable-line-numbers` (defaults to `false`)
|
||||
|
||||
disables line numbers for all listings
|
||||
|
||||
- `listings-no-page-break` (defaults to `false`)
|
||||
|
||||
avoid page break inside listings
|
||||
|
||||
- `disable-header-and-footer` (default to `false`)
|
||||
|
||||
disables the header and footer completely on all pages
|
||||
|
||||
- `header-left` (defaults to the title)
|
||||
|
||||
the text on the left side of the header
|
||||
|
||||
- `header-center`
|
||||
|
||||
the text in the center of the header
|
||||
|
||||
- `header-right` (defaults to the date)
|
||||
|
||||
the text on the right side of the header
|
||||
|
||||
- `footer-left` (defaults to the author)
|
||||
|
||||
the text on the left side of the footer
|
||||
|
||||
- `footer-center`
|
||||
|
||||
the text in the center of the footer
|
||||
|
||||
- `footer-right` (defaults to the page number)
|
||||
|
||||
the text on the right side of the footer
|
||||
|
||||
- `footnotes-pretty` (defaults to `false`)
|
||||
|
||||
prettifies formatting of footnotes (requires package `footmisc`)
|
||||
|
||||
- `footnotes-disable-backlinks` (defaults to `false`)
|
||||
|
||||
disables making the reference from the footnote at the bottom of the page into a link back to the occurrence of the footnote in the main text (enabling requires package `footnotebackref`).
|
||||
|
||||
- `book` (defaults to `false`)
|
||||
|
||||
typeset as book
|
||||
|
||||
- `logo-width` (defaults to `35mm`)
|
||||
|
||||
the width of the logo. One needs to specify the width with a (TeX) unit e.g. `100pt` or `35mm`. The following units can be used:
|
||||
|
||||
- `pt`: Point
|
||||
- `pc`: pica (12 `pt`)
|
||||
- `in`: inch (72.27 `pt`)
|
||||
- `bp`: Big point (72 `bp` = 1 `in`)
|
||||
- `cm`: Centimeter
|
||||
- `mm`: Millimeter
|
||||
- `dd`: Didot point
|
||||
- `cc`: cicero (12 `dd`)
|
||||
- `sp`: Scaled point (65,536 `sp` = 1 `pt`)
|
||||
- `ex`: Nomimal x-height
|
||||
- `em`: Nominal m-width
|
||||
- `px`: Pixel (only for pdfTeX and LuaTeX) The dimension given to the `\pdfpxdimen` primitive; default value is 1 `bp`, corresponding to a pixel density of 72 dpi.
|
||||
|
||||
A visual overview of the length units is available at <https://github.com/tweh/tex-units>.
|
||||
|
||||
- `first-chapter` (defaults to `1`)
|
||||
|
||||
if typesetting a book with chapter numbers, specifies the number that will be assigned to the first chapter
|
||||
|
||||
- `float-placement-figure` (defaults to `H`)
|
||||
|
||||
Reset the default placement specifier for figure environments to the supplied value e.g. `htbp`. The available specifiers are listed below. The first four placement specifiers can be combined.
|
||||
|
||||
1. `h`: Place the float *here*, i.e., approximately at the same point it occurs in the source text.
|
||||
2. `t`: Place the float at the *top* of the page.
|
||||
3. `b`: Place the float at the *bottom* of the page.
|
||||
4. `p`: Place the float on the next *page* that will contain only floats like figures and tables.
|
||||
5. `H`: Place the float *HERE* (exactly where it occurs in the source text). The `H` specifier is provided by the [float package](https://ctan.org/pkg/float) and may not be used in conjunction with any other placement specifiers.
|
||||
|
||||
- `table-use-row-colors` (defaults to `false`)
|
||||
|
||||
enables row colors for tables. The default value is `false` because the coloring extends beyond the edge of the table and there is currently no way to change that.
|
||||
|
||||
- `code-block-font-size` (defaults to `\small`)
|
||||
|
||||
LaTeX command to change the font size for code blocks. The available values are `\tiny`, `\scriptsize`, `\footnotesize`, `\small`, `\normalsize`, `\large`, `\Large`, `\LARGE`, `\huge` and `\Huge`. This option will change the font size for default code blocks using the verbatim environment and for code blocks generated with listings.
|
||||
|
||||
## Required LaTeX Packages
|
||||
|
||||
LaTeX manages addons and additional functionality in so called packages. You
|
||||
might get the following error when compiling a document with the Eisvogel
|
||||
template:
|
||||
|
||||
|
||||
``` sh
|
||||
! LaTeX Error: File `footnotebackref.sty' not found.
|
||||
|
||||
Type X to quit or <RETURN> to proceed,
|
||||
or enter new name. (Default extension: sty)
|
||||
|
||||
Enter file name:
|
||||
! Emergency stop.
|
||||
<read *>
|
||||
```
|
||||
|
||||
LaTeX informs you that the additional package `footnotebackref` is required to
|
||||
render the document.
|
||||
|
||||
### Texlive
|
||||
|
||||
Eisvogel requires a full texlive distribution that can be installed by running
|
||||
`apt-get install texlive-full` in the terminal. Because `texlive-full` is very
|
||||
large (about 5 Gigabytes) you can also install the smaller texlive bundles and
|
||||
add any missing packages manually.
|
||||
|
||||
A smaller texlive bundle is `texlive-latex-extra`. With `texlive-latex-extra`
|
||||
you also need to install these packages manually:
|
||||
|
||||
```
|
||||
adjustbox babel-german background bidi collectbox csquotes everypage filehook
|
||||
footmisc footnotebackref framed fvextra letltxmacro ly1 mdframed mweights
|
||||
needspace pagecolor sourcecodepro sourcesanspro titling ucharcat ulem
|
||||
unicode-math upquote xecjk xurl zref
|
||||
```
|
||||
|
||||
Install them with the following command:
|
||||
|
||||
``` sh
|
||||
tlmgr install soul adjustbox babel-german background bidi collectbox csquotes everypage filehook footmisc footnotebackref framed fvextra letltxmacro ly1 mdframed mweights needspace pagecolor sourcecodepro sourcesanspro titling ucharcat ulem unicode-math upquote xecjk xurl zref
|
||||
```
|
||||
|
||||
Additional information about the different texlive packages can be found at
|
||||
this TeX-StackExchange answer: <https://tex.stackexchange.com/a/504566>
|
||||
|
||||
### MiKTeX
|
||||
|
||||
If you don't want to install all missing packages manually, [MiKTeX might be
|
||||
an alternative](https://miktex.org/howto/miktex-console).
|
||||
|
||||
> MiKTeX has the ability to automatically install missing packages.
|
||||
> You can turn this feature on or off. And you can let MiKTeX ask you each time a package has to be installed:
|
||||
>
|
||||
> - Click `Settings` to navigate to the settings page.
|
||||
> - Click the `General` tab.
|
||||
> - Click one of the radio buttons:
|
||||
> - `Ask me`
|
||||
> - `Always install missing packages on-the-fly`
|
||||
> - `Never install missing packages on-the-fly`
|
||||
|
||||
## Examples
|
||||
|
||||
### Numbered Sections
|
||||
|
||||
For PDFs with [numbered sections](http://pandoc.org/MANUAL.html#options-affecting-specific-writers) use the `--number-sections` or `-N` option.
|
||||
|
||||
``` bash
|
||||
pandoc example.md -o example.pdf --template eisvogel --number-sections
|
||||
```
|
||||
|
||||
### Syntax Highlighting with Listings
|
||||
|
||||
You can get syntax highlighting of delimited code blocks by using the LaTeX package listings with the option `--listings`. This example will produce the same syntax highlighting as in the example PDF.
|
||||
|
||||
``` bash
|
||||
pandoc example.md -o example.pdf --template eisvogel --listings
|
||||
```
|
||||
|
||||
### Syntax Highlighting Without Listings
|
||||
|
||||
The following examples show [syntax highlighting of delimited code blocks](http://pandoc.org/MANUAL.html#syntax-highlighting) without using listings. To see a list of all the supported highlight styles, type `pandoc --list-highlight-styles`.
|
||||
|
||||
``` bash
|
||||
pandoc example.md -o example.pdf --template eisvogel --highlight-style pygments
|
||||
```
|
||||
|
||||
``` bash
|
||||
pandoc example.md -o example.pdf --template eisvogel --highlight-style kate
|
||||
```
|
||||
|
||||
``` bash
|
||||
pandoc example.md -o example.pdf --template eisvogel --highlight-style espresso
|
||||
```
|
||||
|
||||
``` bash
|
||||
pandoc example.md -o example.pdf --template eisvogel --highlight-style tango
|
||||
```
|
||||
|
||||
### Standalone LaTeX Document
|
||||
|
||||
To produce a standalone LaTeX document for compiling with any LaTeX editor use `.tex` as an output file extension.
|
||||
|
||||
``` bash
|
||||
pandoc example.md -o example.tex --template eisvogel
|
||||
```
|
||||
|
||||
### Changing the Document Language
|
||||
|
||||
The default language of this template is American English. The `lang` variable identifies the main language of the document, using a code according to [BCP 47](https://tools.ietf.org/html/bcp47) (e.g. `en` or `en-GB`). For an incomplete list of the supported language codes see [the documentation for the hyph-utf8 package (Section 2)](http://mirrors.ctan.org/language/hyph-utf8/doc/generic/hyph-utf8/hyph-utf8.pdf). The following example changes the language to British English:
|
||||
|
||||
``` bash
|
||||
pandoc example.md -o example.pdf --template eisvogel -V lang=en-GB
|
||||
```
|
||||
|
||||
The following example changes the language to German:
|
||||
|
||||
``` bash
|
||||
pandoc example.md -o example.pdf --template eisvogel -V lang=de
|
||||
```
|
||||
|
||||
### Typesetting a Book
|
||||
|
||||
To typeset a book supply the template variable `-V book` from the command line or via `book: true` in the metadata.
|
||||
|
||||
To get the correct chapter headings you need to tell pandoc that it should convert first level headings (indicated by one `#` in markdown) to chapters with the command line option `--top-level-division=chapter`. Chapter numbers start at 1. If you need to change that, specify `first-chapter` in the template variables.
|
||||
|
||||
There will be one blank page before each chapter because the template is two-sided per default. So if you plan to publish your book as a PDF and don’t need a blank page you should add the class option `onesided` which can be done by supplying a template variable `-V classoption=oneside`.
|
||||
|
||||
### Example Images
|
||||
|
||||
| A green title page | A background image on the title page |
|
||||
| :----------------: | :----------------: |
|
||||
| [](examples/title-page-green/document.pdf) | [](examples/title-page-background/document.pdf) |
|
||||
|
||||
| images and tables | Code blocks styled without listings |
|
||||
| :---------------: | :---------------: |
|
||||
| [](examples/images-and-tables/document.pdf) | [](examples/code-blocks-without-listings/document.pdf) |
|
||||
|
||||
| A book | Code blocks styled with listings |
|
||||
| :----: | :----: |
|
||||
| [](examples/book/document.pdf) | [](examples/code-blocks-listings/document.pdf) |
|
||||
|
||||
| A background images on all pages | CJK Support (when using XeLaTeX) |
|
||||
| :----: | :----: |
|
||||
| [](examples/page-background/document.pdf) | [](examples/language-japanese/document.pdf) |
|
||||
|
||||
## Common Errors / Issues
|
||||
|
||||
The following section lists common errors and their solutions when using the
|
||||
Eisvogel template.
|
||||
|
||||
### LaTeX Errors `Missing endcsname inserted` or `File x not found` when using `titlepage-background`, `logo`, or `titlepage-logo`.
|
||||
|
||||
``` latex
|
||||
Error producing PDF.
|
||||
! Missing endcsname inserted.
|
||||
<to be read again>
|
||||
protect
|
||||
```
|
||||
|
||||
``` latex
|
||||
Error producing PDF.
|
||||
! Package pdftex.def Error: File `logo\T1\textunderscoreimage.pdf' not fou
|
||||
nd: using draft setting.
|
||||
|
||||
See the pdftex.def package documentation for explanation.
|
||||
Type H <return> for immediate help.
|
||||
```
|
||||
|
||||
These errors occur when one includes a background image on the title page or a
|
||||
logo that has an underscore (`_`) in the filename.
|
||||
|
||||
A quick fix would be to replace all underscores in the filename of the image
|
||||
with a hyphen (`-`). If the background image is specified in your YAML front
|
||||
matter like so,
|
||||
|
||||
``` yaml
|
||||
titlepage-background: "background_image.pdf"
|
||||
```
|
||||
|
||||
you can advise pandoc to interpret this as LaTeX and include it in the document
|
||||
without parsing.
|
||||
|
||||
``` yaml
|
||||
titlepage-background: "`background_image.pdf`{=latex}"
|
||||
```
|
||||
|
||||
The same fix can be used for the logo image as well:
|
||||
|
||||
``` yaml
|
||||
logo: "`logo_image.pdf`{=latex}"
|
||||
```
|
||||
|
||||
Corresponding issues:
|
||||
|
||||
- [Wandmalfarbe/pandoc-latex-template#100](https://github.com/Wandmalfarbe/pandoc-latex-template/issues/100)
|
||||
- [Wandmalfarbe/pandoc-latex-template#166](https://github.com/Wandmalfarbe/pandoc-latex-template/issues/166)
|
||||
|
||||
### LaTeX Error `Missing \begin{document}`
|
||||
|
||||
```
|
||||
! LaTeX Error: Missing \begin{document}.
|
||||
|
||||
See the LaTeX manual or LaTeX Companion for explanation.
|
||||
Type H <return> for immediate help.
|
||||
...
|
||||
|
||||
l.7 <
|
||||
!DOCTYPE html>
|
||||
! ==> Fatal error occurred, no output PDF file produced!
|
||||
```
|
||||
|
||||
This error indicates that you try to use some text file for conversion that is
|
||||
not the Eisvogel template. Please download the [latest Eisvogel template](https://github.com/Wandmalfarbe/pandoc-latex-template/releases/latest) from the releases page and start the conversion again.
|
||||
|
||||
### LaTeX Error `auto expansion is only possible with scalable fonts`
|
||||
|
||||
``` latex
|
||||
Error producing PDF.
|
||||
! pdfTeX error (font expansion): auto expansion is only possible with scalable
|
||||
fonts.
|
||||
\AtBegShi@Output ...ipout \box \AtBeginShipoutBox
|
||||
\fi \fi
|
||||
l.643 \begin{lstlisting}
|
||||
```
|
||||
|
||||
This error likely occurs on Windows with MiKTeX installed. StackOverflow user
|
||||
[Krebto provided the following fix](https://tex.stackexchange.com/a/392467):
|
||||
|
||||
> To solve the problem navigate to `C:\Program Files\MiKTeX 2.9\miktex\bin\x64` and run `updmap.exe`. The program may seem as it hangs for a while, but its probably because it tries to update the whole font tree. This solved the problem for me. After re-compiling everything should work fine.
|
||||
|
||||
Corresponding issue:
|
||||
|
||||
- [Wandmalfarbe/pandoc-latex-template#133](https://github.com/Wandmalfarbe/pandoc-latex-template/issues/133)
|
||||
|
||||
### LaTeX Error `cannot find image file`
|
||||
|
||||
``` latex
|
||||
Error producing PDF.
|
||||
! error: (file "/tmp/tex2pdf.-be734e802ef6d0c3/""fdcfc29edcf252186f1b0a52f18f50
|
||||
43abaeb2d0".png) (pdf backend): cannot find image file '"/tmp/tex2pdf.-be734e802
|
||||
ef6d0c3/""fdcfc29edcf252186f1b0a52f18f5043abaeb2d0".png'
|
||||
! ==> Fatal error occurred, no output PDF file produced!
|
||||
```
|
||||
|
||||
In general this error means that LaTeX is unable to find the included image
|
||||
file. Please check all image references and file names for correctness.
|
||||
|
||||
This error also occurs if you use an old version of Eisvogel with the package
|
||||
`grffile` and have an old LaTeX distribution installed. Please update Eisvogel
|
||||
and your LaTeX distribution.
|
||||
|
||||
Corresponding issues:
|
||||
|
||||
- [jgm/pandoc#5848](https://github.com/jgm/pandoc/issues/5848)
|
||||
- [Wandmalfarbe/pandoc-latex-template#149](https://github.com/Wandmalfarbe/pandoc-latex-template/issues/149)
|
||||
|
||||
## Credits
|
||||
|
||||
- This template includes code for styling block quotations from [pandoc-letter](https://github.com/aaronwolen/pandoc-letter) by [Aaron Wolen](https://github.com/aaronwolen).
|
||||
|
||||
## License
|
||||
|
||||
This project is open source licensed under the BSD 3-Clause License. Please see the [LICENSE file](LICENSE) for more information.
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user