diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..85188c9 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,37 @@ +--- + +name: Docs + +on: + pull_request: + push: + branches: + - master + +jobs: + docs-help-md: + permissions: + contents: write + runs-on: ubuntu-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + target: x86_64-unknown-linux-gnu + + - name: Generate documentation + run: cargo run -- print-help-markdown > /tmp/CommandLineHelp.md + + - name: Compare documentation + run: | + output=$(diff /tmp/CommandLineHelp.md docs/CommandLineHelp.md) + if [ -n "$output" ]; then + echo "::error::$output" + echo "::error::Documentation is out of date. Please run 'cargo run -- print-help-markdown > docs/CommandLineHelp.md' and commit the changes." + exit 1 + fi diff --git a/Cargo.lock b/Cargo.lock index 44fc471..0eb445a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -453,6 +453,15 @@ dependencies = [ "clap_derive", ] +[[package]] +name = "clap-markdown" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ebc67e6266e14f8b31541c2f204724fa2ac7ad5c17d6f5908fbb92a60f42cff" +dependencies = [ + "clap", +] + [[package]] name = "clap_builder" version = "4.4.9" @@ -489,6 +498,7 @@ version = "0.2.7" dependencies = [ "anyhow", "clap", + "clap-markdown", "dirs", "envtestkit", "futures", diff --git a/Cargo.toml b/Cargo.toml index a2c32aa..7e65389 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,10 @@ path = "src/main.rs" [dependencies] anyhow = "1.0.65" clap = { version = "4.0.17", features = ["derive", "cargo"] } +clap-markdown = "0.1.4" dirs = "4.0.0" +futures = "0.3.28" +glob = "0.3.1" hex = "0.4.3" http-auth-basic = "0.3.3" indicatif = "0.17.2" @@ -20,8 +23,12 @@ log = { version = "0.4.17", features = ["release_max_level_info", "max_level_deb openssl = { version = '0.10', features = ["vendored"] } prettytable-rs = "0.10.0" protobuf = "3.3.0" +rayon = "1.7.0" +regex = "1.9.3" reqwest = { version = "0.11.12", features = ["json", "blocking", "multipart"] } rpassword = "7.2.0" +sentry = "0.31.5" +sentry-anyhow = "0.31.5" serde = { version = "1.0.147", features = ["derive"] } serde_json = "1.0.87" serde_yaml = "0.9.17" @@ -32,18 +39,12 @@ strum = "0.25" strum_macros = "0.25" term = "0.7.0" thiserror = "1.0.37" -sentry = "0.31.5" -sentry-anyhow = "0.31.5" -rayon = "1.7.0" -warp = "0.3.5" tokio = "1.32.0" tokio-stream = "0.1.14" -regex = "1.9.3" walkdir = "2.3.3" -glob = "0.3.1" -futures = "0.3.28" +warp = "0.3.5" [dev-dependencies] -httpmock = "0.6" envtestkit = "1.1.2" +httpmock = "0.6" tempfile = "3.8" diff --git a/docs/CommandLineHelp copy.md b/docs/CommandLineHelp copy.md new file mode 100644 index 0000000..80ed890 --- /dev/null +++ b/docs/CommandLineHelp copy.md @@ -0,0 +1,671 @@ +# Command-Line Help for `cli` + +This document contains the help content for the `cli` command-line program. + +**Command Overview:** + +* [`cli`↴](#cli) +* [`cli login`↴](#cli-login) +* [`cli logout`↴](#cli-logout) +* [`cli screen`↴](#cli-screen) +* [`cli screen list`↴](#cli-screen-list) +* [`cli screen get`↴](#cli-screen-get) +* [`cli screen add`↴](#cli-screen-add) + +* [`cli asset delete`↴](#cli-asset-delete) +* [`cli asset inject-js`↴](#cli-asset-inject-js) +* [`cli asset set-headers`↴](#cli-asset-set-headers) +* [`cli asset update-headers`↴](#cli-asset-update-headers) +* [`cli asset basic-auth`↴](#cli-asset-basic-auth) +* [`cli asset bearer-auth`↴](#cli-asset-bearer-auth) +* [`cli playlist`↴](#cli-playlist) +* [`cli playlist create`↴](#cli-playlist-create) +* [`cli playlist list`↴](#cli-playlist-list) +* [`cli playlist get`↴](#cli-playlist-get) +* [`cli playlist delete`↴](#cli-playlist-delete) +* [`cli playlist append`↴](#cli-playlist-append) +* [`cli playlist prepend`↴](#cli-playlist-prepend) +* [`cli playlist update`↴](#cli-playlist-update) +* [`cli edge-app`↴](#cli-edge-app) +* [`cli edge-app create`↴](#cli-edge-app-create) +* [`cli edge-app list`↴](#cli-edge-app-list) +* [`cli edge-app rename`↴](#cli-edge-app-rename) +* [`cli edge-app run`↴](#cli-edge-app-run) +* [`cli edge-app version`↴](#cli-edge-app-version) +* [`cli edge-app version list`↴](#cli-edge-app-version-list) +* [`cli edge-app version promote`↴](#cli-edge-app-version-promote) +* [`cli edge-app setting`↴](#cli-edge-app-setting) +* [`cli edge-app setting list`↴](#cli-edge-app-setting-list) +* [`cli edge-app setting set`↴](#cli-edge-app-setting-set) +* [`cli edge-app secret`↴](#cli-edge-app-secret) +* [`cli edge-app secret list`↴](#cli-edge-app-secret-list) +* [`cli edge-app secret set`↴](#cli-edge-app-secret-set) +* [`cli edge-app upload`↴](#cli-edge-app-upload) +* [`cli edge-app delete`↴](#cli-edge-app-delete) +* [`cli edge-app validate`↴](#cli-edge-app-validate) + +## `cli` + +Command line interface is intended for quick interaction with Screenly through terminal. Moreover, this CLI is built such that it can be used for automating tasks. + +**Usage:** `cli [OPTIONS] ` + +###### **Subcommands:** + +* `login` — Logins with the token and stores it for further use if it's valid. You can set API_TOKEN environment variable to override used API token +* `logout` — Logouts and removes stored token +* `screen` — Screen related commands +* `asset` — Asset related commands +* `playlist` — Playlist related commands +* `edge-app` — Edge App related commands + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli login` + +Logins with the token and stores it for further use if it's valid. You can set API_TOKEN environment variable to override used API token + +**Usage:** `cli login` + + + +## `cli logout` + +Logouts and removes stored token + +**Usage:** `cli logout` + + + +## `cli screen` + +Screen related commands + +**Usage:** `cli screen ` + +###### **Subcommands:** + +* `list` — Lists your screens +* `get` — Gets a single screen by id +* `add` — Adds a new screen +* `delete` — Deletes a screen. This cannot be undone + + + +## `cli screen list` + +Lists your screens + +**Usage:** `cli screen list [OPTIONS]` + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli screen get` + +Gets a single screen by id + +**Usage:** `cli screen get [OPTIONS] ` + +###### **Arguments:** + +* `` — UUID of the screen + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli screen add` + +Adds a new screen + +**Usage:** `cli screen add [OPTIONS] [NAME]` + +###### **Arguments:** + +* `` — Pin code created with registrations endpoint +* `` — Optional name of the new screen + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli screen delete` + +Deletes a screen. This cannot be undone + +**Usage:** `cli screen delete ` + +###### **Arguments:** + +* `` — UUID of the screen to be deleted + + + +## `cli asset` + +Asset related commands + +**Usage:** `cli asset ` + +###### **Subcommands:** + +* `list` — Lists your assets +* `get` — Gets a single asset by id +* `add` — Adds a new asset +* `delete` — Deletes an asset. This cannot be undone +* `inject-js` — Injects JavaScript code inside of the web asset. It will be executed once the asset loads during playback +* `set-headers` — Sets HTTP headers for web asset +* `update-headers` — Updates HTTP headers for web asset +* `basic-auth` — Shortcut for setting up basic authentication headers +* `bearer-auth` — Shortcut for setting up bearer authentication headers + + + +## `cli asset list` + +Lists your assets + +**Usage:** `cli asset list [OPTIONS]` + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli asset get` + +Gets a single asset by id + +**Usage:** `cli asset get [OPTIONS] ` + +###### **Arguments:** + +* `` — UUID of the asset + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli asset add` + +Adds a new asset + +**Usage:** `cli asset add [OPTIONS] ` + +###### **Arguments:** + +* `<PATH>` — Path to local file or URL for remote file +* `<TITLE>` — Asset title + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli asset delete` + +Deletes an asset. This cannot be undone + +**Usage:** `cli asset delete <UUID>` + +###### **Arguments:** + +* `<UUID>` — UUID of the asset to be deleted + + + +## `cli asset inject-js` + +Injects JavaScript code inside of the web asset. It will be executed once the asset loads during playback + +**Usage:** `cli asset inject-js <UUID> <PATH>` + +###### **Arguments:** + +* `<UUID>` — UUID of the web asset to inject with JavaScript +* `<PATH>` — Path to local file or URL for remote file + + + +## `cli asset set-headers` + +Sets HTTP headers for web asset + +**Usage:** `cli asset set-headers <UUID> <HEADERS>` + +###### **Arguments:** + +* `<UUID>` — UUID of the web asset to set http headers +* `<HEADERS>` — HTTP headers in the following form `header1=value1[,header2=value2[,...]]`. This command replaces all headers of the asset with the given headers (when an empty string is given, e.g. --set-headers "", all existing headers are removed, if any) + + + +## `cli asset update-headers` + +Updates HTTP headers for web asset + +**Usage:** `cli asset update-headers <UUID> <HEADERS>` + +###### **Arguments:** + +* `<UUID>` — UUID of the web asset to set http headers +* `<HEADERS>` — HTTP headers in the following form `header1=value1[,header2=value2[,...]]`. This command updates only the given headers (adding them if new), leaving any other headers unchanged + + + +## `cli asset basic-auth` + +Shortcut for setting up basic authentication headers + +**Usage:** `cli asset basic-auth <UUID> <CREDENTIALS>` + +###### **Arguments:** + +* `<UUID>` — UUID of the web asset to set up basic authentication for +* `<CREDENTIALS>` — Basic authentication credentials in "user=password" form + + + +## `cli asset bearer-auth` + +Shortcut for setting up bearer authentication headers + +**Usage:** `cli asset bearer-auth <UUID> <TOKEN>` + +###### **Arguments:** + +* `<UUID>` — UUID of the web asset to set up basic authentication for +* `<TOKEN>` — Bearer token + + + +## `cli playlist` + +Playlist related commands + +**Usage:** `cli playlist <COMMAND>` + +###### **Subcommands:** + +* `create` — Creates a new playlist +* `list` — Lists your playlists +* `get` — Gets a single playlist by id +* `delete` — Deletes a playlist. This cannot be undone +* `append` — Adds an asset to the end of the playlist +* `prepend` — Adds an asset to the beginning of the playlist +* `update` — Patches a given playlist + + + +## `cli playlist create` + +Creates a new playlist + +**Usage:** `cli playlist create [OPTIONS] <TITLE> [PREDICATE]` + +###### **Arguments:** + +* `<TITLE>` — Title of the new playlist +* `<PREDICATE>` — Predicate for the new playlist. If not specified it will be set to "TRUE" + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli playlist list` + +Lists your playlists + +**Usage:** `cli playlist list [OPTIONS]` + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli playlist get` + +Gets a single playlist by id + +**Usage:** `cli playlist get <UUID>` + +###### **Arguments:** + +* `<UUID>` — UUID of the playlist + + + +## `cli playlist delete` + +Deletes a playlist. This cannot be undone + +**Usage:** `cli playlist delete <UUID>` + +###### **Arguments:** + +* `<UUID>` — UUID of the playlist to be deleted + + + +## `cli playlist append` + +Adds an asset to the end of the playlist + +**Usage:** `cli playlist append [OPTIONS] <UUID> <ASSET_UUID> [DURATION]` + +###### **Arguments:** + +* `<UUID>` — UUID of the playlist +* `<ASSET_UUID>` — UUID of the asset +* `<DURATION>` — Duration of the playlist item in seconds. If not specified it will be set to 15 seconds + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli playlist prepend` + +Adds an asset to the beginning of the playlist + +**Usage:** `cli playlist prepend [OPTIONS] <UUID> <ASSET_UUID> [DURATION]` + +###### **Arguments:** + +* `<UUID>` — UUID of the playlist +* `<ASSET_UUID>` — UUID of the asset +* `<DURATION>` — Duration of the playlist item in seconds. If not specified it will be set to 15 seconds + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli playlist update` + +Patches a given playlist + +**Usage:** `cli playlist update` + + + +## `cli edge-app` + +Edge App related commands + +**Usage:** `cli edge-app <COMMAND>` + +###### **Subcommands:** + +* `create` — Creates Edge App in the store +* `list` — Lists your Edge Apps +* `rename` — Renames Edge App +* `run` — Runs Edge App emulator +* `version` — Version commands +* `setting` — Settings commands +* `secret` — Secrets commands +* `upload` — Uploads assets and settings of the Edge App +* `delete` — Deletes an Edge App. This cannot be undone +* `validate` — Validates Edge App manifest file + + + +## `cli edge-app create` + +Creates Edge App in the store + +**Usage:** `cli edge-app create [OPTIONS] --name <NAME>` + +###### **Options:** + +* `-n`, `--name <NAME>` — Edge App name +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-i`, `--in-place` — Use an existing Edge App directory with the manifest and index.html + + + +## `cli edge-app list` + +Lists your Edge Apps + +**Usage:** `cli edge-app list [OPTIONS]` + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli edge-app rename` + +Renames Edge App + +**Usage:** `cli edge-app rename [OPTIONS] --name <NAME>` + +###### **Options:** + +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-a`, `--app-id <APP_ID>` — Edge App id. If not specified CLI will use the id from the manifest +* `-n`, `--name <NAME>` — Edge App name + + + +## `cli edge-app run` + +Runs Edge App emulator + +**Usage:** `cli edge-app run [OPTIONS]` + +###### **Options:** + +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-s`, `--secrets <SECRETS>` +* `-g`, `--generate-mock-data` — Generates mock data to be used with Edge App run + + + +## `cli edge-app version` + +Version commands + +**Usage:** `cli edge-app version <COMMAND>` + +###### **Subcommands:** + +* `list` — Lists Edge App versions +* `promote` — Promotes Edge App revision to channel + + + +## `cli edge-app version list` + +Lists Edge App versions + +**Usage:** `cli edge-app version list [OPTIONS]` + +###### **Options:** + +* `-a`, `--app-id <APP_ID>` — Edge app id. If not specified CLI will use the id from the manifest +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-j`, `--json` — Enables JSON output + + + +## `cli edge-app version promote` + +Promotes Edge App revision to channel + +**Usage:** `cli edge-app version promote [OPTIONS]` + +###### **Options:** + +* `-r`, `--revision <REVISION>` — Edge app revision to promote +* `-c`, `--channel <CHANNEL>` — Channel to promote to. If not specified CLI will use stable channel + + Default value: `stable` +* `-i`, `--installation-id <INSTALLATION_ID>` — Edge App Installation id. If not specified, CLI will use the installation_id from the manifest +* `--latest` — Use the latest revision of the Edge App + + Default value: `false` +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory + + + +## `cli edge-app setting` + +Settings commands + +**Usage:** `cli edge-app setting <COMMAND>` + +###### **Subcommands:** + +* `list` — Lists Edge App settings +* `set` — Sets Edge App setting + + + +## `cli edge-app setting list` + +Lists Edge App settings + +**Usage:** `cli edge-app setting list [OPTIONS]` + +###### **Options:** + +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-i`, `--installation-id <INSTALLATION_ID>` — Edge App Installation id. If not specified, CLI will use the installation_id from the manifest +* `-j`, `--json` — Enables JSON output + + + +## `cli edge-app setting set` + +Sets Edge App setting + +**Usage:** `cli edge-app setting set [OPTIONS] <SETTING_PAIR>` + +###### **Arguments:** + +* `<SETTING_PAIR>` — Key value pair of the setting to be set in the form of `key=value` + +###### **Options:** + +* `-i`, `--installation-id <INSTALLATION_ID>` — Edge App Installation id. If not specified, CLI will use the installation_id from the manifest +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory + + + +## `cli edge-app secret` + +Secrets commands + +**Usage:** `cli edge-app secret <COMMAND>` + +###### **Subcommands:** + +* `list` — Lists Edge App secrets +* `set` — Sets Edge App secret + + + +## `cli edge-app secret list` + +Lists Edge App secrets + +**Usage:** `cli edge-app secret list [OPTIONS]` + +###### **Options:** + +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-i`, `--installation-id <INSTALLATION_ID>` — Edge App Installation id. If not specified, CLI will use the installation_id from the manifest +* `-j`, `--json` — Enables JSON output + + + +## `cli edge-app secret set` + +Sets Edge App secret + +**Usage:** `cli edge-app secret set [OPTIONS] <SECRET_PAIR>` + +###### **Arguments:** + +* `<SECRET_PAIR>` — Key value pair of the secret to be set in the form of `key=value` + +###### **Options:** + +* `-i`, `--installation-id <INSTALLATION_ID>` — Edge App Installation id. If not specified, CLI will use the installation_id from the manifest +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory + + + +## `cli edge-app upload` + +Uploads assets and settings of the Edge App + +**Usage:** `cli edge-app upload [OPTIONS]` + +###### **Options:** + +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-a`, `--app-id <APP_ID>` — Edge App id. If not specified CLI will use the id from the manifest +* `-d`, `--delete-missing-settings <DELETE_MISSING_SETTINGS>` + + Possible values: `true`, `false` + + + + +## `cli edge-app delete` + +Deletes an Edge App. This cannot be undone + +**Usage:** `cli edge-app delete [OPTIONS]` + +###### **Options:** + +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-a`, `--app-id <APP_ID>` — Edge App id. If not specified CLI will use the id from the manifest + + + +## `cli edge-app validate` + +Validates Edge App manifest file + +**Usage:** `cli edge-app validate [OPTIONS]` + +###### **Options:** + +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory + + + +<hr/> + +<small><i> + This document was generated automatically by + <a href="https://crates.io/crates/clap-markdown"><code>clap-markdown</code></a>. +</i></small> + diff --git a/docs/CommandLineHelp.md b/docs/CommandLineHelp.md new file mode 100644 index 0000000..af65e41 --- /dev/null +++ b/docs/CommandLineHelp.md @@ -0,0 +1,675 @@ +# Command-Line Help for `cli` + +This document contains the help content for the `cli` command-line program. + +**Command Overview:** + +* [`cli`↴](#cli) +* [`cli login`↴](#cli-login) +* [`cli logout`↴](#cli-logout) +* [`cli screen`↴](#cli-screen) +* [`cli screen list`↴](#cli-screen-list) +* [`cli screen get`↴](#cli-screen-get) +* [`cli screen add`↴](#cli-screen-add) +* [`cli screen delete`↴](#cli-screen-delete) +* [`cli asset`↴](#cli-asset) +* [`cli asset list`↴](#cli-asset-list) +* [`cli asset get`↴](#cli-asset-get) +* [`cli asset add`↴](#cli-asset-add) +* [`cli asset delete`↴](#cli-asset-delete) +* [`cli asset inject-js`↴](#cli-asset-inject-js) +* [`cli asset set-headers`↴](#cli-asset-set-headers) +* [`cli asset update-headers`↴](#cli-asset-update-headers) +* [`cli asset basic-auth`↴](#cli-asset-basic-auth) +* [`cli asset bearer-auth`↴](#cli-asset-bearer-auth) +* [`cli playlist`↴](#cli-playlist) +* [`cli playlist create`↴](#cli-playlist-create) +* [`cli playlist list`↴](#cli-playlist-list) +* [`cli playlist get`↴](#cli-playlist-get) +* [`cli playlist delete`↴](#cli-playlist-delete) +* [`cli playlist append`↴](#cli-playlist-append) +* [`cli playlist prepend`↴](#cli-playlist-prepend) +* [`cli playlist update`↴](#cli-playlist-update) +* [`cli edge-app`↴](#cli-edge-app) +* [`cli edge-app create`↴](#cli-edge-app-create) +* [`cli edge-app list`↴](#cli-edge-app-list) +* [`cli edge-app rename`↴](#cli-edge-app-rename) +* [`cli edge-app run`↴](#cli-edge-app-run) +* [`cli edge-app version`↴](#cli-edge-app-version) +* [`cli edge-app version list`↴](#cli-edge-app-version-list) +* [`cli edge-app version promote`↴](#cli-edge-app-version-promote) +* [`cli edge-app setting`↴](#cli-edge-app-setting) +* [`cli edge-app setting list`↴](#cli-edge-app-setting-list) +* [`cli edge-app setting set`↴](#cli-edge-app-setting-set) +* [`cli edge-app secret`↴](#cli-edge-app-secret) +* [`cli edge-app secret list`↴](#cli-edge-app-secret-list) +* [`cli edge-app secret set`↴](#cli-edge-app-secret-set) +* [`cli edge-app upload`↴](#cli-edge-app-upload) +* [`cli edge-app delete`↴](#cli-edge-app-delete) +* [`cli edge-app validate`↴](#cli-edge-app-validate) + +## `cli` + +Command line interface is intended for quick interaction with Screenly through terminal. Moreover, this CLI is built such that it can be used for automating tasks. + +**Usage:** `cli [OPTIONS] <COMMAND>` + +###### **Subcommands:** + +* `login` — Logins with the token and stores it for further use if it's valid. You can set API_TOKEN environment variable to override used API token +* `logout` — Logouts and removes stored token +* `screen` — Screen related commands +* `asset` — Asset related commands +* `playlist` — Playlist related commands +* `edge-app` — Edge App related commands + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli login` + +Logins with the token and stores it for further use if it's valid. You can set API_TOKEN environment variable to override used API token + +**Usage:** `cli login` + + + +## `cli logout` + +Logouts and removes stored token + +**Usage:** `cli logout` + + + +## `cli screen` + +Screen related commands + +**Usage:** `cli screen <COMMAND>` + +###### **Subcommands:** + +* `list` — Lists your screens +* `get` — Gets a single screen by id +* `add` — Adds a new screen +* `delete` — Deletes a screen. This cannot be undone + + + +## `cli screen list` + +Lists your screens + +**Usage:** `cli screen list [OPTIONS]` + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli screen get` + +Gets a single screen by id + +**Usage:** `cli screen get [OPTIONS] <UUID>` + +###### **Arguments:** + +* `<UUID>` — UUID of the screen + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli screen add` + +Adds a new screen + +**Usage:** `cli screen add [OPTIONS] <PIN> [NAME]` + +###### **Arguments:** + +* `<PIN>` — Pin code created with registrations endpoint +* `<NAME>` — Optional name of the new screen + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli screen delete` + +Deletes a screen. This cannot be undone + +**Usage:** `cli screen delete <UUID>` + +###### **Arguments:** + +* `<UUID>` — UUID of the screen to be deleted + + + +## `cli asset` + +Asset related commands + +**Usage:** `cli asset <COMMAND>` + +###### **Subcommands:** + +* `list` — Lists your assets +* `get` — Gets a single asset by id +* `add` — Adds a new asset +* `delete` — Deletes an asset. This cannot be undone +* `inject-js` — Injects JavaScript code inside of the web asset. It will be executed once the asset loads during playback +* `set-headers` — Sets HTTP headers for web asset +* `update-headers` — Updates HTTP headers for web asset +* `basic-auth` — Shortcut for setting up basic authentication headers +* `bearer-auth` — Shortcut for setting up bearer authentication headers + + + +## `cli asset list` + +Lists your assets + +**Usage:** `cli asset list [OPTIONS]` + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli asset get` + +Gets a single asset by id + +**Usage:** `cli asset get [OPTIONS] <UUID>` + +###### **Arguments:** + +* `<UUID>` — UUID of the asset + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli asset add` + +Adds a new asset + +**Usage:** `cli asset add [OPTIONS] <PATH> <TITLE>` + +###### **Arguments:** + +* `<PATH>` — Path to local file or URL for remote file +* `<TITLE>` — Asset title + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli asset delete` + +Deletes an asset. This cannot be undone + +**Usage:** `cli asset delete <UUID>` + +###### **Arguments:** + +* `<UUID>` — UUID of the asset to be deleted + + + +## `cli asset inject-js` + +Injects JavaScript code inside of the web asset. It will be executed once the asset loads during playback + +**Usage:** `cli asset inject-js <UUID> <PATH>` + +###### **Arguments:** + +* `<UUID>` — UUID of the web asset to inject with JavaScript +* `<PATH>` — Path to local file or URL for remote file + + + +## `cli asset set-headers` + +Sets HTTP headers for web asset + +**Usage:** `cli asset set-headers <UUID> <HEADERS>` + +###### **Arguments:** + +* `<UUID>` — UUID of the web asset to set http headers +* `<HEADERS>` — HTTP headers in the following form `header1=value1[,header2=value2[,...]]`. This command replaces all headers of the asset with the given headers (when an empty string is given, e.g. --set-headers "", all existing headers are removed, if any) + + + +## `cli asset update-headers` + +Updates HTTP headers for web asset + +**Usage:** `cli asset update-headers <UUID> <HEADERS>` + +###### **Arguments:** + +* `<UUID>` — UUID of the web asset to set http headers +* `<HEADERS>` — HTTP headers in the following form `header1=value1[,header2=value2[,...]]`. This command updates only the given headers (adding them if new), leaving any other headers unchanged + + + +## `cli asset basic-auth` + +Shortcut for setting up basic authentication headers + +**Usage:** `cli asset basic-auth <UUID> <CREDENTIALS>` + +###### **Arguments:** + +* `<UUID>` — UUID of the web asset to set up basic authentication for +* `<CREDENTIALS>` — Basic authentication credentials in "user=password" form + + + +## `cli asset bearer-auth` + +Shortcut for setting up bearer authentication headers + +**Usage:** `cli asset bearer-auth <UUID> <TOKEN>` + +###### **Arguments:** + +* `<UUID>` — UUID of the web asset to set up basic authentication for +* `<TOKEN>` — Bearer token + + + +## `cli playlist` + +Playlist related commands + +**Usage:** `cli playlist <COMMAND>` + +###### **Subcommands:** + +* `create` — Creates a new playlist +* `list` — Lists your playlists +* `get` — Gets a single playlist by id +* `delete` — Deletes a playlist. This cannot be undone +* `append` — Adds an asset to the end of the playlist +* `prepend` — Adds an asset to the beginning of the playlist +* `update` — Patches a given playlist + + + +## `cli playlist create` + +Creates a new playlist + +**Usage:** `cli playlist create [OPTIONS] <TITLE> [PREDICATE]` + +###### **Arguments:** + +* `<TITLE>` — Title of the new playlist +* `<PREDICATE>` — Predicate for the new playlist. If not specified it will be set to "TRUE" + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli playlist list` + +Lists your playlists + +**Usage:** `cli playlist list [OPTIONS]` + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli playlist get` + +Gets a single playlist by id + +**Usage:** `cli playlist get <UUID>` + +###### **Arguments:** + +* `<UUID>` — UUID of the playlist + + + +## `cli playlist delete` + +Deletes a playlist. This cannot be undone + +**Usage:** `cli playlist delete <UUID>` + +###### **Arguments:** + +* `<UUID>` — UUID of the playlist to be deleted + + + +## `cli playlist append` + +Adds an asset to the end of the playlist + +**Usage:** `cli playlist append [OPTIONS] <UUID> <ASSET_UUID> [DURATION]` + +###### **Arguments:** + +* `<UUID>` — UUID of the playlist +* `<ASSET_UUID>` — UUID of the asset +* `<DURATION>` — Duration of the playlist item in seconds. If not specified it will be set to 15 seconds + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli playlist prepend` + +Adds an asset to the beginning of the playlist + +**Usage:** `cli playlist prepend [OPTIONS] <UUID> <ASSET_UUID> [DURATION]` + +###### **Arguments:** + +* `<UUID>` — UUID of the playlist +* `<ASSET_UUID>` — UUID of the asset +* `<DURATION>` — Duration of the playlist item in seconds. If not specified it will be set to 15 seconds + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli playlist update` + +Patches a given playlist + +**Usage:** `cli playlist update` + + + +## `cli edge-app` + +Edge App related commands + +**Usage:** `cli edge-app <COMMAND>` + +###### **Subcommands:** + +* `create` — Creates Edge App in the store +* `list` — Lists your Edge Apps +* `rename` — Renames Edge App +* `run` — Runs Edge App emulator +* `version` — Version commands +* `setting` — Settings commands +* `secret` — Secrets commands +* `upload` — Uploads assets and settings of the Edge App +* `delete` — Deletes an Edge App. This cannot be undone +* `validate` — Validates Edge App manifest file + + + +## `cli edge-app create` + +Creates Edge App in the store + +**Usage:** `cli edge-app create [OPTIONS] --name <NAME>` + +###### **Options:** + +* `-n`, `--name <NAME>` — Edge App name +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-i`, `--in-place` — Use an existing Edge App directory with the manifest and index.html + + + +## `cli edge-app list` + +Lists your Edge Apps + +**Usage:** `cli edge-app list [OPTIONS]` + +###### **Options:** + +* `-j`, `--json` — Enables JSON output + + + +## `cli edge-app rename` + +Renames Edge App + +**Usage:** `cli edge-app rename [OPTIONS] --name <NAME>` + +###### **Options:** + +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-a`, `--app-id <APP_ID>` — Edge App id. If not specified CLI will use the id from the manifest +* `-n`, `--name <NAME>` — Edge App name + + + +## `cli edge-app run` + +Runs Edge App emulator + +**Usage:** `cli edge-app run [OPTIONS]` + +###### **Options:** + +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-s`, `--secrets <SECRETS>` +* `-g`, `--generate-mock-data` — Generates mock data to be used with Edge App run + + + +## `cli edge-app version` + +Version commands + +**Usage:** `cli edge-app version <COMMAND>` + +###### **Subcommands:** + +* `list` — Lists Edge App versions +* `promote` — Promotes Edge App revision to channel + + + +## `cli edge-app version list` + +Lists Edge App versions + +**Usage:** `cli edge-app version list [OPTIONS]` + +###### **Options:** + +* `-a`, `--app-id <APP_ID>` — Edge app id. If not specified CLI will use the id from the manifest +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-j`, `--json` — Enables JSON output + + + +## `cli edge-app version promote` + +Promotes Edge App revision to channel + +**Usage:** `cli edge-app version promote [OPTIONS]` + +###### **Options:** + +* `-r`, `--revision <REVISION>` — Edge app revision to promote +* `-c`, `--channel <CHANNEL>` — Channel to promote to. If not specified CLI will use stable channel + + Default value: `stable` +* `-i`, `--installation-id <INSTALLATION_ID>` — Edge App Installation id. If not specified, CLI will use the installation_id from the manifest +* `--latest` — Use the latest revision of the Edge App + + Default value: `false` +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory + + + +## `cli edge-app setting` + +Settings commands + +**Usage:** `cli edge-app setting <COMMAND>` + +###### **Subcommands:** + +* `list` — Lists Edge App settings +* `set` — Sets Edge App setting + + + +## `cli edge-app setting list` + +Lists Edge App settings + +**Usage:** `cli edge-app setting list [OPTIONS]` + +###### **Options:** + +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-i`, `--installation-id <INSTALLATION_ID>` — Edge App Installation id. If not specified, CLI will use the installation_id from the manifest +* `-j`, `--json` — Enables JSON output + + + +## `cli edge-app setting set` + +Sets Edge App setting + +**Usage:** `cli edge-app setting set [OPTIONS] <SETTING_PAIR>` + +###### **Arguments:** + +* `<SETTING_PAIR>` — Key value pair of the setting to be set in the form of `key=value` + +###### **Options:** + +* `-i`, `--installation-id <INSTALLATION_ID>` — Edge App Installation id. If not specified, CLI will use the installation_id from the manifest +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory + + + +## `cli edge-app secret` + +Secrets commands + +**Usage:** `cli edge-app secret <COMMAND>` + +###### **Subcommands:** + +* `list` — Lists Edge App secrets +* `set` — Sets Edge App secret + + + +## `cli edge-app secret list` + +Lists Edge App secrets + +**Usage:** `cli edge-app secret list [OPTIONS]` + +###### **Options:** + +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-i`, `--installation-id <INSTALLATION_ID>` — Edge App Installation id. If not specified, CLI will use the installation_id from the manifest +* `-j`, `--json` — Enables JSON output + + + +## `cli edge-app secret set` + +Sets Edge App secret + +**Usage:** `cli edge-app secret set [OPTIONS] <SECRET_PAIR>` + +###### **Arguments:** + +* `<SECRET_PAIR>` — Key value pair of the secret to be set in the form of `key=value` + +###### **Options:** + +* `-i`, `--installation-id <INSTALLATION_ID>` — Edge App Installation id. If not specified, CLI will use the installation_id from the manifest +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory + + + +## `cli edge-app upload` + +Uploads assets and settings of the Edge App + +**Usage:** `cli edge-app upload [OPTIONS]` + +###### **Options:** + +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-a`, `--app-id <APP_ID>` — Edge App id. If not specified CLI will use the id from the manifest +* `-d`, `--delete-missing-settings <DELETE_MISSING_SETTINGS>` + + Possible values: `true`, `false` + + + + +## `cli edge-app delete` + +Deletes an Edge App. This cannot be undone + +**Usage:** `cli edge-app delete [OPTIONS]` + +###### **Options:** + +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory +* `-a`, `--app-id <APP_ID>` — Edge App id. If not specified CLI will use the id from the manifest + + + +## `cli edge-app validate` + +Validates Edge App manifest file + +**Usage:** `cli edge-app validate [OPTIONS]` + +###### **Options:** + +* `-p`, `--path <PATH>` — Path to the directory with the manifest. If not specified CLI will use the current working directory + + + +<hr/> + +<small><i> + This document was generated automatically by + <a href="https://crates.io/crates/clap-markdown"><code>clap-markdown</code></a>. +</i></small> + diff --git a/src/cli.rs b/src/cli.rs index 866cb7b..a58b772 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -41,6 +41,9 @@ pub struct Cli { #[arg(short, long, action = clap::ArgAction::SetTrue)] json: Option<bool>, + #[arg(long, hide = true)] + pub markdown_help: bool, + #[command(subcommand)] pub(crate) command: Commands, } @@ -63,6 +66,9 @@ pub enum Commands { /// Edge App related commands. #[command(subcommand)] EdgeApp(EdgeAppCommands), + // For generating `docs/CommandLineHelp.md`. + #[clap(hide = true)] + PrintHelpMarkdown {}, } #[derive(Subcommand, Clone, PartialEq, Eq, PartialOrd, Ord)] @@ -576,6 +582,9 @@ pub fn handle_cli(cli: &Cli) { Authentication::remove_token().expect("Failed to remove token."); info!("Logout successful."); std::process::exit(0); + }, + Commands::PrintHelpMarkdown {} => { + clap_markdown::print_help_markdown::<Cli>(); } } }