-
Notifications
You must be signed in to change notification settings - Fork 0
[DX-964] Add new spaces commands #177
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| import { Args } from "@oclif/core"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this command add any value? Is it misleading? It essentially just calls This could be misleading as a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That’s true, but earlier when you looked at spaces, there wasn’t any way to tell how they were created. It also felt quite odd that a space only becomes visible when a member joins it using Now, when you look at the commands, it’s straightforward to create a space using
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, you can see it via
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's why we had explicit description on
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will be logging as a warning -> #185 |
||
|
|
||
| import { productApiFlags, clientIdFlag } from "../../flags.js"; | ||
| import { SpacesBaseCommand } from "../../spaces-base-command.js"; | ||
| import { | ||
| formatProgress, | ||
| formatResource, | ||
| formatSuccess, | ||
| } from "../../utils/output.js"; | ||
|
|
||
| export default class SpacesCreate extends SpacesBaseCommand { | ||
| static override args = { | ||
| space_name: Args.string({ | ||
| description: "Name of the space to initialize", | ||
| required: true, | ||
| }), | ||
| }; | ||
|
|
||
| static override description = "Initialize a space without entering it"; | ||
|
|
||
| static override examples = [ | ||
| "$ ably spaces create my-space", | ||
| "$ ably spaces create my-space --json", | ||
| "$ ably spaces create my-space --client-id my-client", | ||
| ]; | ||
|
|
||
| static override flags = { | ||
| ...productApiFlags, | ||
| ...clientIdFlag, | ||
| }; | ||
|
|
||
| async run(): Promise<void> { | ||
| const { args, flags } = await this.parse(SpacesCreate); | ||
| const spaceName = args.space_name; | ||
|
|
||
| try { | ||
| if (!this.shouldOutputJson(flags)) { | ||
| this.log( | ||
| formatProgress(`Initializing space ${formatResource(spaceName)}`), | ||
| ); | ||
| } | ||
|
|
||
| await this.initializeSpace(flags, spaceName, { | ||
| enterSpace: false, | ||
| setupConnectionLogging: false, | ||
| }); | ||
sacOO7 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if (this.shouldOutputJson(flags)) { | ||
| this.logJsonResult({ space: { name: spaceName } }, flags); | ||
| } else { | ||
| this.log( | ||
| formatSuccess( | ||
| `Space ${formatResource(spaceName)} initialized. Use "ably spaces members enter" to activate it.`, | ||
| ), | ||
| ); | ||
| } | ||
| } catch (error) { | ||
| this.fail(error, flags, "spaceCreate"); | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.