Skip to content
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

Target/source of app upload|download command should be arg, not flag #750

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions docs/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Manage apps, and app installations in your projects
* [`mw app dependency list`](#mw-app-dependency-list)
* [`mw app dependency update [INSTALLATION-ID]`](#mw-app-dependency-update-installation-id)
* [`mw app dependency versions SYSTEMSOFTWARE`](#mw-app-dependency-versions-systemsoftware)
* [`mw app download [INSTALLATION-ID]`](#mw-app-download-installation-id)
* [`mw app download [INSTALLATION-ID] TARGET`](#mw-app-download-installation-id-target)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah; now I remember why we didn't do this in the first place. This is not valid, because [INSTALLATION-ID] is optional any may not be followed by a required argument. So the only valid order would be TARGET [INSTALLATION-ID], which also seems unintuitive. I'll just close this and leave this as-is.

* [`mw app get [INSTALLATION-ID]`](#mw-app-get-installation-id)
* [`mw app install contao`](#mw-app-install-contao)
* [`mw app install drupal`](#mw-app-install-drupal)
Expand All @@ -34,7 +34,7 @@ Manage apps, and app installations in your projects
* [`mw app uninstall [INSTALLATION-ID]`](#mw-app-uninstall-installation-id)
* [`mw app update [INSTALLATION-ID]`](#mw-app-update-installation-id)
* [`mw app upgrade [INSTALLATION-ID]`](#mw-app-upgrade-installation-id)
* [`mw app upload [INSTALLATION-ID]`](#mw-app-upload-installation-id)
* [`mw app upload [INSTALLATION-ID] SOURCE`](#mw-app-upload-installation-id-source)
* [`mw app versions [APP]`](#mw-app-versions-app)

## `mw app copy [INSTALLATION-ID]`
Expand Down Expand Up @@ -345,25 +345,25 @@ DESCRIPTION
Get all available versions of a particular dependency
```

## `mw app download [INSTALLATION-ID]`
## `mw app download [INSTALLATION-ID] TARGET`

Download the filesystem of an app within a project to your local machine

```
USAGE
$ mw app download [INSTALLATION-ID] --target <value> [-q] [--ssh-user <value>] [--ssh-identity-file <value>]
[--exclude <value>...] [--dry-run] [--delete]
$ mw app download [INSTALLATION-ID] TARGET [-q] [--ssh-user <value>] [--ssh-identity-file <value>] [--exclude
<value>...] [--dry-run] [--delete]

ARGUMENTS
INSTALLATION-ID ID or short ID of an app installation; this argument is optional if a default app installation is set
in the context.
TARGET target directory to download the app installation to

FLAGS
-q, --quiet suppress process output and only display a machine-readable summary.
--delete delete local files that are not present on the server
--dry-run do not actually download the app installation
--exclude=<value>... [default: ] exclude files matching the given pattern
--target=<value> (required) target directory to download the app installation to

SSH CONNECTION FLAGS
--ssh-identity-file=<value> the SSH identity file (private key) to use for public key authentication.
Expand Down Expand Up @@ -2004,25 +2004,25 @@ FLAG DESCRIPTIONS
scripts), you can use this flag to easily get the IDs of created resources for further processing.
```

## `mw app upload [INSTALLATION-ID]`
## `mw app upload [INSTALLATION-ID] SOURCE`

Upload the filesystem of an app to a project

```
USAGE
$ mw app upload [INSTALLATION-ID] --source <value> [-q] [--ssh-user <value>] [--ssh-identity-file <value>]
[--exclude <value>...] [--dry-run] [--delete]
$ mw app upload [INSTALLATION-ID] SOURCE [-q] [--ssh-user <value>] [--ssh-identity-file <value>] [--exclude
<value>...] [--dry-run] [--delete]

ARGUMENTS
INSTALLATION-ID ID or short ID of an app installation; this argument is optional if a default app installation is set
in the context.
SOURCE source directory from which to upload the app installation

FLAGS
-q, --quiet suppress process output and only display a machine-readable summary.
--delete delete remote files that are not present locally
--dry-run do not actually upload the app installation
--exclude=<value>... [default: ] exclude files matching the given pattern
--source=<value> (required) source directory from which to upload the app installation

SSH CONNECTION FLAGS
--ssh-identity-file=<value> the SSH identity file (private key) to use for public key authentication.
Expand Down
15 changes: 8 additions & 7 deletions src/commands/app/download.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
makeProcessRenderer,
processFlags,
} from "../../rendering/process/process_flags.js";
import { Flags } from "@oclif/core";
import { Args } from "@oclif/core";
import { Success } from "../../rendering/react/components/Success.js";
import { ReactNode } from "react";
import { getSSHConnectionForAppInstallation } from "../../lib/resources/ssh/appinstall.js";
Expand All @@ -30,21 +30,22 @@ export class Download extends ExecRenderBaseCommand<typeof Download, void> {
filterFileDocumentation;
static args = {
...appInstallationArgs,
target: Args.directory({
description: "target directory to download the app installation to",
required: true,
exists: false,
}),
};
static flags = {
...processFlags,
...sshConnectionFlags,
...appInstallationSyncFlags("download"),
target: Flags.directory({
description: "target directory to download the app installation to",
required: true,
exists: false,
}),
};

protected async exec(): Promise<void> {
const appInstallationId = await this.withAppInstallationId(Download);
const { "dry-run": dryRun, target, "ssh-user": sshUser } = this.flags;
const { "dry-run": dryRun, "ssh-user": sshUser } = this.flags;
const { target } = this.args;

const p = makeProcessRenderer(this.flags, "Downloading app installation");

Expand Down
15 changes: 8 additions & 7 deletions src/commands/app/upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
makeProcessRenderer,
processFlags,
} from "../../rendering/process/process_flags.js";
import { Flags } from "@oclif/core";
import { Args } from "@oclif/core";
import { Success } from "../../rendering/react/components/Success.js";
import { ReactNode } from "react";
import { getSSHConnectionForAppInstallation } from "../../lib/resources/ssh/appinstall.js";
Expand All @@ -31,21 +31,22 @@ export class Upload extends ExecRenderBaseCommand<typeof Upload, void> {
filterFileDocumentation;
static args = {
...appInstallationArgs,
source: Args.directory({
description: "source directory from which to upload the app installation",
required: true,
exists: true,
}),
};
static flags = {
...processFlags,
...sshConnectionFlags,
...appInstallationSyncFlags("upload"),
source: Flags.directory({
description: "source directory from which to upload the app installation",
required: true,
exists: true,
}),
};

protected async exec(): Promise<void> {
const appInstallationId = await this.withAppInstallationId(Upload);
const { "dry-run": dryRun, source, "ssh-user": sshUser } = this.flags;
const { "dry-run": dryRun, "ssh-user": sshUser } = this.flags;
const { source } = this.args;

const p = makeProcessRenderer(this.flags, "Uploading app installation");

Expand Down