hasbash is a (very minimal) Habitica terminal client written entirely in Bash. It is designed to be a reusable component in a workflow on any modern GNU/Linux or Unix (e.g. MacOS) system with minimal dependencies.
Current features include:
- habash ls # List all tasks
- habash cast <SPELL NAME> <(optional) TARGET ID> # Cast a spell (SPELL_NAME is from the API)
- habash id <TASK TEXT> # Get the id of a task
- habash up|done <TASK_TEXT> # (Use with To-Do & Dailies to complete. For habits, as a positive action)
- habash down <TASK_TEXT> # (Use with To-Do & Dailies to un-complete. For habits as a negative action )
- habash delete <TASK_TEXT> # Delete a task
- habash create-todo <TASK_TEXT> # Create a todo
- habash create-habit <TASK_TEXT> # Create a habit
WARNING! Use this script as though it were curl i.e. escaping special characters etc. Most arguments are passed without special treatment to the end of a curl command. (If you don't understand what this means, see curl.)
Note that the current script does not handle tasks with check-lists correctly.
Required components (these will usually be installed on any new Linux/Unix system):
Then clone the git repo with
git clone https://github.com/nasfarley88/habash.git
set the environment variables HABITICA_TOKEN and HABITICA_UUID (below) and start using the script
The environment variables HABITICA_TOKEN and HABITICA_UUID are required to be set in the current environment e.g. in
Alternatively, set them with the following command before executing the script
declare -x HABITICA_UUID=[USER ID]
declare -x HABITICA_TOKEN=[API TOKEN]
Your USER ID and API TOKEN can be found on the website, under Settings=>Site or on your mobile device under Settings => Account Details
However, be aware that as mentioned on the API settings page, your API token is a password, so care should be taken with it. For example, if you set the
HABITICA_TOKEN variables in your .bashrc file, then make sure the file permissions are set so that only you have read access. This could be done with the following console commands:
chmod 600 .bashrc
The first command changes to your home directory, and the second prevents other users accessing your .bashrc file. But if you are using habash then you probably know this already.
If you are running a local instance of habitica, you may need to alter the script to add the parameter -k for curl command lines to allow insecure connections, that is, connections to SSL sites without certs.
- habash ls
- habash cast SPELL_NAME (optional)TARGET_ID
- habash id TASK_TEXT
- habash up TASK_TEXT
- habash down TASK_TEXT
- habash create-todo TASK_TEXT
- habash create-habit TASK_TEXT
- habash help
You should treat this script like using curl itself i.e. you should escape special characters, etc.. As always, never copy and paste a command you don't understand!