general: Added new simple mode for script usage
This commit is contained in:
parent
17a56081a5
commit
6f6b67f387
46
neofetch
46
neofetch
|
@ -4033,18 +4033,8 @@ color() {
|
||||||
|
|
||||||
stdout() {
|
stdout() {
|
||||||
image_backend="off"
|
image_backend="off"
|
||||||
unset subtitle_color
|
unset subtitle_color colon_color info_color underline_color bold title_color at_color \
|
||||||
unset colon_color
|
text_padding zws reset color_blocks get_line_break bar_color_elapsed bar_color_total
|
||||||
unset info_color
|
|
||||||
unset underline_color
|
|
||||||
unset bold
|
|
||||||
unset title_color
|
|
||||||
unset at_color
|
|
||||||
unset text_padding
|
|
||||||
unset zws
|
|
||||||
unset reset
|
|
||||||
unset color_blocks
|
|
||||||
unset get_line_break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err() {
|
err() {
|
||||||
|
@ -4242,7 +4232,7 @@ decode_url() {
|
||||||
# FINISH UP
|
# FINISH UP
|
||||||
|
|
||||||
usage() { printf "%s" "\
|
usage() { printf "%s" "\
|
||||||
Usage: neofetch --option \"value\" --option \"value\"
|
Usage: neofetch func_name --option \"value\" --option \"value\"
|
||||||
|
|
||||||
Neofetch is a CLI system information tool written in BASH. Neofetch
|
Neofetch is a CLI system information tool written in BASH. Neofetch
|
||||||
displays information about your system next to an image, your OS logo,
|
displays information about your system next to an image, your OS logo,
|
||||||
|
@ -4253,6 +4243,22 @@ NOTE: Every launch flag has a config option.
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
INFO:
|
INFO:
|
||||||
|
func_name Specify a function name (second part of info() from config) to
|
||||||
|
quickly display only that function's information.
|
||||||
|
|
||||||
|
Example: neofetch uptime --uptime_shorthand tiny
|
||||||
|
|
||||||
|
Example: neofetch uptime disk wm memory
|
||||||
|
|
||||||
|
This can be used in bars and scripts like so:
|
||||||
|
|
||||||
|
memory=\"\$(neofetch memory)\"; memory=\"\${memory##*: }\"
|
||||||
|
|
||||||
|
For multiple outputs at once (each line of info in an array):
|
||||||
|
|
||||||
|
IFS=\$'\\n' read -d \"\" -ra info < <(neofetch memory uptime wm)
|
||||||
|
info=(\"\${info[@]##*: }\")
|
||||||
|
|
||||||
--disable infoname Allows you to disable an info line from appearing
|
--disable infoname Allows you to disable an info line from appearing
|
||||||
in the output. 'infoname' is the function name from the
|
in the output. 'infoname' is the function name from the
|
||||||
'print_info()' function inside the config file.
|
'print_info()' function inside the config file.
|
||||||
|
@ -4696,6 +4702,19 @@ get_args() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_simple() {
|
||||||
|
while [[ "$1" ]]; do
|
||||||
|
[[ $(type -t "get_$1") == function ]] && {
|
||||||
|
get_distro
|
||||||
|
stdout
|
||||||
|
simple=1
|
||||||
|
info "$1" "$1"
|
||||||
|
}
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
((simple)) && exit
|
||||||
|
}
|
||||||
|
|
||||||
get_distro_ascii() {
|
get_distro_ascii() {
|
||||||
# This function gets the distro ascii art and colors.
|
# This function gets the distro ascii art and colors.
|
||||||
#
|
#
|
||||||
|
@ -8666,6 +8685,7 @@ main() {
|
||||||
eval "$config"
|
eval "$config"
|
||||||
|
|
||||||
get_args "$@"
|
get_args "$@"
|
||||||
|
get_simple "$@"
|
||||||
[[ "$verbose" != "on" ]] && exec 2>/dev/null
|
[[ "$verbose" != "on" ]] && exec 2>/dev/null
|
||||||
get_distro
|
get_distro
|
||||||
get_bold
|
get_bold
|
||||||
|
|
14
neofetch.1
14
neofetch.1
|
@ -1,10 +1,10 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.7.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.8.
|
||||||
.TH NEOFETCH "1" "October 2018" "Neofetch 5.0.1" "User Commands"
|
.TH NEOFETCH "1" "January 2019" "Neofetch 5.0.1" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
Neofetch \- A fast, highly customizable system info script
|
Neofetch \- A fast, highly customizable system info script
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B neofetch
|
.B neofetch
|
||||||
\fI\,--option "value" --option "value"\/\fR
|
\fI\,func_name --option "value" --option "value"\/\fR
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Neofetch is a CLI system information tool written in BASH. Neofetch
|
Neofetch is a CLI system information tool written in BASH. Neofetch
|
||||||
displays information about your system next to an image, your OS logo,
|
displays information about your system next to an image, your OS logo,
|
||||||
|
@ -14,6 +14,14 @@ NOTE: Every launch flag has a config option.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.SS "INFO:"
|
.SS "INFO:"
|
||||||
.TP
|
.TP
|
||||||
|
func_name
|
||||||
|
Specify a function name (second part of info() from config) to
|
||||||
|
quickly display only that function's information.
|
||||||
|
.IP
|
||||||
|
Example: neofetch uptime \fB\-\-uptime_shorthand\fR tiny
|
||||||
|
.IP
|
||||||
|
Example: neofetch uptime disk wm memory
|
||||||
|
.TP
|
||||||
\fB\-\-disable\fR infoname
|
\fB\-\-disable\fR infoname
|
||||||
Allows you to disable an info line from appearing
|
Allows you to disable an info line from appearing
|
||||||
in the output. 'infoname' is the function name from the
|
in the output. 'infoname' is the function name from the
|
||||||
|
|
Reference in New Issue