fastfetch-cli / fastfetch

An actively maintained, feature-rich and performance oriented, neofetch like system information tool.
MIT License
9.96k stars 398 forks source link

[BUG] "fastfetch -s shell --format json" return "fastfetch" instead of "bash" or "zsh" #994

Closed omnigenous closed 3 months ago

omnigenous commented 4 months ago

General description of bug:

...
    {
      "type": "command",
      "key": "custom-shell",
      "text": "echo my shell is $(fastfetch -s shell --format json | jq -r '.[0].result.prettyName')"
    },
...
...
shell   my shell is fastfetch
...

Workaround

echo $SHELL

Output of fastfetch --list-features:

threads
vulkan
wayland
xcb-randr
xcb
xrandr
x11
drm
gio
dconf
dbus
imagemagick7
chafa
zlib
xfconf
egl
glx
osmesa
opencl
libpulse
libnm
libddcutil
Directx Headers
Proprietary GPU driver API
System yyjson
linux/videodev2
linux/wireless
omnigenous commented 3 months ago

@CarterLi I tried building from https://github.com/fastfetch-cli/fastfetch/commit/10fd7d61ae06aea581725f251abb9976eea99703 and it still returns fastfetch (I am running ./run.sh)

{ "exe": "./fastfetch", "exeName": "fastfetch", "exePath": "/home/user/github/fastfetch/build/fastfetch", "pid": 32499, "ppid": 32301, "processName": "fastfetch", "prettyName": "fastfetch", "version": "", "tty": 4 }
CarterLi commented 3 months ago

How did you get this output?

omnigenous commented 3 months ago

@CarterLi Made my terminal really wide and:

    {
      "type": "command",
      "key": "custom-shell",
      "text": "echo my shell is $(fastfetch -s shell --format json | jq -r '.[0].result')"
    },
CarterLi commented 3 months ago

Works for me

CarterLi commented 3 months ago

BTW why do you want to use command in this case? What about fastfetch --shell-format 'my shell is {pretty-name}'?

omnigenous commented 3 months ago

Works for me

Yeah, I'm stupid. Had to replace fastfetch -s shell with /path/to/fork/fastfetch/build/fastfetch -s shell inside config file

omnigenous commented 3 months ago

BTW why do you want to use command in this case? What about fastfetch --shell-format 'my shell is {pretty-name}'?

It was just for sake of an example. I want to have my terminal and shell on a same line. As far as I'm aware the only way to achieve that is to use command.

omnigenous commented 3 months ago

Thank you for fixing this :heart: