CLI
Command Line Interface
The Shimoku command line interface (CLI) is a tool that comes with the python package installation, it makes it easier to use certain functionalities that don't need to be in a script.
To confirm that it is installed use the shimoku
keyword in a terminal in your environment, then the following help message will appear:
The CLI is self-documenting so if you have any doubt about a particular command just type -h
or --help
after the command for information on what it does and how to use it.
The commands are separated in different command groups that can have multiple inner commands. The first layer (shimoku) branches into four possible command groups:
config - These are the commands that will be used to manage the configuration variables needed to access workspaces.
playground - These commands are used to manage the local server that serves the playground, it can initiate a server and if needed can terminate a server that runs on the background (mostly for handling previous versions servers)
cloud - These commands handle anything that has to interact with the API directly; creating, deleting, updating and getting resources from the API. (Can interact with the local server too, depending on the configuration variables)
persist - These commands group the code generation functionalities, to use the database as the source of truth.
Configuration
First you will want to set your default configuration, using the credentials of the main workspace that you will be working with.
Use the following command to set the default configuration:
It will then ask for the credentials:
It will check check if the parameters are correct and if they are it will save them, you will know because it will output this message:
You can save multiple profiles identified with different names by using the parameter --profile
, a recommendation is to create the profile local
to interact with the playground workspace:
After that you should have at least two profiles, you can see your profiles and which one you are using by executing the command:
Also you can retrieve the configuration values with the command:
Interactive
The interactive mode is the recommended way to use the CLI, as it has some useful functionalities that the default mode does not provide.
To enter the interactive mode the main shimoku
parser has to recieve the flag -i
or --interactive
:
Then the view will change and will show you the profile being used in uppercase with an S-
in front, in the case of being in the local profile:
Word Completion
By pressing the tab at any moment the CLI will recommend the possible completion options:
It will use the current text in the line to guess what you are trying to write, if it cant find nothing then it wont display any options:
Use the arrows to select between the options, and the tab to select the option you want.
Session Variables
In the interactive mode you can store session variables that later can be used in the commands, the following syntax has to be used to set variables:
Then the key variables will be replaced in the execution of the command when a $ is put before them:
These variables will be recommended as options for the arguments of the commands:
An example on how this can be useful is if you have to access temporarily to a different workspace:
The other feature of the variables is that they will be used automatically if no value has been set for a parameter of a command but the variable with the same name exists, so for example, if the local server is running in a port different from 8000 you can set it as a variable and every call will use that value for the port parameter.
The values passed to parameters will always override the configuration variables or environment variables, and every function accepts variables from higher levels if they need them, for example when creating a menu path you can also specify the universe and access_token for that specific command.
For this reason the CLI will recommend some options when assigning variables, that might be of interest:
Last updated