Skip to content

CLI reference

Every command of osh with its arguments and options, generated from the application. The guide has what a command's help does not say: how the project and the branch are found, the output, the exit codes and the environment variables.

Every command also takes --help.

osh

Work with Odoo.sh projects from the command line (unofficial).

osh [OPTIONS] COMMAND [ARGS]...
Option Description Environment
--version Show the version and exit.
--debug Show the traceback when a command fails. OSH_DEBUG
--format FORMAT How to print the result. One of table, json. Default: table.
--install-completion Install completion for the current shell.
--show-completion Show completion for the current shell, to copy it or customize the installation.
Command Description
osh auth Log in to Odoo.sh, log out, and show the session in use.
osh branches List the branches of an Odoo.sh project.
osh builds List, show and watch the builds of a branch, and start a new one.
osh logs Print the end of a build's log: the install or odoo log of the branch's latest build, or another.
osh projects List the Odoo.sh projects you can reach.
osh ssh Open a shell on the branch's latest build, with your own ssh, its configuration and its keys.

osh auth

Log in to Odoo.sh, log out, and show the session in use.

osh auth [OPTIONS] COMMAND [ARGS]...
Command Description
osh auth login Sign in with GitHub in a browser and store the session in the keyring.
osh auth status Show where the session comes from and how long it lasts, without asking Odoo.sh. Exits 3 when there is none.
osh auth logout End the stored session on Odoo.sh and remove it from the keyring. Exits 0 when there is none.

osh auth login

Sign in with GitHub in a browser and store the session in the keyring.

Where no browser can be launched, it asks for the session_id cookie in a prompt that does not echo it.

osh auth login [OPTIONS]

Example:

osh auth login

osh auth status

Show where the session comes from and how long it lasts, without asking Odoo.sh. Exits 3 when there is none.

osh auth status [OPTIONS]
Option Description Environment
--check Ask Odoo.sh whether it still accepts the session, and who it belongs to.

Example:

osh auth status --check

osh auth logout

End the stored session on Odoo.sh and remove it from the keyring. Exits 0 when there is none.

osh auth logout [OPTIONS]

Example:

osh auth logout

osh branches

List the branches of an Odoo.sh project.

osh branches [OPTIONS] COMMAND [ARGS]...
Command Description
osh branches list List a project's branches with their stage: production, staging, then development, each sorted by name.

osh branches list

List a project's branches with their stage: production, staging, then development, each sorted by name.

A stage osh does not know is shown as Odoo.sh names it, after the others. In the table, * marks the branch checked out, when the project comes from the git checkout.

osh branches list [OPTIONS]
Option Description Environment
--project PROJECT The project's name. Default: the git checkout's. OSH_PROJECT
--stage STAGE List only the branches in this stage. Can be given more than once. unknown is any stage osh does not know. One of production, staging, development, unknown.

Example:

osh branches list --stage staging

osh builds

List, show and watch the builds of a branch, and start a new one.

osh builds [OPTIONS] COMMAND [ARGS]...
Command Description
osh builds list List a branch's latest builds, newest first, with their status, result and commit.
osh builds show Show one build of a branch, with its commit and the address of its database: its latest, or BUILD_ID.
osh builds watch Watch a build until it finishes, and exit with its result: the build of HEAD, or BUILD_ID.
osh builds rebuild Change state on Odoo.sh: start a new build of a branch, which replaces its latest one.

osh builds list

List a branch's latest builds, newest first, with their status, result and commit.

osh builds list [OPTIONS]
Option Description Environment
--project PROJECT The project's name. Default: the git checkout's. OSH_PROJECT
--branch BRANCH The branch's name. Default: the git checkout's. OSH_BRANCH
--limit LIMIT The most builds to list. Odoo.sh has only been seen to answer up to 4: older builds are out of reach. At least 1. Default: 4.

Example:

osh builds list --branch staging

osh builds show

Show one build of a branch, with its commit and the address of its database: its latest, or BUILD_ID.

