adtac / climate

The swiss-army knife of utility tools for Linux.
GNU General Public License v3.0
1.42k stars 76 forks source link

Feature Request: Show the command behind the shortcut #22

Open alex9099 opened 7 years ago

alex9099 commented 7 years ago

Hi, i would like to see what command is executed when a shortcut runs

For example climate download-file <file> should show something like The command you just executed was a shortcut to "wget <file> "

adtac commented 7 years ago

Yep, this is possible already. When you install, you'll be asked a question Show commands before execution?. Just say yes and you'll get the run commands every time. Lemme know if that works :)

alex9099 commented 7 years ago

It does not show the command, at least with some that i tryed (ports, memory, overview, trash-size, public ip, etc).

also ports give a lsof error (not found), i'm using arch linux

adtac commented 7 years ago

Oh yeah, I've implemented it only for some commands. Didn't get around to finishing it for the whole list of commands. Will do it soon though :) Thanks for reminding me!

luffah commented 5 years ago

hello ! i think this probably the most important feature. /sharing knowledge/ in order to ease the task i suggest to use a tricky function like this

logexec() {
    if [ "${SHOW_COMMAND:-}" ]; then
        printf "+ %s\n" "$@"
    fi
    eval $@ & spinner $!
}
# example
logexec 'echo a lot of things | sed "s/lot/couple/"'

the result is similar to set -x; eval $@ ; set +x but independant to the bash configuration