Skip to content

Commit

Permalink
Merge pull request #525 from garden-io/add-hot-alias
Browse files Browse the repository at this point in the history
feat(cli): add --hot alias for --hot-reload flag
  • Loading branch information
thsig committed Feb 8, 2019
2 parents b2e87aa + 22ac4f6 commit 2d025b7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
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

0 comments on commit 2d025b7

Please sign in to comment.