diff --git a/README.md b/README.md index d5be884..bdbb2f1 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,10 @@ Live example at: https://coolapso.sh * **version:** Shows the website version * Disabled by default * only enabled if provided a version parameter +* Less, print commands output with less + * Global, all commands use less instead of standard output + * Per command, only defined commands use less as output method + * `less `, will output using less instead of standard output * Command auto completion * progression bars can be interrupted by pressing `ctrl+d` * Favicons diff --git a/exampleSite/config.yml b/exampleSite/config.yml index a8904a6..26f856a 100644 --- a/exampleSite/config.yml +++ b/exampleSite/config.yml @@ -11,8 +11,9 @@ params: # promptSimbolsColor: grey # startxLocation: https://example.com # hideSocialName: true -# exitLocation: 'about:blank' -# hidesource: true +# useLess: true + exitLocation: 'about:blank' + source: true greeting: | Welcome to my online resume @@ -21,6 +22,9 @@ params: whois: + # settings: + # useLess: true + details: name: "John Doe" profession: "Unknown" location: "Somewhere" @@ -30,113 +34,133 @@ params: Here you can write something catchy about yourself social: - ## IF you want to keep them aligned just add spaces - - name: "github" - url: " https://github.com" - - name: "facebook" - url: " https://facebook.com" - - name: "myspace" - url: " https://myspace.com" - - name: "hi5" - url: " https://www.hi5.com" - - name: "instagram" - url: " https://instagram.com" - - name: "Another social" - url: " https://anothersocial.com" + # settings: + # useLess: true + details: + ## IF you want to keep them aligned just add spaces + - name: "github" + url: " https://github.com" + - name: "facebook" + url: " https://facebook.com" + - name: "myspace" + url: " https://myspace.com" + - name: "hi5" + url: " https://www.hi5.com" + - name: "instagram" + url: " https://instagram.com" + - name: "Another social" + url: " https://anothersocial.com" work: - - jobTitle: Job With Red Title - color: red - company: '-' - location: somewhere - date: August 2010 - Present - description: Some description about this red title job - - - jobTitle: Job with purple title - color: purple - company: '-' - location: somewhere elese - date: July 2000 - July 2010 - description: Some description about this purple job - - - jobTitle: Job with default color title - company: '-' - location: anywhere - date: July 2008 - 2010 - description: Description about this default color job - - education: - - courseName: Red Color training - color: red - date: June 2019 - July 2019 - description: Descrption about red color trianing - - - courseName: Default color training - date: Sept 2004 - Jun 2008 - #description: There is no need for description + # settings: + # useLess: true + details: + - jobTitle: Job With Red Title + color: red + company: '-' + location: somewhere + date: August 2010 - Present + description: Some description about this red title job + + - jobTitle: Job with purple title + color: purple + company: '-' + location: somewhere elese + date: July 2000 - July 2010 + description: Some description about this purple job + + - jobTitle: Job with default color title + company: '-' + location: anywhere + date: July 2008 - 2010 + description: Description about this default color job + + education: + - courseName: Red Color training + color: red + date: June 2019 - July 2019 + description: Descrption about red color trianing + + - courseName: Default color training + date: Sept 2004 - Jun 2008 + #description: There is no need for description skills: - - name: Skill 1 - percentage: 90 - Description: you can add a description - - - name: Skill 2 - percentage: 30 - #description: or you can leave it comented - - - name: Skill 3 - color: blue - percentage: 50 - description: Skill names can have colors too - - softskills: - - name: SoftSkill 1 - color: red - percentage: 80 - #description: - - - name: SoftSkill 2 - #color: - percentage: 90 - description: Description + settings: + useLess: true + details: + - name: Skill 1 + percentage: 90 + Description: you can add a description + + - name: Skill 2 + percentage: 30 + #description: or you can leave it comented + + - name: Skill 3 + color: blue + percentage: 50 + description: Skill names can have colors too + + softskills: + - name: SoftSkill 1 + color: red + percentage: 80 + #description: + + - name: SoftSkill 2 + #color: + percentage: 90 + description: Description languages: - - name: English - color: Blue - percentage: 50 - #description: + # settings: + # useLess: true + details: + - name: English + color: Blue + percentage: 50 + #description: - - name: Gibberish - percentage: 100 - description: pasghettipigglywiggly + - name: Gibberish + percentage: 100 + description: pasghettipigglywiggly projects: - - title: Project Red - color: red - date: since 2019 - link: https://example.com - description: Describing red stuff - - - title: Project Blue - color: blue - date: since 2016 - link: https://example.com/blue - #description: nothing to describe - - - title: Project Default - date: Since 2017 - link: https://example.com/default - #description: not there either + # settings: + # useLess: true + details: + - title: Project Red + color: red + date: since 2019 + link: https://example.com + description: Describing red stuff + + - title: Project Blue + color: blue + date: since 2016 + link: https://example.com/blue + #description: nothing to describe + + - title: Project Default + date: Since 2017 + link: https://example.com/default + #description: not there either certifications: - - certName: Example Cert - company: Example Certifying Company - date: Date of Completion - #description: Lorem Ipsum + # settings: + # useLess: true + details: + - certName: Example Cert + company: Example Certifying Company + date: Date of Completion + #description: Lorem Ipsum misc: - #commandName: newcommand + # settings: + # useLess: true + commandName: newcommand title: "This Section can have a different command name" titleColor: teal content: | diff --git a/layouts/index.html b/layouts/index.html index e5bfef7..ad29935 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -9,13 +9,18 @@ {{ if .Site.Params.startxLocation }} 'startx', {{ end }} {{ if .Site.Params.exitLocation }} 'exit', {{ end }} {{ if .Site.Params.misc }}{{ .Site.Params.misc.commandName | default "misc"}},{{end}} - {{ if not .Site.Params.source }} 'source',{{ end }} + {{ if not .Site.Params.hideSource }} 'source',{{ end }} {{ if .Site.Params.version }} 'version', {{ end }} - ] + ]; $('body').terminal(function(command, term) { + let useLess = false; + {{if .Site.Params.useLess }} + useLess = true; + {{ end }} + //Funciton used by StartX to draw the progressBar function progress(percent, width) { var size = Math.round(width*percent/100); @@ -59,13 +64,17 @@ } function echoArray(array) { - for (i = 0; i < array.length; i += 1) { - term.echo(array[i]); + if (useLess) { + term.less(array); + } else { + for (i = 0; i < array.length; i += 1) { + term.echo(array[i]); + } } } var whois = [ - {{ with .Site.Params.whois }} + {{ with .Site.Params.whois.details }} '[[b;grey;]Name:]\t\t\t{{ .name }}\n' + '[[b;grey;]Profession:]\t\t{{ .profession }}\n' + '[[b;grey;]Location:]\t\t{{ .location }}\n' + @@ -83,15 +92,16 @@ ]; var social = [ + // TODO: Move this setting to the social settings {{ if .Site.Params.hideSocialName }} - {{ with .Site.Params.social }} + {{ with .Site.Params.social.details }} {{ range . }} '{{ .url }}', {{ end }} '\r', {{ end }} {{ else }} - {{ with .Site.Params.social }} + {{ with .Site.Params.social.details }} {{ range . }} '{{ .name }}: {{ .url }}', {{ end }} @@ -101,7 +111,7 @@ ]; var certifications = [ - {{ with .Site.Params.certifications }} + {{ with .Site.Params.certifications.details }} {{ range . }} '---\n' + '[[b;{{ .color | default "grey" }};]{{ .certName }}]\n' + @@ -118,7 +128,7 @@ ]; var work = [ - {{ with .Site.Params.work }} + {{ with .Site.Params.work.details }} {{ range .}} '---\n' + '[[b;{{ .color | default "grey" }};]{{ .jobTitle }}]\n' + @@ -133,7 +143,7 @@ ]; var education = [ - {{ with .Site.Params.education }} + {{ with .Site.Params.education.details }} {{ range . }} '---\n' + '[[b;{{ .color | default "grey" }};]{{ .courseName }}]\n' + @@ -147,7 +157,7 @@ ]; var projects = [ - {{ with .Site.Params.projects }} + {{ with .Site.Params.projects.details }} {{ range .}} '---\n' + '[[b;{{ .color | default "grey" }};]{{ .title }}]\n' + @@ -159,10 +169,10 @@ "\r", {{ end }} {{ end }} - ] + ]; var skills = [ - {{ with .Site.Params.skills }} + {{ with .Site.Params.skills.details }} {{ range . }} '[[b;{{ .color | default "grey" }};]{{ .name }}:]\n' + progressBar({{ .percentage }}) + @@ -173,10 +183,10 @@ '\r', {{ end }} {{ end }} - ] + ]; var softSkills = [ - {{ with .Site.Params.softSkills }} + {{ with .Site.Params.softSkills.details }} {{ range . }} '[[b;{{ .color | default "grey" }};]{{ .name }}:]\n' + progressBar({{ .percentage }}) + @@ -187,10 +197,10 @@ '\r', {{ end }} {{ end }} - ] + ]; var languages = [ - {{ with .Site.Params.languages }} + {{ with .Site.Params.languages.details }} {{ range . }} '[[b;{{ .color | default "grey" }};]{{ .name }}:]\n' + progressBar({{ .percentage }})+ @@ -201,17 +211,19 @@ '\r', {{ end }} {{ end }} - ] + ]; var misc = [ {{ with .Site.Params.misc }} '[[b;{{ .titleColor }};]{{ .title }}]\n' + '[[;{{ .contentColor }};]{{ .content }}]\n', {{ end }} - ] + ]; + // TODO: Refactor this ugly thing var help = '\n[[b;white;]Available commands:]\n' + - '\n\t\t' + availableCommands.join(' ') + '\n'; + '\n\t\t' + availableCommands.join(' ') + + '\n\t\tless uses less as output method'; var source = ' _______ \n' + ' | | \n' + @@ -252,39 +264,72 @@ switch(commands[0]) { case 'whois': + {{ if .Site.Params.whois.settings.useLess }} + useLess = true; + {{ end }} echoArray(whois); break; case 'social': + {{ if .Site.Params.social.settings.useLess }} + useLess = true; + {{ end }} echoArray(social); break; case 'work': + {{ if .Site.Params.work.settings.useLess }} + useLess = true; + {{ end }} echoArray(work); break; case 'education': + {{ if .Site.Params.education.settings.useLess }} + useLess = true; + {{ end }} echoArray(education); break; case 'skills': + {{ if .Site.Params.skills.settings.useLess }} + useLess = true; + {{ end }} echoArray(skills); break; case 'softskills': + {{ if .Site.Params.softskills.settings.useLess }} + useLess = true; + {{ end }} echoArray(softSkills); break; case 'languages': + {{ if .Site.Params.languages.settings.useLess }} + useLess = true; + {{ end }} echoArray(languages); break; case 'projects': + {{ if .Site.Params.projects.settings.useLess }} + useLess = true; + {{ end }} echoArray(projects); break; case 'certifications': + {{ if .Site.Params.certifications.settings.useLess }} + useLess = true; + {{ end }} term.echo(certifications); break; case '{{ .Site.Params.misc.commandName | default "misc"}}': + {{ if .Site.Params.misc.settings.useLess }} + useLess = true; + {{ end }} echoArray(misc); break; case 'help': term.echo(help); break; case 'all': + {{ if .Site.Params.all.settings.useLess }} + useLess = true; + {{ end }} echoArray(all.flat(1)); break; {{ if .Site.Params.startxLocation }} @@ -298,6 +343,9 @@ term.echo("nice try"); break; case 'source': + {{ if .Site.Params.misc.settings.useLess }} + useLess = true; + {{ end }} term.echo(source); break; {{ if .Site.Params.exitLocation }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index d316043..3a9e48c 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -13,7 +13,9 @@ + +