Skip to content

Commit

Permalink
refactor: rename plural command parameters
Browse files Browse the repository at this point in the history
This should have no impact on CLI usage.
  • Loading branch information
edvald committed Dec 3, 2018
1 parent e6fcc8b commit f8636ac
Show file tree
Hide file tree
Showing 19 changed files with 82 additions and 79 deletions.
41 changes: 21 additions & 20 deletions docs/reference/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Note: Currently only supports simple GET requests for HTTP/HTTPS ingresses.

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `serviceAndPath` | Yes | The name(s) of the service(s) to call followed by the ingress path (e.g. my-container/somepath).
| `serviceAndPath` | Yes | The name(s) of the service to call followed by the ingress path (e.g. my-container/somepath).

### garden create project

Expand Down Expand Up @@ -175,7 +175,7 @@ resources.

### garden delete service

Deletes a running service.
Deletes running services.

Deletes (i.e. un-deploys) the specified services. Note that this command does not take into account any
services depending on the deleted service, and might therefore leave the project in an unstable state.
Expand All @@ -187,13 +187,13 @@ Examples:

##### Usage

garden delete service <service>
garden delete service <services>

##### Arguments

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `service` | Yes | The name(s) of the service(s) to delete. Use comma as a separator to specify multiple services.
| `services` | Yes | The name(s) of the service(s) to delete. Use comma as a separator to specify multiple services.

### garden deploy

Expand All @@ -209,20 +209,21 @@ Examples:

garden deploy # deploy all modules in the project
garden deploy my-service # only deploy my-service
garden deploy service-a,service-b # only deploy service-a and service-b
garden deploy --force # force re-deploy of modules, even if they're already deployed
garden deploy --watch # watch for changes to code
garden deploy --hot-reload=my-service # deploys all services, with hot reloading enabled for my-service
garden deploy --env stage # deploy your services to an environment called stage

##### Usage

garden deploy [service] [options]
garden deploy [services] [options]

##### Arguments

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `service` | No | The name(s) of the service(s) to deploy (skip to deploy all services). Use comma as a separator to specify multiple services.
| `services` | No | The name(s) of the service(s) to deploy (skip to deploy all services). Use comma as a separator to specify multiple services.

##### Options

Expand Down Expand Up @@ -408,13 +409,13 @@ Examples:

##### Usage

garden logs [service] [options]
garden logs [services] [options]

##### Arguments

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `service` | No | The name(s) of the service(s) to log (skip to log all services). Use comma as a separator to specify multiple services.
| `services` | No | The name(s) of the service(s) to log (skip to log all services). Use comma as a separator to specify multiple services.

##### Options

Expand All @@ -438,13 +439,13 @@ Examples:

##### Usage

garden publish [module] [options]
garden publish [modules] [options]

##### Arguments

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `module` | No | The name(s) of the module(s) to publish (skip to publish all modules). Use comma as a separator to specify multiple modules.
| `modules` | No | The name(s) of the module(s) to publish (skip to publish all modules). Use comma as a separator to specify multiple modules.

##### Options

Expand Down Expand Up @@ -638,13 +639,13 @@ Examples:

##### Usage

garden test [module] [options]
garden test [modules] [options]

##### Arguments

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `module` | No | The name(s) of the module(s) to test (skip to test all modules). Use comma as a separator to specify multiple modules.
| `modules` | No | The name(s) of the module(s) to test (skip to test all modules). Use comma as a separator to specify multiple modules.

##### Options

Expand All @@ -669,13 +670,13 @@ Examples:

##### Usage

garden unlink source [source] [options]
garden unlink source [sources] [options]

##### Arguments

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `source` | No | The name(s) of the source(s) to unlink. Use comma as a separator to specify multiple sources.
| `sources` | No | The name(s) of the source(s) to unlink. Use comma as a separator to specify multiple sources.

##### Options

Expand All @@ -697,13 +698,13 @@ Examples:

##### Usage

garden unlink module [module] [options]
garden unlink module [modules] [options]

##### Arguments

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `module` | No | The name(s) of the module(s) to unlink. Use comma as a separator to specify multiple modules.
| `modules` | No | The name(s) of the module(s) to unlink. Use comma as a separator to specify multiple modules.

##### Options

Expand All @@ -724,13 +725,13 @@ Examples:

