#hierarchy of commands

3 messages · Page 1 of 1 (latest)

tawdry remnant
#

I just have a question as if this is a bug or not - i am trying to run the following command clear && git branch && git status but it seems that it is running the clear at the end and not before the git branch & git status as i have to scroll up in order to see those

formal kernelBOT
#

Hi @tawdry remnant. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Yes, you're correct. This is a known issue with Warp where the clear command runs alongside any other commands you have in the same command line. So, when you run clear && git branch && git status, the block with the output is the same as the block with the clear instead of running after. This issue has been reported in a few GitHub issues, such as issue #3776 (https://github.com/warpdotdev/Warp/issues/3776) and issue #2382 (https://github.com/warpdotdev/Warp/issues/2382).

A workaround suggested in issue #2382 (https://github.com/warpdotdev/Warp/issues/2382) is to use the CTRL-L keypress in Warp to achieve the same result as a clear command. You can also create an alias for this keypress and chain it with other commands as part of a script. Here's an example:

alias ls='ls'
alias clear='printf "\033[2J\033"'
alias cs='clear && ls'

In this example, running cs will both clear the current terminal and then run the ls command.

However, please note that using printf "\033[2J\033" instead of clear might not give the exact same output as using clear, as you might still see the command you executed at the top. Your best bet is to run clear separately, or press CMD-K on mac (CTRL-SHIFT-K on linux) to clear the entire block list.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: