Switch Lazy CLI is a command-line tool designed to simplify the process of searching work logs on Enfocus Switch. If you frequently switch between a GUI and the terminal while coding, you know how inconvenient it can be to check logs manually. This tool streamlines the process, allowing you to access logs quickly and efficiently.
Switch Lazy CLI depends on a few common Linux/Unix utilities. Ensure that your system has the following tools installed:
-
Basic utilities:
vim,emacs(text editors),cat(print files),mkdir,touch,mv,rm,echo,printf -
Additional libraries:
- JQ – A JSON processor
- JTBL – JSON to table converter
-
Most importantly:
- You must have Enfocus Switch with API support (from 2018).
First, clone this repository:
git clone https://github.com/yourusername/switch-lazy-cli.git
cd switch-lazy-cliNavigate to the folder where slazy.sh is located and make it executable:
chmod +x slazy.shCopy the script to /usr/local/bin to make it accessible from anywhere:
sudo cp slazy.sh /usr/local/bin/slazy-
Create a configuration file at:
$HOME/.config/slazy/slazy_configOr run:
slazy -c
-
Add the following information to the configuration file:
USER="joe" HASH_PASS="XXXXXXXXXXXXXXXX" SLAZY_SWITCH_IP="0.0.0.0"
To authenticate, you need to generate an encrypted password hash.
-
Create a file named
enfocuspublic_key.pem. -
Copy the PUBLIC KEY from the Enfocus Switch - Auth Documentation.
-
Run the following command to encrypt your password:
echo -n "REPLACEYOURPASSWORDHERE" | openssl rsautl -encrypt -pubin -inkey ./enfocuspublic_key.pem | base64
⚠ Warning:
If you are unfamiliar with RSA encryption, research before proceeding. Encryption operations should be performed at your own risk.
Check it
-
Create a configuration file at:
$HOME/.config/switchOrchestrator/swo_configOr run:
swo -c
-
Add the following information to the configuration file:
USER="joe" HASH_PASS="XXXXXXXXXXXXXXXX" SWITCH_IP="0.0.0.0"
To authenticate, you need to generate an encrypted password hash.
-
Create a
enfocuspublic_key.pemfile. -
Copy the PUBLIC KEY from the Enfocus Switch - Auth Documentation.
-
Run the following command to encrypt your password:
echo -n "REPLACEYOURPASSWORDHERE" | openssl rsautl -encrypt -pubin -inkey ./enfocuspublic_key.pem | base64
⚠ Warning:
If you are unfamiliar with RSA encryption, research before proceeding. Encryption operations should be performed at your own risk.
Check it
Authenticate and generate an authentication token:
slazy -aRetrieve details about a specific job:
slazy -j JOBNUMBERExample Output:
^ type ^ flow ^ job ^ element ^ message ^ timestamp ^
| info | test-flow live | | New Job | Added unique name prefix, new name is '_J79O5_test-job swo.xml' | 2024-02-17T00:06:22.617Z |
| info | test-flow live | test-job swo.xml | XML action | Metadata was attached to asset '/Users/_J79O5_test-job swo.xml' | 2024-02-17T00:06:22.744Z |
| info | test-flow live | test-job swo.xml | XML action | File _J79O5_test-job swo.xml was renamed to file _J79O5_test-job swo.xml | 2024-02-17T00:06:22.750Z |Retrieve the status, name, and groups of existing flows:
slazy -fExample Output:
^ status ^ name ^ groups ^
| running | Example A | INPUT |
| stopped | Example B | ACTION |
| running | Example C | ACTION |
| stopped | Example D | MACHINE |Color-coding:
- ✅ Running flows → Green
- ❌ Stopped flows → Red
| Option | Description |
|---|---|
-a, --auth |
Authenticate and obtain a token |
-j <string>, --job <string> |
Search for a job |
-h, --help |
Display help information |
-c, --config |
Create or update configuration |
-f, --flows |
List flows and statuses |
-p, --ping |
Ping the Switch API |
If you have ideas, feel free to fork the repository and send a pull request!
- Formatting JSON as a Table using JQ
- How to Write a Great README
- Enfocus Switch API Authentication
- Makefile Tutorial
- Authentication
- Search by Jobs
- Search using different parameters
- Refresh search results
- List workflows
- Start/Stop workflows
- Support for multiple Enfocus Switch instances
- Environment support?
- Synchronize multiple scripts between environments
- Migrate to Python?
📌 Note:
This project is NOT actively evolving, and any suggestions or improvements are highly welcome! 🚀
