Developers
occtl command line
Manage servers, schema, data, views, resources and plugins from the command line.
occtl is OmniCore's command line, in the style of kubectl: occtl <group> <verb>. It signs in to servers and
keeps them as contexts, manages the schema, entities, views, resources and plugins, and deploys OmniCore.
Install
dotnet tool install --global OmniCore.Cli
occtl --versionOr from the source tree: dotnet run --project OmniCore/OmniCore.Cli -- <args>. Settings are kept in ~/.omnicore.
Quick start
occtl login http://localhost:5080
occtl whoami
occtl plugin install .\Onboarding.opl
occtl schema perspective list
occtl view set customers --perspective Customer --columns "accountNumber, lastName=Surname, creditLimit" --order -creditLimit
occtl view show customers --search smith
occtl resource put images/ .\logo.png --access public
occtl entity query --impl Customer --where "creditLimit > 1000" --order "-creditLimit" -o jsonContexts and sign-in
A context is a server and the way you signed in to it. login creates or updates one and makes it current.
occtl login https://omnicore.example.com --name prod
occtl login http://localhost:5080 --name local
occtl config use-context prod
occtl --context local plugin list # one command against another contextlogin asks the server how it's secured, then chooses:
| Situation | Method |
|---|---|
| Authentication is off | Anonymous. |
--dev [subject], or a Development server with no identity provider | A development token. |
--password (with -u, and optionally --password-stdin) | Username and password, for OmniCore.Identity. |
| Otherwise | A browser: authorization code with PKCE, through a loopback redirect. |
The refresh token is saved per context (encrypted with DPAPI on Windows; readable only by its owner elsewhere).
Access tokens are never saved, and each command renews one. logout deletes the saved sign-in.
Commands
| Command | What it does |
|---|---|
login [server], logout, whoami | Sign in, forget the sign-in, show who you are with your roles and permissions. |
config get-contexts, current-context, use-context <name>, delete-context <name> | Manage contexts. |
plugin list, get <id>, install <file.opl>, enable <id>, disable <id>, remove <id> | Manage plugins. |
plugin sdk [--output-dir dir] | Download the plugin SDK package. |
resource list [prefix] | List resources. |
resource get <path> [--file f] [--force] | Download one. |
resource put <path> <file> [--access public|signed-in] [--content-type t] [--create-only] | Upload one. A path ending in / takes the file's name. |
resource access <path> public|signed-in, resource remove <path> | Change who can read it, or delete it. |
view list, get <name>, delete <name> | Manage views. |
view set <name> --perspective p --columns "a, b=Heading" [--filter] [--order] [--page-size n] | Create or change a view. Options left out keep their values. |
view show <name> [--search words] [--order o] [--where w] [--skip n] [--take n] | Show a page of the view's table. |
schema get | The whole schema. |
schema field list, schema field set <name> --type T [--display-name] [--description] | Fields. |
schema perspective list, get <name>, set <name> [--fields "a!,b"] [--add-field f] [--remove-field f] | Perspectives. ! after a field makes it required. |
schema relationship list, set <name> --from Order:Many:customer --to Customer:One, delete <name> | Relationships. |
entity get <id>, entity delete <id> | One entity. |
entity query [--impl] [--where] [--order] [--select] [--take] [--skip] | Query with the query language. --impl A,B means all of, --impl A|B any of. |
deploy init, apply, status, delete | Deploy OmniCore. |
Every command takes --help.
Output
-o table (the default) prints columns for lists and key: value lines for single items. -o json and -o yaml print
the API's data in full, which suits scripts:
occtl schema field list -o json | ConvertFrom-Json | Where-Object type -eq ReferenceDeploying
occtl deploy reads an OmniCoreDeployment file and makes Kubernetes or Docker match it:
occtl deploy init -f omnicore.yaml [--target kubernetes|docker] [--identity omnicore|external] [--force]
occtl deploy apply -f omnicore.yaml [--dry-run] [--no-wait] [--timeout 5]
occtl deploy status -f omnicore.yaml
occtl deploy delete -f omnicore.yaml [--purge] [--yes]See Deploy with occtl and Docker and Kubernetes.