##### Usage

garden update-remote sources [source]
garden update-remote sources [sources]

##### Arguments

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `source` | No | The name(s) of the remote source(s) to update. Use comma as a separator to specify multiple sources.
| `sources` | No | The name(s) of the remote source(s) to update. Use comma as a separator to specify multiple sources.

### garden update-remote modules

Expand All @@ -746,13 +747,13 @@ Examples:

##### Usage

garden update-remote modules [module]
garden update-remote modules [modules]

##### Arguments

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `module` | No | The name(s) of the remote module(s) to update. Use comma as a separator to specify multiple modules.
| `modules` | No | The name(s) of the remote module(s) to update. Use comma as a separator to specify multiple modules.

### garden update-remote all

Expand Down
2 changes: 1 addition & 1 deletion garden-service/src/commands/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import dedent = require("dedent")

const callArgs = {
serviceAndPath: new StringParameter({
help: "The name(s) of the service(s) to call followed by the ingress path (e.g. my-container/somepath).",
help: "The name(s) of the service to call followed by the ingress path (e.g. my-container/somepath).",
required: true,
}),
}
Expand Down
7 changes: 4 additions & 3 deletions garden-service/src/commands/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class DeleteEnvironmentCommand extends Command {
}

const deleteServiceArgs = {
service: new StringsParameter({
services: new StringsParameter({
help: "The name(s) of the service(s) to delete. Use comma as a separator to specify multiple services.",
required: true,
}),
Expand All @@ -114,7 +114,8 @@ type DeleteServiceArgs = typeof deleteServiceArgs

export class DeleteServiceCommand extends Command {
name = "service"
help = "Deletes a running service."
alias = "services"
help = "Deletes running services."
arguments = deleteServiceArgs

description = dedent`
Expand All @@ -128,7 +129,7 @@ export class DeleteServiceCommand extends Command {
`

async action({ garden, log, args }: CommandParams<DeleteServiceArgs>): Promise<CommandResult> {
const services = await garden.getServices(args.service)
const services = await garden.getServices(args.services)

if (services.length === 0) {
log.warn({ msg: "No services found. Aborting." })
Expand Down
5 changes: 3 additions & 2 deletions garden-service/src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { processServices } from "../process"
import { logHeader } from "../logger/util"

const deployArgs = {
service: new StringsParameter({
services: new StringsParameter({
help: deline`The name(s) of the service(s) to deploy (skip to deploy all services).
Use comma as a separator to specify multiple services.`,
}),
Expand Down Expand Up @@ -64,6 +64,7 @@ export class DeployCommand extends Command<Args, Opts> {
garden deploy # deploy all modules in the project
garden deploy my-service # only deploy my-service
garden deploy service-a,service-b # only deploy service-a and service-b
garden deploy --force # force re-deploy of modules, even if they're already deployed
garden deploy --watch # watch for changes to code
garden deploy --hot-reload=my-service # deploys all services, with hot reloading enabled for my-service
Expand All @@ -78,7 +79,7 @@ export class DeployCommand extends Command<Args, Opts> {
}

async action({ garden, log, args, opts }: CommandParams<Args, Opts>): Promise<CommandResult<TaskResults>> {
const services = await garden.getServices(args.service)
const services = await garden.getServices(args.services)

if (services.length === 0) {
log.error({ msg: "No services found. Aborting." })
Expand Down
4 changes: 2 additions & 2 deletions garden-service/src/commands/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { LoggerType } from "../logger/logger"
import dedent = require("dedent")

const logsArgs = {
service: new StringsParameter({
services: new StringsParameter({
help: "The name(s) of the service(s) to log (skip to log all services). " +
"Use comma as a separator to specify multiple services.",
}),
Expand Down Expand Up @@ -61,7 +61,7 @@ export class LogsCommand extends Command<Args, Opts> {

async action({ garden, log, args, opts }: CommandParams<Args, Opts>): Promise<CommandResult<ServiceLogEntry[]>> {
const tail = opts.tail
const services = await garden.getServices(args.service)
const services = await garden.getServices(args.services)

const result: ServiceLogEntry[] = []
const stream = new Stream<ServiceLogEntry>()
Expand Down
4 changes: 2 additions & 2 deletions garden-service/src/commands/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { logHeader } from "../logger/util"
import dedent = require("dedent")

const publishArgs = {
module: new StringsParameter({
modules: new StringsParameter({
help: "The name(s) of the module(s) to publish (skip to publish all modules). " +
"Use comma as a separator to specify multiple modules.",
}),
Expand Down Expand Up @@ -64,7 +64,7 @@ export class PublishCommand extends Command<Args, Opts> {
async action({ garden, log, args, opts }: CommandParams<Args, Opts>): Promise<CommandResult<TaskResults>> {
logHeader({ log, emoji: "rocket", command: "Publish modules" })

const modules = await garden.getModules(args.module)
const modules = await garden.getModules(args.modules)

const results = await publishModules(garden, log, modules, !!opts["force-build"], !!opts["allow-dirty"])

Expand Down
6 changes: 3 additions & 3 deletions garden-service/src/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { getTestTasks } from "../tasks/test"
import { logHeader } from "../logger/util"

const testArgs = {
module: new StringsParameter({
modules: new StringsParameter({
help: "The name(s) of the module(s) to test (skip to test all modules). " +
"Use comma as a separator to specify multiple modules.",
}),
Expand Down Expand Up @@ -83,8 +83,8 @@ export class TestCommand extends Command<Args, Opts> {
async action({ garden, log, args, opts }: CommandParams<Args, Opts>): Promise<CommandResult<TaskResults>> {
const dependencyGraph = await garden.getDependencyGraph()
let modules: Module[]
if (args.module) {
modules = await dependencyGraph.withDependantModules(await garden.getModules(args.module))
if (args.modules) {
modules = await dependencyGraph.withDependantModules(await garden.getModules(args.modules))
} else {
// All modules are included in this case, so there's no need to compute dependants.
modules = await garden.getModules()
Expand Down
6 changes: 3 additions & 3 deletions garden-service/src/commands/unlink/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
} from "../../config-store"

const unlinkModuleArguments = {
module: new StringsParameter({
modules: new StringsParameter({
help: "The name(s) of the module(s) to unlink. Use comma as a separator to specify multiple modules.",
}),
}
Expand Down Expand Up @@ -59,15 +59,15 @@ export class UnlinkModuleCommand extends Command<Args, Opts> {

const sourceType = "module"

const { module = [] } = args
const { modules = [] } = args

if (opts.all) {
await garden.localConfigStore.set([localConfigKeys.linkedModuleSources], [])
log.info("Unlinked all modules")
return { result: [] }
}

const linkedModuleSources = await removeLinkedSources({ garden, sourceType, names: module })
const linkedModuleSources = await removeLinkedSources({ garden, sourceType, names: modules })

log.info(`Unlinked module(s) ${module}`)

Expand Down
8 changes: 4 additions & 4 deletions garden-service/src/commands/unlink/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
} from "../../config-store"

const unlinkSourceArguments = {
source: new StringsParameter({
sources: new StringsParameter({
help: "The name(s) of the source(s) to unlink. Use comma as a separator to specify multiple sources.",
}),
}
Expand Down Expand Up @@ -59,17 +59,17 @@ export class UnlinkSourceCommand extends Command<Args, Opts> {

const sourceType = "project"

const { source = [] } = args
const { sources = [] } = args

if (opts.all) {
await garden.localConfigStore.set([localConfigKeys.linkedProjectSources], [])
log.info("Unlinked all sources")
return { result: [] }
}

const linkedProjectSources = await removeLinkedSources({ garden, sourceType, names: source })
const linkedProjectSources = await removeLinkedSources({ garden, sourceType, names: sources })

log.info(`Unlinked source(s) ${source}`)
log.info(`Unlinked source(s) ${sources}`)

return { result: linkedProjectSources }
}
Expand Down
4 changes: 2 additions & 2 deletions garden-service/src/commands/update-remote/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ export class UpdateRemoteAllCommand extends Command {
const { result: projectSources } = await sourcesCmd.action({
garden,
log,
args: { source: undefined },
args: { sources: undefined },
opts: {},
})
const { result: moduleSources } = await modulesCmd.action({
garden,
log,
args: { module: undefined },
args: { modules: undefined },
opts: {},
})

Expand Down
Loading

0 comments on commit f8636ac

Please sign in to comment.