From 03741d577a4a4a5f2efa904dbbebee6289dd1d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Val=C3=A9rian=20Galliat?= Date: Sun, 30 Nov 2014 10:01:20 +0100 Subject: [PATCH] Add an option to supply custom ASCII art. --- README.mkdn | 5 +++++ screenfetch-dev | 6 +++++- screenfetch.1 | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.mkdn b/README.mkdn index a37b32d..3a9e65e 100644 --- a/README.mkdn +++ b/README.mkdn @@ -70,6 +70,11 @@ specified on the command line, and those are shown below or by executing `screen ASCII logo colors and the label colors. The second argument controls the colors of the information found. One argument may be used without the other. + -a 'PATH' You can specify a custom ASCII art by passing the path + to a Bash script, defining `startline` and `fulloutput` + variables, and optionally `labelcolor` and `textcolor`. + See the `asciiText` function in the source code for more + informations on the variables format. -S 'COMMAND' Here you can specify a custom screenshot command for the script to execute. Surrounding quotes are required. -D 'DISTRO' Here you can specify your distribution for the script diff --git a/screenfetch-dev b/screenfetch-dev index 64ddbf3..f3ec361 100755 --- a/screenfetch-dev +++ b/screenfetch-dev @@ -262,7 +262,7 @@ case $1 in esac -while getopts ":hsu:evVEnNtlS:A:D:o:Bc:d:p" flags; do +while getopts ":hsu:evVEnNtlS:A:D:o:Bc:d:pa:" flags; do case $flags in h) displayHelp; exit 0;; s) screenshot='1' ;; @@ -280,6 +280,7 @@ while getopts ":hsu:evVEnNtlS:A:D:o:Bc:d:p" flags; do d) overrideDisplay="${OPTARG}" ;; N) no_color='1';; p) portraitSet='Yes' ;; + a) art="${OPTARG}" ;; :) errorOut "Error: You're missing an argument somewhere. Exiting."; exit 1;; ?) errorOut "Error: Invalid flag somewhere. Exiting."; exit 1;; *) errorOut "Error"; exit 1;; @@ -1895,8 +1896,10 @@ asciiText () { # Distro logos and ASCII outputs if [[ "$fake_distro" ]]; then distro="${fake_distro}"; fi if [[ "$asc_distro" ]]; then myascii="${asc_distro}" + elif [[ "$art" ]]; then myascii="custom" else myascii="${distro}"; fi case ${myascii} in + "custom") source "$art" ;; "Arch Linux - Old") if [[ "$no_color" != "1" ]]; then c1=$(getColor 'white') # White @@ -3379,6 +3382,7 @@ infoDisplay () { "CentOS"|"Ubuntu"|*) labelcolor=$(getColor 'yellow');; esac [[ "$my_lcolor" ]] && labelcolor="${my_lcolor}" + if [[ "$art" ]]; then source "$art"; fi if [[ "$no_color" == "1" ]]; then labelcolor=""; bold=""; c0=""; textcolor=""; fi # Some verbosity stuff [[ "$screenshot" == "1" ]] && verboseOut "Screenshot will be taken after info is displayed." diff --git a/screenfetch.1 b/screenfetch.1 index 4223732..5024af7 100644 --- a/screenfetch.1 +++ b/screenfetch.1 @@ -80,6 +80,12 @@ ASCII logo colors and the label colors. The second argument controls the colors of the information found. One argument may be used without the other. .TP +.B \-a 'PATH' +You can specify a custom ASCII art by passing the path to a Bash script, +defining \fBstartline\fR and \fBfulloutput\fR variables, and optionally +\fBlabelcolor\fR and \fBtextcolor\fR. See the \fBasciiText\fR function +in the source code for more informations on the variables format. +.TP .B \-S 'COMMAND' Here you can specify a custom screenshot command for the script to execute. Surrounding quotes are required.