-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add section on CLI tool #28
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
015b159
Add page for CLI
martin-helmich b7c22f7
Merge remote-tracking branch 'origin/master' into feature/cli
martin-helmich 4969948
Bring CLI docs up to date
martin-helmich 1de473a
Update env var usage
martin-helmich fb77d1c
Merge remote-tracking branch 'origin/master' into feature/cli
martin-helmich d093d1b
Streamline CLI docs
martin-helmich ee19984
Add stability warning
martin-helmich cd5e369
Add CLI hint on Redis page
martin-helmich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
--- | ||
title: Using the mittwald CLI | ||
sidebar_label: CLI | ||
description: An introduction on how to use the mittwald command-line interface (CLI) | ||
--- | ||
|
||
:::danger | ||
|
||
Please note that the CLI is currently in an experimental state, and may change without prior notice. We're happy to receive feedback and feature requests via [GitHub issues](https://github.com/mittwald/cli/issues). | ||
|
||
::: | ||
|
||
## Installing | ||
|
||
### Any OS, using NPM | ||
|
||
With a local Node.js installation, you can install the mittwald CLI using NPM: | ||
|
||
``` | ||
$ npm install -g @mittwald/cli | ||
$ mw --help | ||
``` | ||
|
||
### macOS, using the installer package | ||
|
||
Retrieve the latest release package (`*.pkg` file) from our [releases page](https://github.com/mittwald/cli/releases), and run the installer. Pay attention to the processor architecture, and load the `mw-*-arm64.pkg` file when you're using an ARM Mac, and the `mw-*-amd64.pkg` file when using an Intel Mac. | ||
|
||
### macOS, using Homebrew | ||
|
||
``` | ||
$ brew tap mittwald/cli | ||
$ brew install mittwald-cli | ||
$ mw --help | ||
``` | ||
|
||
### Windows, using the installer package | ||
|
||
Retrieve the latest release package (`*.exe` file) from our [releases page](https://github.com/mittwald/cli/releases), and run the installer. | ||
|
||
### Using Docker | ||
|
||
``` | ||
$ export MITTWALD_API_TOKEN=xxx | ||
$ docker run \ | ||
--rm \ | ||
-it \ | ||
-e MITTWALD_API_TOKEN \ | ||
mittwald/cli --help | ||
``` | ||
|
||
## Authenticating | ||
|
||
To use the CLI, you first need to authenticate your client using an API token. Have a look at the ["Obtaining an API token" section](../../intro#obtaining-an-api-token) of the introduction for details on how to obtain an API token. | ||
|
||
:::note | ||
|
||
Additional authentication mechanisms (like an OAuth2 flow in which you can use your browser to authenticate) are planned for the future. | ||
|
||
::: | ||
|
||
Having a token, you can authenticate like this: | ||
|
||
``` | ||
$ mw login token | ||
Enter your mStudio API token: ******** | ||
``` | ||
|
||
For non-interactive usage (for example in CI/CD pipelines), you can also pass the token via the `MITTWALD_API_TOKEN` environment variable: | ||
|
||
``` | ||
$ export MITTWALD_API_TOKEN=******** | ||
$ mw login status | ||
``` | ||
|
||
## General usage | ||
|
||
### Project/Server/Organization contexts | ||
|
||
Many commands of the CLI act in the context of a certain project, server or organization, and as such require a `--project-id`, `--server-id` or `--org-id` flag. You can either pass these flags to each command, or set them globally using the `mw context` command: | ||
|
||
```bash | ||
$ mw context set --project-id=... | ||
$ mw project set --server-id=... | ||
$ mw project set --org-id=... | ||
``` | ||
|
||
Some commands that _create_ one of these resources also have a `--update-context` flag that will automatically set the context to the newly created resource: | ||
|
||
```bash | ||
$ mw project create --description="..." --update-context | ||
``` | ||
|
||
### Non-interactive usage | ||
|
||
If you intend to use `mw` non-interactively (for example in scripts, or CI/CD pipelines), many commands support a `--output|-o` flag that allows you to specify the output format. The default is `text`, which is a human-readable format, but you can also use `json` to get machine-readable output, which you can then easily process using tools like `jq`: | ||
|
||
```bash | ||
PROJECT_ID=$(mw project get -ojson | jq -r '.id') | ||
``` | ||
|
||
Many mutating commands also print progress information about long-running operations. To suppress this output, you can use the `--quiet|-q` flag. In these cases, most commands will fall back to printing the ID of the created resource, which you can then use to retrieve the full resource information: | ||
|
||
```bash | ||
PROJECT_ID=$(mw project create --quiet --description="...") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
i18n/de/docusaurus-plugin-content-docs/current/api/sdks/cli.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--- | ||
title: Verwendung der mittwald CLI | ||
sidebar_label: CLI | ||
description: Eine Einführung in die Verwendung der mittwald-Befehlszeilenschnittstelle (CLI) | ||
--- | ||
|
||
## Installation | ||
|
||
### Jedes Betriebssystem, mit NPM | ||
|
||
Mit einer lokalen Node.js-Installation kannst du die mittwald CLI mit NPM installieren: | ||
|
||
``` | ||
$ npm install -g @mittwald/cli | ||
$ mw --help | ||
``` | ||
|
||
### macOS, mit dem Installationspaket | ||
|
||
Lade das neueste Installationspaket (`*.pkg`-Datei) von unserer [Releases-Seite](https://github.com/mittwald/cli/releases) herunter und führe den Installer aus. Achte auf die Prozessorarchitektur und lade die `mw-*-arm64.pkg`-Datei, wenn du einen ARM-Mac verwendest, und die `mw-*-amd64.pkg`-Datei, wenn du einen Intel-Mac verwendest. | ||
|
||
### macOS, mit Homebrew | ||
|
||
``` | ||
$ brew tap mittwald/cli | ||
$ brew install mittwald-cli | ||
$ mw --help | ||
``` | ||
|
||
### Windows, mit dem Installationspaket | ||
|
||
Lade das neueste Installationspaket (`*.exe`-Datei) von unserer [Releases-Seite](https://github.com/mittwald/cli/releases) herunter und führe den Installer aus. | ||
|
||
### Mit Docker | ||
|
||
``` | ||
$ export MITTWALD_API_TOKEN=xxx | ||
$ docker run \ | ||
--rm \ | ||
-it \ | ||
-e MITTWALD_API_TOKEN \ | ||
mittwald/cli --help | ||
``` | ||
|
||
## Authentifizierung | ||
|
||
Um die CLI zu verwenden, musst du dich zunächst mit einem API-Token authentifizieren. Schau dir den Abschnitt ["Ein API-Token beziehen"](../../intro#obtaining-an-api-token) der Einführung an, um Details zum Erhalt eines API-Tokens zu erfahren. | ||
|
||
:::note | ||
|
||
Weitere Authentifizierungsmechanismen (wie z.B. ein OAuth2-Flow, bei dem du deinen Browser zur Authentifizierung verwenden kannst) sind für die Zukunft geplant. | ||
|
||
::: | ||
|
||
Mit einem Token kannst du dich wie folgt authentifizieren: | ||
|
||
``` | ||
$ mw login token | ||
Enter your mStudio API token: ******** | ||
``` | ||
|
||
Für nicht-interaktive Nutzung (beispielsweise in CI/CD-Pipelines), kannst du das Token auch über die `MITTWALD_API_TOKEN`-Umgebungsvariable bereitstellen: | ||
|
||
``` | ||
$ export MITTWALD_API_TOKEN=******** | ||
$ mw login status | ||
``` | ||
|
||
## Allgemeine Verwendung | ||
|
||
### Projekt-, Server- und Organisations-Kontexte | ||
|
||
Viele Befehle der CLI agieren im Kontext eines bestimmten Projekts, Servers oder einer Organisation und benötigen daher einen `--project-id`, `--server-id` oder `--org-id`-Parameter. Du kannst diese Parameter entweder an jeden Befehl übergeben, oder sie global mit dem `mw context`-Befehl setzen: | ||
|
||
```bash | ||
$ mw context set --project-id=... | ||
$ mw project set --server-id=... | ||
$ mw project set --org-id=... | ||
``` | ||
|
||
Manche Befehle, die eine dieser Ressourcen erstellen, haben auch ein `--update-context`-Flag, das den Kontext automatisch auf die neu erstellte Ressource setzt: | ||
|
||
```bash | ||
$ mw project create --description="..." --update-context | ||
``` | ||
|
||
### Nicht-interaktive Nutzung | ||
|
||
Falls du `mw` auf nicht-interaktive Weise verwenden möchtest (z.B. in Skripten oder CI/CD-Pipelines), unterstützen viele Befehle ein `--output|-o`-Flag, mit dem du das Ausgabeformat angeben kannst. Standardwert ist `text`, was in einer menschenlesbaren Ausgabe resultiert. Du kannst auch `json` verwenden, um maschinenlesbare Ausgaben zu erhalten, die du dann leicht mit Werkzeugen wie `jq` verarbeiten kannst: | ||
|
||
```bash | ||
PROJECT_ID=$(mw project get -ojson | jq -r '.id') | ||
``` | ||
|
||
Viele Befehle, die eine Ressource erstellen, geben standardmäßig Fortschrittsinformationen aus. Sie haben aber auch ein `--quiet|-q`-Flag, mit dem du die Ausgabe unterdrücken kannst. In diesen Fällen geben die meisten Befehle die ID der erstellten Ressource aus, die du dann verwenden kannst, um damit weiterzuarbeiten: | ||
|
||
```bash | ||
PROJECT_ID=$(mw project create --quiet --description="...") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from "react"; | ||
import styles from "./styles.module.css"; | ||
import clsx from "clsx"; | ||
|
||
export function NewBadge() { | ||
return ( | ||
<div className={clsx("badge", styles.badgeNew)}> | ||
<span>NEW</span> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.badgeNew { | ||
background: radial-gradient(circle at 60.52% 67.2%, #264697, transparent 41%), | ||
radial-gradient(circle at 56.14% 12.23%, #232b69, transparent 85%), | ||
radial-gradient(circle at 6.01% 1.34%, #d989b9, transparent 75%), | ||
radial-gradient(circle at 75.71% 4.03%, #0a0d66, transparent 34%), | ||
radial-gradient(circle at 99.31% 70.7%, #2fd2eb, transparent 75%), | ||
radial-gradient(circle at 76.91% 59.14%, #0a0d66, transparent 71%), | ||
radial-gradient(circle at 71.07% 83.33%, #0a0d66, transparent 71%), | ||
radial-gradient(circle at 15.11% 70.43%, #1556a1, transparent 64%), | ||
radial-gradient(circle at 65.49% 37.9%, #3058a5, transparent 100%), | ||
radial-gradient(circle at 99.4% 93.55%, #12f7ff, transparent 100%), | ||
radial-gradient(circle at 50% 50%, #8f62aa, #8f62aa 100%); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For macOS und Windows this info is given
But there is no such info for Linux? Is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because currently, there is no Linux installer. OCLIF would (theoretically) support building
.deb
and.rpm
packages, but even those would not be fully equivalent to an "installer". In any case, we'd need to do a bit more testing and tweaking of those packages, before releasing them into the wild.