General, Profile and Login
CLI commands for
- General purposes
- Login profiles
- Login/logout
Also see: Introduction and Setup
General
Show Help
loc help [command]
loc [command] -h
loc [command] --help
List available commands or show help on a specific command.
Example:
loc help dp
loc dp create -h
loc dp list --help
Show CLI Version
loc version
loc -V
Generate Shell Completion Scripts
loc completion <SHELL>
Generate completion scripts for specific shells. This will provide completion suggestions while pressing tab
.
<SHELL>
can be specified to be one of the following options:
Shell | Platform |
---|---|
bash | Linux/macOS |
elvish | Linux/macOS |
fish | Linux/macOS |
powershell | Windows |
zsh | Linux/macOS |
How to setup CLI completion script
- Bash
- fish
- zsh
- PowerShell
Create a loc.bash
with CLI:
mkdir -p /usr/local/bin/bash
loc completion bash > /usr/local/bin/bash/loc.bash
Then edit ~/.bashrc
:
echo "source /usr/local/bin/bash/loc.bash" >> ~/.bashrc
Create a loc.fish
with CLI:
mkdir -p ~/.config/fish/completions
loc completion fish > ~/.config/fish/completions/loc.fish
Create a _loc
script with CLI:
mkdir -p ~/.zsh/completion
loc completion zsh > ~/.zsh/completion/_loc
Then edit ~/.zshrc
:
sudo nano ~/.zshrc
Add the following lines into ~/.zshrc
then save (Ctrl
+ x
then y
):
fpath+=~/.zsh/completion
autoload -U loc
loc
First check if the $PROFILE
script exists:
test-path $PROFILE
If printed false
, create the $PROFILE
script with
New-Item -Path $PROFILE -Type File -Force
Then append the CLI script to $PROFILE
:
loc completion powershell >> $PROFILE
Login Profile
loc profile
A login Profile is the local profile (name, description and URL) for connecting your LOC server. The Profiles will be stored globally so any CLI binaries on the same computer would access the same Profiles.
List All Profiles
loc profile list|ls
Create a Profile
loc profile create|new [OPTIONS]
Create a login Profile.
The options, if not provided as parameters, would be prompted by CLI:
Option | Description |
---|---|
--name <NAME> * | Login Profile name |
--description <DESCRIPTION> * | Login Profile description (can be blank) |
--server-url <SERVER URL> * | LOC server base URL |
*= will be prompted if not provided
Select a Profile
loc profile use <PROFILE NAME>
You must select a login Profile to use in order to login and manage assets in your LOC instance.
Show Current Profile
loc profile current [-v|--verbose]
Option | Description |
---|---|
-v | --verbose | Show more details of current logic profile |
Inspect a Profile
loc profile get <PROFILE NAME>
Inspecting the current profile you're using is the same as loc profile current -v
.
Delete a Profile
loc profile delete <PROFILE NAME>
Login
loc login [OPTIONS]
Login LOC (requires a profile set and selected). This will generate a token which is required for managing assets in your LOC instance.
Option | Description |
---|---|
--username <USERNAME> * | LOC username |
--password <PASSWORD> * | LOC password (not recommended) |
--password-stdin | Take password from stdin (standard input stream) |
*= will be prompted if not provided
You will be logout of CLI after some time of inactivity (token expired).
The CLI token does not effect the Studio token. You can login both at the same time.
If you are using Bash or similar shells, you can save your password in a file (for example, secret
):
loc login --username <username> --password-stdin < ./secret
Then press Enter
.
Logout
loc logout