Skip to content

dulaj-me/delayed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Delayed

Pause and wait until ENTER is pressed in a beautiful screen before executing the command.

Why?

When you have a bit complex terminal development workflow possibly with tmux (and maybe tmuxp), sometime you need to let a script automatically create specific panes for different uses. A personal usecase for me was to have 3 tmux tabs to connect to development, staging, and production environments. But I didn't want to be always connected to these environments. What I wanted was a way to keep the command pre filled in the tab so I can execute it whenever I need to.

Now, there are multiple ways to do that.

  1. Just keep the command typed and not executed in the terminal. You can do this easily in tmuxp. But usually you want to re-run these kind of commands which is difficult when you have to go through the command history.
  2. Run a command like read -p "Press enter to continue" && <you command>. But it looks so ugly (read on)
  3. Or you could use delayed 😎

How does it work?

Say you want to run the command echo "Hello, World!"; sleep 10s when you press enter on the terminal.

Then just run delayed 'echo "Hello, World!"; sleep 10s' which will show a beautiful responsive banner until you press ENTER to continue or 'q' to abort.

delayed start

When you press ENTER, the script you defined will be executed as expected

delayed exec

Not only that, once the script is executed, it will automatically go back to the banner, allowing you to re-run the same command.

Aaand... if the command failed, the banner will also show the return value of the last run.

delayed error

Install

Currenty this project does not have a release cycle. To install, clone the repo and follow the steps.

  1. Make sure you have golang in your system
go version
  1. Build and install delayed
go build && go install
  1. Add go bin dir to your PATH env if not added already. Add this line to your .zshrc (or equivalent) if you want the go bin dir to stay in your PATH (recommended)
export PATH=$PATH:$(go env GOPATH)/bin

That's it! Enjoy ❤️

About

Run a command delayed; with a beautiful banner

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages