Ta.sh is a Bash framework for run tasks and project scripts. Tash is an ancient word means fire.
Use one command for all tasks in all your projects.
use
app get
app install
app start
app deploy
instead of
git pull
npm install
npm start
rsync -r local/ remote
-
Download
ta.sh
file to root of your project. -
Create a file to root of your project named
app.sh
and add below lines to it.
#!/bin/bash
source ta.sh
- Add your scripts under the functions with two underscode prefix in
app.sh
. For example we add two methods named "hi" and "bye".
__hi() {
echo "Hello World"
}
__bye() {
echo "Goodbye"
}
- To access methods as a bash commands you need to source
app.sh
to every terminal session. Open terminal in root of the project and run below command.
. app.sh
You can install
ta.sh
globally instead.
- Now run blow command in terminal.
app hi
You should see "Hello World"
You can install globally by copy below code to ~/.bashrc
or ~/.zshrc
file.
app() {
source app.sh
__run "$@"
}
Now you don't need to source app.sh
on every terminal.
If you want print some text or log message to the console, you can call the __print methods with arguments.
__print "This text is black."
__print red "This text is red."
Supported colors is red, green, yellow, blue
.
You can add help in __help
function in your app.sh
. If you run app help
or app
command you should see that.
__help() {
echo "This is a help"
}
If you add a file inside of ta.sh
named .logo
then the content of that printed to each command response. You can write your team name, app name, etc. by ascci banner.
If you have .env
file in your project you can export all of them by below command.
__source_env_file ENV_FILE_PATH
return true if a function is exists in app.sh
.
if __function_exists FUNCTION_NAME; then
# some code
fi
You can safty call functions defined in app.sh
by below command.
__call_function FUNCTION_NAME
By built-in subscribers you can run your scripts pre or post app.sh
commands. You can add below methods to your app.sh
file.
__pre_app_subscriber() {
echo "This method called before any app commands."
}
__post_app_subscriber() {
echo "This method called after any app commands."
}