diff --git a/neofetch b/neofetch index bd09a0b7..0b3bf650 100755 --- a/neofetch +++ b/neofetch @@ -3909,6 +3909,11 @@ info() { prin() { # If $2 doesn't exist we format $1 as info. if [[ "$(trim "$1")" && "$2" ]]; then + if [[ "$json" ]]; then + printf " %b\n" "\"${1}\": \"${2}\"," + return + fi + string="${1}${2:+: $2}" else string="${2:-$1}" @@ -4718,6 +4723,17 @@ get_args() { exit 1 ;; + "--json") + json="on" + unset -f get_title get_cols get_line_break get_underline + + printf "{\n" + print_info 2>/dev/null + printf " %s\n" "\"Version\": \"${version}\"" + printf "}\n" + exit + ;; + "--travis") print_info() { info title