wtfutil / wtf

The personal information dashboard for your terminal
http://wtfutil.com
Mozilla Public License 2.0
15.74k stars 799 forks source link

Cannot get CMDrunner to display #384

Closed Hamspiced closed 5 years ago

Hamspiced commented 5 years ago

What problem are you having and how can we help?

I simply cannot get CMDRunner to work at all.

I have the rest of the dashboard setup fine.

However i cannot get the Cmdrunner module to display at all. even by itself. WTF runs and loads and doesnt throw any error. it just doesnt display anything.

cmdrunner:
    args: ["www.google.com"]
    cmd: "ping"
    enabled: true
    position:
    top: 2
    left: 5
    height: 2
    width: 3
    refreshInterval: 300
senorprogrammer commented 5 years ago

The problem with using ping for this is that it never really returns the process until you kill it. It just runs forever and never dumps the output by default. If you change your args to ["-c3", "www.google.com"] you'll see that it now displays output because the process terminates after pinging three times and returns the result to WTF.

senorprogrammer commented 5 years ago

Turns out no matter what command is used, the widget doesn't show up at all. Re-opening until resolution.

E3V3A commented 5 years ago

@Hamspiced
What OS are you running on? If it is Windows, you don't have ping, you have PING.EXE. Not sure the code is taking this into consideration...

E3V3A commented 5 years ago
# This is the correct PowerShell code (if Windows PATH is correct)
PING.EXE -n 3 google.com

Thus the cmdrunner Widget execution code must be equivalent to:

//cmd := exec.Command(widget.cmd, widget.args...)
cmd := exec.Command("PING.EXE", "-n", "3", "google.com")

(Pulled from the top of my head without testing.)

Hamspiced commented 5 years ago
# This is the correct PowerShell code (if Windows PATH is correct)
PING.EXE -n 3 google.com

Thus the cmdrunner Widget execution code must be equivalent to:

//cmd := exec.Command(widget.cmd, widget.args...)
cmd := exec.Command("PING.EXE", "-n", "3", "google.com")

(Pulled from the top of my head without testing.)

OSX, Maybe its my config. IDK at this point, because some of the newer widgets that have been added i cannot get to display either, like the Spotify one.

senorprogrammer commented 5 years ago

If you want to email me your config, I'll give it a try: chriscummer@me.com

Be sure to remove any API keys, etc. that might be in it.

senorprogrammer commented 5 years ago

Found it. It's an indenting issue. Your config has the following:

    cmdrunner:
        args: []
        cmd: "uptime"
        enabled: true
        position:
        top: 1
        left: 9
        height: 1
        width: 4
        refreshInterval: 300

but it needs to be

    cmdrunner:
        args: []
        cmd: "uptime"
        enabled: true
        position:
            top: 1
            left: 9
            height: 1
            width: 4
        refreshInterval: 300

I've opened https://github.com/wtfutil/wtf/issues/389 to improve this.

Hamspiced commented 5 years ago

is the positions the only arguments in the config that need offsets?

senorprogrammer commented 5 years ago

No, lots of them do. For example, GitHub requires repositories to be nested: https://wtfutil.com/modules/github/

If a module is not working for you, I suggest taking a look at the docs to see the config reference implementation for that module to see how it should be configured.