osh builds show [OPTIONS] [BUILD_ID]
Argument Description
BUILD_ID The build's number, among the branch's latest builds. Default: the latest one. At least 1.
Option Description Environment
--project PROJECT The project's name. Default: the git checkout's. OSH_PROJECT
--branch BRANCH The branch's name. Default: the git checkout's. OSH_BRANCH

Example:

osh builds show 1234

osh builds watch

Watch a build until it finishes, and exit with its result: the build of HEAD, or BUILD_ID.

osh builds watch [OPTIONS] [BUILD_ID]
Argument Description
BUILD_ID The build's number, among the branch's latest builds. Default: the build of HEAD when the project and the branch are the checkout's, the latest build otherwise. At least 1.
Option Description Environment
--project PROJECT The project's name. Default: the git checkout's. OSH_PROJECT
--branch BRANCH The branch's name. Default: the git checkout's. OSH_BRANCH
--timeout SECONDS The longest to wait for the build to appear and to finish. At least 1. Default: 1800.
--commit SHA Wait for a build of this commit, given as the first 7 to 64 digits of its hash. Default: the git checkout's HEAD, when the project and the branch are the checkout's. Goes with neither BUILD_ID nor --no-wait.
--no-wait Watch the branch's latest build, whatever its commit.

Example:

git push && osh builds watch

osh builds rebuild

Change state on Odoo.sh: start a new build of a branch, which replaces its latest one.

Only a development or a staging branch is rebuilt. It asks first, unless --yes is given.

osh builds rebuild [OPTIONS]
Option Description Environment
--project PROJECT The project's name. Default: the git checkout's. OSH_PROJECT
--branch BRANCH The branch's name. Default: the git checkout's. OSH_BRANCH
--yes, -y Rebuild without asking. Needed when stdin or stderr is not a terminal.
--watch Watch the new build until it finishes, and exit with its result.
--timeout SECONDS The longest to wait for the new build to finish. Goes with --watch only. At least 1. Default: 1800.

Example:

osh builds rebuild --watch

osh logs

Print the end of a build's log: the install or odoo log of the branch's latest build, or another.

osh logs [OPTIONS]
Option Description Environment
--project PROJECT The project's name. Default: the git checkout's. OSH_PROJECT
--branch BRANCH The branch's name. Default: the git checkout's. OSH_BRANCH
--build BUILD_ID The build's number, among the branch's latest builds. Default: the latest one. At least 1.
--kind NAME Which log to print, by its name. --kinds lists them. Default: install when the build has it, odoo otherwise.
--kinds List the logs the build has, and print none. Goes with none of the options that print a log.
--tail LINES Print the last lines, out of the log's last mebibyte: a large tail can print fewer. At least 1. Default: 100.
--all Print the whole log. Does not go with --tail.
--follow, -f Keep printing the lines as they are written, until interrupted. With --all, from the first line.
--strip, --no-strip Remove the escape sequences and control characters from the lines, or leave them. Default: remove them when stdout is a terminal.
--timeout SECONDS The longest to follow the log: the command then exits 8. Goes with --follow only. Default: no limit. At least 1.

Example:

osh logs --follow

osh projects

List the Odoo.sh projects you can reach.

osh projects [OPTIONS] COMMAND [ARGS]...
Command Description
osh projects list List the projects you can reach, with their repository and address.

osh projects list

List the projects you can reach, with their repository and address.

osh projects list [OPTIONS]

Example:

osh projects list

osh ssh

Open a shell on the branch's latest build, with your own ssh, its configuration and its keys.

osh ssh [OPTIONS] [SSH_ARGS]...
Argument Description
[SSH_ARGS]... What to give ssh after the host: its own options, or a command to run on the build. Everything from the first one on is ssh's. Put -- before it when it starts with a dash.
Option Description Environment
--project PROJECT The project's name. Default: the git checkout's. OSH_PROJECT
--branch BRANCH The branch's name. Default: the git checkout's. OSH_BRANCH

Example:

osh ssh --branch staging -- ls