Skip to content

Commit

Permalink
fix(cli): fix log inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
eysi09 authored and edvald committed Jul 9, 2019
1 parent ff60e58 commit 12c242a
Show file tree
Hide file tree
Showing 17 changed files with 134 additions and 127 deletions.
42 changes: 21 additions & 21 deletions garden-service/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion garden-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,4 @@
},
"snyk": true,
"gitHead": "b0647221a4d2ff06952bae58000b104215aed922"
}
}
2 changes: 0 additions & 2 deletions garden-service/src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,7 @@ export class GardenCli {
// framework as opposed to the logger itself. This is to give better control over where on
// the screen the logs are printed.
const headerLog = logger.placeholder()
logger.info("") // Put one line between the header and the body
const log = logger.placeholder()
logger.info("") // Put one line between the body and the footer
const footerLog = logger.placeholder()

const contextOpts: GardenOpts = { environmentName: env, log }
Expand Down
7 changes: 5 additions & 2 deletions garden-service/src/commands/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { ParameterError, RuntimeError } from "../exceptions"
import { find, includes, pick } from "lodash"
import { ServiceIngress, getIngressUrl, getServiceRuntimeContext } from "../types/service"
import dedent = require("dedent")
import { printHeader } from "../logger/util"

const callArgs = {
serviceAndPath: new StringParameter({
Expand Down Expand Up @@ -49,7 +50,9 @@ export class CallCommand extends Command<Args> {

arguments = callArgs

async action({ garden, log, args }: CommandParams<Args>): Promise<CommandResult> {
async action({ garden, log, headerLog, args }: CommandParams<Args>): Promise<CommandResult> {
printHeader(headerLog, "Call", "telephone_receiver")

let [serviceName, path] = splitFirst(args.serviceAndPath, "/")

// TODO: better error when service doesn't exist
Expand Down Expand Up @@ -155,7 +158,7 @@ export class CallCommand extends Command<Args> {

const resStr = isObject(res.data) ? JSON.stringify(res.data, null, 2) : res.data

res.data && log.info(chalk.white(resStr) + "\n")
res.data && log.info(chalk.white(resStr))

return {
result: {
Expand Down
2 changes: 1 addition & 1 deletion garden-service/src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class DevCommand extends Command<Args, Opts> {
const data = await readFile(ansiBannerPath)
log.info(data.toString())

log.info(chalk.gray.italic(`\nGood ${getGreetingTime()}! Let's get your environment wired up...\n`))
log.info(chalk.gray.italic(`Good ${getGreetingTime()}! Let's get your environment wired up...\n`))

this.server = await startServer(footerLog)
}
Expand Down
2 changes: 1 addition & 1 deletion garden-service/src/commands/link/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class LinkModuleCommand extends Command<Args> {
`

async action({ garden, log, headerLog, args }: CommandParams<Args>): Promise<CommandResult<LinkedSource[]>> {
printHeader(headerLog, "link module", "link")
printHeader(headerLog, "Link module", "link")

const sourceType = "module"

Expand Down
2 changes: 1 addition & 1 deletion garden-service/src/commands/link/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class LinkSourceCommand extends Command<Args> {
`

async action({ garden, log, headerLog, args }: CommandParams<Args>): Promise<CommandResult<LinkedSource[]>> {
printHeader(headerLog, "link source", "link")
printHeader(headerLog, "Link source", "link")

const sourceType = "project"

Expand Down
2 changes: 1 addition & 1 deletion garden-service/src/commands/unlink/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class UnlinkModuleCommand extends Command<Args, Opts> {
async action(
{ garden, log, headerLog, args, opts }: CommandParams<Args, Opts>,
): Promise<CommandResult<LinkedSource[]>> {
printHeader(headerLog, "unlink module", "chains")
printHeader(headerLog, "Unlink module", "chains")

const sourceType = "module"

Expand Down
2 changes: 1 addition & 1 deletion garden-service/src/commands/unlink/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class UnlinkSourceCommand extends Command<Args, Opts> {
async action(
{ garden, log, headerLog, args, opts }: CommandParams<Args, Opts>,
): Promise<CommandResult<LinkedSource[]>> {
printHeader(headerLog, "unlink source", "chains")
printHeader(headerLog, "Unlink source", "chains")

const sourceType = "project"

Expand Down
21 changes: 6 additions & 15 deletions garden-service/src/commands/update-remote/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
CommandResult,
CommandParams,
} from "../base"
import { UpdateRemoteSourcesCommand } from "./sources"
import { UpdateRemoteModulesCommand } from "./modules"
import { updateRemoteSources } from "./sources"
import { updateRemoteModules } from "./modules"
import { SourceConfig } from "../../config/project"
import { printHeader } from "../../logger/util"

Expand All @@ -34,27 +34,18 @@ export class UpdateRemoteAllCommand extends Command {
`

async action(
{ garden, log, headerLog, footerLog, opts }: CommandParams,
{ garden, log, headerLog }: CommandParams,
): Promise<CommandResult<UpdateRemoteAllResult>> {
printHeader(headerLog, "update-remote all", "hammer_and_wrench")
printHeader(headerLog, "Update remote sources and modules", "hammer_and_wrench")

const sourcesCmd = new UpdateRemoteSourcesCommand()
const modulesCmd = new UpdateRemoteModulesCommand()

const { result: projectSources } = await sourcesCmd.action({
const { result: projectSources } = await updateRemoteSources({
garden,
log,
footerLog,
headerLog,
opts,
args: { sources: undefined },
})
const { result: moduleSources } = await modulesCmd.action({
const { result: moduleSources } = await updateRemoteModules({
garden,
log,
footerLog,
headerLog,
opts,
args: { modules: undefined },
})

Expand Down
Loading

0 comments on commit 12c242a

Please sign in to comment.