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

feat(cli): add --hot alias for --hot-reload flag #525

Merged
merged 1 commit into from
Feb 8, 2019
Merged
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
4 changes: 2 additions & 2 deletions examples/vote/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ In a separate tab, open http://result.local.app.garden. The results there will r
Hot-reloading needs to be enabled per service when starting `garden deploy` or `garden dev`:

```sh
garden dev --hot-reload=vote
# OR garden deploy -w --hot-reload=vote
garden dev --hot=vote
# OR garden deploy --hot=vote
```

Then try making a change to one of the source files in the `vote` service, to see it synchronize into the
Expand Down
10 changes: 5 additions & 5 deletions garden-service/src/cli/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ export function falsifyConflictingParams(argv, params: ParameterValues<any>): Fa
// Sywac specific transformers and helpers
export function getOptionSynopsis(key: string, { alias }: Parameter<any>): string {
if (alias && alias.length > 1) {
throw new InternalError("Option aliases can only be a single character", {
optionName: key,
alias,
})
return `--${alias}, --${key}`
} else if (alias) {
return `-${alias}, --${key}`
} else {
return `--${key}`
}
return alias ? `-${alias}, --${key}` : `--${key}`
}

export function getArgSynopsis(key: string, param: Parameter<any>) {
Expand Down
1 change: 1 addition & 0 deletions garden-service/src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const deployOpts = {
Use comma as a separator to specify multiple services. When this option is used,
the command is run in watch mode (i.e. implicitly assumes the --watch/-w flag).
`,
alias: "hot",
}),
}

Expand Down
7 changes: 5 additions & 2 deletions garden-service/src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ const devOpts = {
"hot-reload": new StringsParameter({
help: deline`The name(s) of the service(s) to deploy with hot reloading enabled.
Use comma as a separator to specify multiple services.
`}),
`,
alias: "hot",
}),
}

type Args = typeof devArgs
Expand All @@ -61,7 +63,8 @@ export class DevCommand extends Command<Args, Opts> {
Examples:

garden dev
garden dev --hot-reload=foo-service,bar-service # enable hot reloading for foo-service and bar-service
garden dev --hot-reload=foo-service # enable hot reloading for foo-service
garden dev --hot=foo-service,bar-service # enable hot reloading for foo-service and bar-service
`

options = devOpts
Expand Down