StewardX CLI
Logo converted to ASCII via https://asciiart.club/
StewardX
The CLI to controlThis is the official CLI to control StewardX. Made with #clap.
Getting started
If you're a linux x64 user, then you're in luck! Just download the precompiled binary or use the following utility:
$ curl https://raw.githubusercontent.com/gokayokyay/stewardx-cli/master/install.sh --output install.sh
$ chmod +x install.sh
$ ./install.sh
It'll handle everything for you, note: it's new and I'm pretty sure it won't work out for everyone.
If you're not, it's okay. Clone the repository and build it:
$ git clone https://github.com/gokayokyay/stewardx-cli
$ cd stewardx-cli
$ cargo build --release
When the build is completed, there'll be a file named stewardx-cli
located in target/release/
directory. For ease of use rename the file, create a directory to use the binary and append it to your profile, like:
$ mkdir -p $HOME/.stewardx
$ mv target/release/stewardx-cli $HOME/.stewardx/stxctl
$ echo "export PATH=\"\$PATH:/\$HOME/.stewardx\"" >> $HOME/.bashrc
$ source $HOME/.bashrc
Now you're ready! Run:
$ stxctl -h
to see the help message.
Usage
Install StewardX
To install StewardX, just run the install
command, like so:
$ stxctl install
Start StewardX
To start the StewardX (daemonized) issue the run
or start
command.
$ stxctl run
# or
$ stxctl start
Stop StewardX
I guess you got it but here it is:
$ stxctl stop
Create a task
Okay here's the fun part. To create a task you need to run:
$ stxctl tasks create <task_type> [ARGS]
It looks complicated but it's not, let's create a hello world printer command task:
$ stxctl tasks create cmd -n "My first task" -c "echo Hello world!" -f Hook
Where
- -n is name of the task
- -c is the command to execute
- -f is the frequency of the task
After executing the command above you'll get an output like:
Task ID | Name | Type | Frequency
---------------------------------------------------------------------------------
0558b548-d118-4c46-9309-e040b486a92b | first task | CmdTask | Hook
Voila! You've created your first task.
Listing tasks
To list tasks
$ stxctl tasks list
To list active tasks
$ stxctl tasks active
Executing and aborting tasks
To execute
$ stxctl tasks execute <id>
To abort
$ stxctl tasks abort <id>
and replace with the id of the task.
Listing reports
To list last 10 reports:
$ stxctl reports latest
To list a specific task's reports
$ stxctl reports -t <id>
and replace with your task's id.
To list a single report:
$ stxctl reports list <id>
where id is your report's id.