Skip to content

feat: support global spacing default in display config #137

@zrosenbauer

Description

@zrosenbauer

Summary

When display.guide is set to false, the guide bar is correctly hidden, but @clack/prompts' default spacing: 1 still prepends a blank line before each log.* call. This creates unwanted whitespace — especially noticeable at the top of command output where the first log message gets a leading blank line with no visual purpose.

Problem

resolveClackBase() maps guide, input, and output from the display config to clack options, but does not pass through spacing. There's no way to configure a global default for spacing — it must be set per-call via ctx.log.info(msg, { spacing: 0 }).

Proposal

Add a spacing property to the display config that gets forwarded to clack's base options:

cli({
  display: {
    guide: false,
    spacing: 0, // <-- new option
  },
})

This would be mapped in resolveClackBase:

function resolveClackBase(defaults) {
  if (defaults === void 0) return EMPTY_CLACK_BASE;
  return {
    withGuide: defaults.guide,
    input: defaults.input,
    output: defaults.output,
    spacing: defaults.spacing, // new
  };
}

Workaround

Pass { spacing: 0 } to individual ctx.log.* calls:

ctx.log.info('message', { spacing: 0 })

This works but is tedious for commands that want no spacing throughout.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions