chore: update latest, add achievements field in work_experience

This commit is contained in:
Jesús Pérez 2024-08-24 23:03:16 +01:00
parent a57fca397d
commit 8d00a051aa
No known key found for this signature in database
3 changed files with 136 additions and 134 deletions

78
core.go
View File

@ -11,7 +11,7 @@ type ProfileType struct {
Desc string `yaml:"desc" json:"desc"`
}
type CoreProfile struct {
CoreProfile []ProfileType `yaml:"profile" json:"profile"`
CoreProfile []ProfileType `yaml:"profile" json:"profile"`
}
type SkillsType struct {
Id string `yaml:"id" json:"id"`
@ -41,7 +41,7 @@ type SitesType struct {
Img string `yaml:"img" json:"img"`
}
type Sites struct {
Sites []SitesType `yaml:"sites" json:"sites"`
Sites []SitesType `yaml:"sites" json:"sites"`
}
type LangsType struct {
Id string `yaml:"id" json:"id"`
@ -49,7 +49,7 @@ type LangsType struct {
Mode string `yaml:"mode" json:"mode"`
}
type Langs struct {
Langs []LangsType `yaml:"langs" json:"langs"`
Langs []LangsType `yaml:"langs" json:"langs"`
}
type MissionHowType struct {
Auth AuthInfoType `yaml:"auth" json:"auth"`
@ -57,43 +57,43 @@ type MissionHowType struct {
}
type DataCoreType struct {
Name string `yaml:"name" json:"name"`
Fullname string `yaml:"fullname" json:"fullname"`
Title1 string `yaml:"title1" json:"title1"`
Title2 string `yaml:"title2" json:"title2"`
Imgalt string `yaml:"imgalt" json:"imgalt"`
Imgsrc string `yaml:"imgsrc" json:"imgsrc"`
Email string `yaml:"email" json:"email"`
Phone string `yaml:"phone" json:"phone"`
Address string `yaml:"address" json:"address"`
Postalcode string `yaml:"postalcode" json:"postalcode"`
State string `yaml:"state" json:"state"`
City string `yaml:"city" json:"city"`
Country string `yaml:"country" json:"country"`
Birthdate string `yaml:"birthdate" json:"birthdate"`
Status string `yaml:"status" json:"status"`
Mission string `yaml:"mission" json:"mission"`
Mission_how []MissionHowType `yaml:"mission_how" json:"mission_how"`
Fullname string `yaml:"fullname" json:"fullname"`
Title1 string `yaml:"title1" json:"title1"`
Title2 string `yaml:"title2" json:"title2"`
Imgalt string `yaml:"imgalt" json:"imgalt"`
Imgsrc string `yaml:"imgsrc" json:"imgsrc"`
Email string `yaml:"email" json:"email"`
Phone string `yaml:"phone" json:"phone"`
Address string `yaml:"address" json:"address"`
Postalcode string `yaml:"postalcode" json:"postalcode"`
State string `yaml:"state" json:"state"`
City string `yaml:"city" json:"city"`
Country string `yaml:"country" json:"country"`
Birthdate string `yaml:"birthdate" json:"birthdate"`
Status string `yaml:"status" json:"status"`
Mission string `yaml:"mission" json:"mission"`
Mission_how []MissionHowType `yaml:"mission_how" json:"mission_how"`
Profile []ProfileType `yaml:"profile" json:"profile"`
Certifications []CertificationType `yaml:"certifications" json:"certifications"`
Skills []SkillsType `yaml:"skills" json:"skills"`
SoftSkills []SkillsType `yaml:"soft_skills" json:"soft_skills"`
Infra []SkillsType `yaml:"infra" json:"infra"`
Sites []SitesType `yaml:"sites" json:"sites"`
Langs []LangsType `yaml:"langs" json:"langs"`
Skills []SkillsType `yaml:"skills" json:"skills"`
SoftSkills []SkillsType `yaml:"soft_skills" json:"soft_skills"`
Infra []SkillsType `yaml:"infra" json:"infra"`
Sites []SitesType `yaml:"sites" json:"sites"`
Langs []LangsType `yaml:"langs" json:"langs"`
}
type DataCore struct {
Core DataCoreType `yaml:"core" json:"core"`
}
type DataLangCoreType struct {
Title1 string `yaml:"title1" json:"title1"`
Title2 string `yaml:"title2" json:"title2"`
Imgalt string `yaml:"imgalt" json:"imgalt"`
State string `yaml:"state" json:"state"`
City string `yaml:"city" json:"city"`
Country string `yaml:"country" json:"country"`
Status string `yaml:"status" json:"status"`
Mission string `yaml:"mission" json:"mission"`
Mission_how []MissionHowType `yaml:"mission_how" json:"mission_how"`
Title1 string `yaml:"title1" json:"title1"`
Title2 string `yaml:"title2" json:"title2"`
Imgalt string `yaml:"imgalt" json:"imgalt"`
State string `yaml:"state" json:"state"`
City string `yaml:"city" json:"city"`
Country string `yaml:"country" json:"country"`
Status string `yaml:"status" json:"status"`
Mission string `yaml:"mission" json:"mission"`
Mission_how []MissionHowType `yaml:"mission_how" json:"mission_how"`
Profile []ProfileType `yaml:"profile" json:"profile"`
Certifications []CertificationType `yaml:"certifications" json:"certifications"`
}
@ -107,10 +107,10 @@ func (profileData *CoreProfile)Load(path string) ([]ProfileType, error) {
}
defer file.Close()
if err := d.Decode(&profileData); err != nil {
fmt.Printf("Decode: %v", err)
fmt.Printf("Decode: %v", err)
return profileData.CoreProfile, err
}
return profileData.CoreProfile, nil
return profileData.CoreProfile, nil
}
func (datacore *DataCore)Load(path string) (DataCoreType, error) {
d,file,errpath := utils.DecoderFromFile(path)
@ -119,10 +119,10 @@ func (datacore *DataCore)Load(path string) (DataCoreType, error) {
}
defer file.Close()
if err := d.Decode(&datacore); err != nil {
fmt.Printf("Decode: %v", err)
fmt.Printf("Decode: %v", err)
return datacore.Core, err
}
return datacore.Core, nil
return datacore.Core, nil
}
func(datalangcore *DataLangCore)Load(path string) (DataLangCoreType, error) {
d,file,errpath := utils.DecoderFromFile(path)
@ -131,8 +131,8 @@ func(datalangcore *DataLangCore)Load(path string) (DataLangCoreType, error) {
}
defer file.Close()
if err := d.Decode(&datalangcore); err != nil {
fmt.Printf("Decode: %v", err)
fmt.Printf("Decode: %v", err)
return datalangcore.Core, err
}
return datalangcore.Core, nil
return datalangcore.Core, nil
}

170
cv.go
View File

@ -74,33 +74,33 @@ type ShowInfoType struct {
Auth AuthInfoType `yaml:"auth" json:"auth"`
Fullname bool `yaml:"fullname" json:"fullname"`
Personal bool `yaml:"personal" json:"personal"`
Title bool `yaml:"title" json:"title"`
Image bool `yaml:"image" json:"image"`
Mission bool `yaml:"mission" json:"mission"`
Mission_how bool `yaml:"mission_how" json:"mission_how"`
Phone bool `yaml:"phone" json:"phone"`
Address bool `yaml:"address" json:"address"`
Status bool `yaml:"status" json:"status"`
Birthdate bool `yaml:"birthday" json:"birthdate"`
Sites bool `yaml:"sites" json:"sites"`
Skills bool `yaml:"skills" json:"skills"`
Skills_itms bool `yaml:"skills_itms" json:"skills_itms"`
Soft_Skills bool `yaml:"soft_skills" json:"soft_skills"`
Soft_Skills_itms bool `yaml:"soft_skills_itms" json:"soft_skills_itms"`
Infra bool `yaml:"infra" json:"infra"`
Certs bool `yaml:"certs" json:"certs"`
Langs bool `yaml:"langs" json:"langs"`
Title bool `yaml:"title" json:"title"`
Image bool `yaml:"image" json:"image"`
Mission bool `yaml:"mission" json:"mission"`
Mission_how bool `yaml:"mission_how" json:"mission_how"`
Phone bool `yaml:"phone" json:"phone"`
Address bool `yaml:"address" json:"address"`
Status bool `yaml:"status" json:"status"`
Birthdate bool `yaml:"birthday" json:"birthdate"`
Sites bool `yaml:"sites" json:"sites"`
Skills bool `yaml:"skills" json:"skills"`
Skills_itms bool `yaml:"skills_itms" json:"skills_itms"`
Soft_Skills bool `yaml:"soft_skills" json:"soft_skills"`
Soft_Skills_itms bool `yaml:"soft_skills_itms" json:"soft_skills_itms"`
Infra bool `yaml:"infra" json:"infra"`
Certs bool `yaml:"certs" json:"certs"`
Langs bool `yaml:"langs" json:"langs"`
Profile bool `yaml:"profile" json:"profile"`
Work_experience_itms bool `yaml:"work_experience_itms" json:"work_experience_itms"`
Work_experience ShowWorkExperienceType `yaml:"work_experience" json:"work_experience"`
Projects_itms bool `yaml:"projects_itms" json:"projects_itms"`
Projects ShowProjectType `yaml:"projects" json:"projects"`
Education_itms bool `yaml:"education_itms" json:"education_itms"`
Education ShowEducationType `yaml:"education" json:"education"`
Education ShowEducationType `yaml:"education" json:"education"`
Talks_itms bool `yaml:"talks_itms" json:"talks_itms"`
Talks ShowTalksType `yaml:"talks" json:"talks"`
Talks ShowTalksType `yaml:"talks" json:"talks"`
Teaching_itms bool `yaml:"teaching_itms" json:"teaching_itms"`
Teaching ShowTeachingType `yaml:"teaching" json:"teaching"`
Teaching ShowTeachingType `yaml:"teaching" json:"teaching"`
Others_itms bool `yaml:"others_itms" json:"others_itms"`
Others bool `yaml:"others" json:"others"`
}
@ -110,7 +110,7 @@ type ModelType struct {
Path string `yaml:"path" json:"path"`
}
type Models struct {
Models []ModelType `yaml:"models" json:"models"`
Models []ModelType `yaml:"models" json:"models"`
}
type CVData struct {
Models []ModelType `yaml:"models" json:"models"`
@ -119,10 +119,10 @@ type CVData struct {
CoreLang DataLangCoreType `yaml:"corelang" json:"corelang"`
Projects []ProjectType `yaml:"projects" json:"projects"`
Work_experience []WorkExperienceType `yaml:"work_experience" json:"work_experience"`
Education []EducationType `yaml:"education" json:"education"`
Talks []TalksType `yaml:"talks" json:"talks" json:""`
Teaching []TeachingType `yaml:"teaching" json:"teaching"`
Others []OtherType `yaml:"others" json:"others"`
Education []EducationType `yaml:"education" json:"education"`
Talks []TalksType `yaml:"talks" json:"talks" json:""`
Teaching []TeachingType `yaml:"teaching" json:"teaching"`
Others []OtherType `yaml:"others" json:"others"`
}
type CVLangData map[string]CVData
// struct {
@ -135,8 +135,8 @@ type CVModelData map[string]CVLangData
// Data CVLangData `yaml:"data" json:"data"`
// }
type DataCVgen struct {
Data CVLangData `yaml:"data" json:"data"`
Models []ModelType `yaml:"models" json:"models"`
Data CVLangData `yaml:"data" json:"data"`
Models []ModelType `yaml:"models" json:"models"`
}
type CVPostData struct {
U string `yaml:"u" json:"u"`
@ -149,27 +149,27 @@ func (models *Models)Load(path string) ([]ModelType, error) {
}
defer file.Close()
if err := d.Decode(&models); err != nil {
fmt.Printf("Decode: %v\n", err)
fmt.Printf("Decode: %v\n", err)
return models.Models, err
}
return models.Models, nil
return models.Models, nil
}
func (cvdata *CVData)Load(root_path string, lang string, config *cfg.Config) error {
//err := *new(error)
var err error
for _,itm := range config.DataItems {
itmpath := fmt.Sprintf("%s/%s.yaml",root_path,itm)
itmpath := fmt.Sprintf("%s/%s.yaml",root_path,itm)
if itm == "showinfo" {
itmpath = fmt.Sprintf("%s/%s",root_path,itm)
}
}
if !utils.ExistsPath(itmpath) {
continue
}
switch itm {
case "showinfo":
case "showinfo":
cvdata.Showinfo, err = loadShowData(itmpath)
case "core":
case "core":
if lang == "" {
var datacore DataCore
cvdata.Core, err = datacore.Load(itmpath)
@ -177,36 +177,36 @@ func (cvdata *CVData)Load(root_path string, lang string, config *cfg.Config) err
var datalangcore DataLangCore
cvdata.CoreLang, err = datalangcore.Load(itmpath)
}
case "profile":
case "profile":
var profile CoreProfile
cvdata.Core.Profile, err = profile.Load(itmpath)
case "projects":
var projects Projects
cvdata.Core.Profile, err = profile.Load(itmpath)
case "projects":
var projects Projects
cvdata.Projects, err = projects.Load(itmpath)
case "work_experience":
case "work_experience":
var work_experience WorkExperience
cvdata.Work_experience, err = work_experience.Load(itmpath)
case "education":
cvdata.Work_experience, err = work_experience.Load(itmpath)
case "education":
var education Education
cvdata.Education, err = education.Load(itmpath)
case "teaching":
cvdata.Education, err = education.Load(itmpath)
case "teaching":
var teaching Teaching
cvdata.Teaching, err = teaching.Load(itmpath)
case "talks":
cvdata.Teaching, err = teaching.Load(itmpath)
var talks Talks
cvdata.Talks, err = talks.Load(itmpath)
case "others":
cvdata.Talks, err = talks.Load(itmpath)
case "others":
var others Others
cvdata.Others, err = others.Load(itmpath)
case "models":
cvdata.Others, err = others.Load(itmpath)
case "models":
var models Models
cvdata.Models, err = models.Load(itmpath)
cvdata.Models, err = models.Load(itmpath)
default:
fmt.Printf("cvdata: %s not implemented yet\n",itm)
continue
}
if err != nil && lang == "" {
fmt.Printf("Error load cv %s: %v\n", itm, err)
fmt.Printf("Error load cv %s: %v\n", itm, err)
}
}
return nil
@ -216,7 +216,7 @@ func (cvdata *CVData)Write(ky string, path string, config *cfg.Config) error {
var data []byte
var err error
switch itm {
case "showinfo":
case "showinfo":
if cvdata.Showinfo == nil {
continue
}
@ -236,7 +236,7 @@ func (cvdata *CVData)Write(ky string, path string, config *cfg.Config) error {
}
}
continue
case "core":
case "core":
if ky == "main" {
if len(cvdata.Core.Title1) > 0 {
var coredata DataCore
@ -250,7 +250,7 @@ func (cvdata *CVData)Write(ky string, path string, config *cfg.Config) error {
data, err = yaml.Marshal(corelangdata)
}
}
case "profile":
case "profile":
if ky == "main" {
if cvdata.Core.Profile != nil {
var profiledata CoreProfile
@ -264,49 +264,49 @@ func (cvdata *CVData)Write(ky string, path string, config *cfg.Config) error {
data, err = yaml.Marshal(profiledata)
}
}
case "projects":
case "projects":
if cvdata.Projects == nil {
continue
}
var projectsdata Projects
projectsdata.Projects = cvdata.Projects
data, err = yaml.Marshal(projectsdata)
case "work_experience":
case "work_experience":
if cvdata.Work_experience == nil {
}
var experience WorkExperience
experience.WorkExperience = cvdata.Work_experience
data, err = yaml.Marshal(experience)
case "education":
case "education":
if cvdata.Education == nil {
continue
}
var educationdata Education
educationdata.Education = cvdata.Education
data, err = yaml.Marshal(educationdata)
case "teaching":
case "teaching":
if cvdata.Teaching == nil {
continue
}
var teachingdata Teaching
teachingdata.Teaching = cvdata.Teaching
data, err = yaml.Marshal(teachingdata)
case "talks":
case "talks":
if cvdata.Talks == nil {
continue
}
var talksdata Talks
talksdata.Talks = cvdata.Talks
data, err = yaml.Marshal(talksdata)
case "others":
case "others":
if cvdata.Others == nil {
continue
}
var othersdata Others
othersdata.Others = cvdata.Others
data, err = yaml.Marshal(othersdata)
case "models":
if cvdata.Models == nil {
case "models":
if cvdata.Models == nil {
continue
}
var modelsdata Models
@ -320,10 +320,10 @@ func (cvdata *CVData)Write(ky string, path string, config *cfg.Config) error {
continue
}
if err != nil {
fmt.Printf("Error Parse cv %s: %v\n", itm, err)
fmt.Printf("Error Parse cv %s: %v\n", itm, err)
} else {
if res := utils.WriteData(string(data),fmt.Sprintf("%s/%s.yaml",path,itm)) ; res != nil {
fmt.Printf("Error write cv %s: %v\n", itm, err)
if res := utils.WriteData(string(data),fmt.Sprintf("%s/%s.yaml",path,itm)) ; res != nil {
fmt.Printf("Error write cv %s: %v\n", itm, err)
// } else if config.UseRepo && config.RepoPath != "" {
// pathfile :=fmt.Sprintf("%s/%s.yaml",strings.Replace(path,fmt.Sprintf("%s/",config.DataPath),"",1),itm)
// if errgit := gitCommit(config.RepoPath, pathfile, fmt.Sprintf("'%s'",config.RepoCommit),config.RepoName,config.RepoAuthName, config.RepoAuthEmail, time.Now()); errgit != nil {
@ -343,16 +343,16 @@ func (cvmodel CVModelData)Write(config *cfg.Config) ([]string,error) {
path := fmt.Sprintf("%s/%s",root_path,key)
//fmt.Printf("path: %+v\n", path)
if err := utils.CheckDirPath(path) ; err != nil {
fmt.Printf("Error create %s: %v\n",path, err)
fmt.Printf("Error create %s: %v\n",path, err)
return keys, err
}
langpath := fmt.Sprintf("%s/langs",path)
if err := utils.CheckDirPath(langpath) ; err != nil {
fmt.Printf("Error create %s: %v\n",langpath, err)
fmt.Printf("Error create %s: %v\n",langpath, err)
return keys,err
}
for kylng,cvdata := range mdl {
keys = append(keys,kylng)
for kylng,cvdata := range mdl {
keys = append(keys,kylng)
if kylng == "main" {
if res := cvdata.Write(kylng,path,config) ; res != nil {
fmt.Printf("Error write %s: %v\n",path, res)
@ -392,7 +392,7 @@ func (cvmodel CVModelData)Write(config *cfg.Config) ([]string,error) {
if cmd,_,errgit = utils.GitCommit(config.RepoPath,key,config.RepoCommit,config.RepoName,config.BackgGit,config.QuietGit); errgit != nil {
fmt.Printf("Error git commit cv %s: %v\n", config.RepoPath, errgit)
}
if errgit == nil && config.BackgGit {
if errgit == nil && config.BackgGit {
if errgit = cmd.Wait(); errgit != nil {
fmt.Printf("Error pull %s (%s): %v\n", config.RepoPath, config.RepoName,errgit)
}
@ -409,39 +409,39 @@ func loadShowInfoItem(path string) (ShowInfoType, error) {
}
defer file.Close()
if err := d.Decode(&showinfo); err != nil {
fmt.Printf("Decode: %v", err)
fmt.Printf("Decode: %v", err)
return ShowInfoType{},err
}
return showinfo[0], nil
return showinfo[0], nil
}
func loadShowData(path string) ([]ShowInfoType, error) {
var showData []ShowInfoType
files, err := filepath.Glob(fmt.Sprintf("%s/*.yaml",path))
if err != nil {
fmt.Printf("showinfo: %v", err)
files, err := filepath.Glob(fmt.Sprintf("%s/*.yaml",path))
if err != nil {
fmt.Printf("showinfo: %v", err)
return showData,err
}
for _, file := range files {
}
for _, file := range files {
data,err := loadShowInfoItem(file)
if err == nil {
showData = append(showData,data)
showData = append(showData,data)
}
// fmt.Println(file)
}
}
return showData,nil
}
func LoadCVData(root_path string, config *cfg.Config, useRepo bool) (DataCVgen, error) {
var errgit error
var cmd *exec.Cmd
if useRepo && config.UseRepo && config.RepoPath != "" {
if useRepo && config.UseRepo && config.RepoPath != "" {
if cmd,errgit = utils.GitPull(config.RepoPath,config.RepoName,config.BackgGit,config.QuietGit); errgit != nil {
fmt.Printf("Error pull %s (%s): %v\n", config.RepoPath, config.RepoName,errgit)
}
fmt.Printf("Error pull %s (%s): %v\n", config.RepoPath, config.RepoName,errgit)
}
}
var datacvgen DataCVgen
cvlangdata := make(map[string]CVData,2)
var data CVData
var models Models
var data CVData
var models Models
mdls, _ := models.Load(fmt.Sprintf("%s/%s",config.DataPath,config.DataModelsRoot))
datacvgen.Models = mdls
if err := data.Load(root_path,"",config); err == nil {
@ -457,10 +457,10 @@ func LoadCVData(root_path string, config *cfg.Config, useRepo bool) (DataCVgen,
}
}
datacvgen.Data = cvlangdata
if useRepo && config.UseRepo && config.RepoPath != "" && errgit == nil && config.BackgGit {
fmt.Printf("End pull %s (%s)\n", config.RepoPath, config.RepoName)
if useRepo && config.UseRepo && config.RepoPath != "" && errgit == nil && config.BackgGit {
fmt.Printf("End pull %s (%s)\n", config.RepoPath, config.RepoName)
if errgit = cmd.Wait(); errgit != nil {
fmt.Printf("Error pull %s (%s): %v\n", config.RepoPath, config.RepoName,errgit)
fmt.Printf("Error pull %s (%s): %v\n", config.RepoPath, config.RepoName,errgit)
}
}
return datacvgen, nil

View File

@ -9,16 +9,17 @@ import (
type WorkExperienceType struct {
Auth AuthInfoType `yaml:"auth" json:"auth"`
Date string `yaml:"date" json:"date"`
Where string `yaml:"where" json:"where"`
Wheredef string `yaml:"wheredef" json:"wheredef"`
Location string `yaml:"location" json:"location"`
Position string `yaml:"position" json:"position"`
Description string `yaml:"description" json:"description"`
Tools []string `yaml:"tools" json:"tools"`
Tasks []string `yaml:"tasks" json:"tasks"`
Where string `yaml:"where" json:"where"`
Wheredef string `yaml:"wheredef" json:"wheredef"`
Location string `yaml:"location" json:"location"`
Position string `yaml:"position" json:"position"`
Description string `yaml:"description" json:"description"`
Tools []string `yaml:"tools" json:"tools"`
Achievements []string `yaml:"achievements" json:"achievements"`
Tasks []string `yaml:"tasks" json:"tasks"`
}
type WorkExperience struct {
WorkExperience []WorkExperienceType `yaml:"work_experience" json:"work_experience"`
WorkExperience []WorkExperienceType `yaml:"work_experience" json:"work_experience"`
}
type ShowWorkExperienceType struct {
Auth AuthInfoType `yaml:"auth" json:"auth"`
@ -29,6 +30,7 @@ type ShowWorkExperienceType struct {
Position bool `yaml:"position" json:"position"`
Description bool `yaml:"description" json:"description"`
Tools bool `yaml:"tools" json:"tools"`
Achievements bool `yaml:"achievements" json:"achievements"`
Tasks bool `yaml:"tasks" json:"tasks"`
}
func (experience *WorkExperience)Load(path string) ([]WorkExperienceType, error) {
@ -38,8 +40,8 @@ func (experience *WorkExperience)Load(path string) ([]WorkExperienceType, error)
}
defer file.Close()
if err := d.Decode(&experience); err != nil {
fmt.Printf("Decode: %v", err)
fmt.Printf("Decode: %v", err)
return experience.WorkExperience, err
}
return experience.WorkExperience, nil
return experience.WorkExperience, nil
}