Skip to content

Suppress Alias in help text option description? #154

@nbbaier

Description

@nbbaier

The program below prints help text that gives the user alias help text in two locations:

import { initTRPC } from "@trpc/server";
import { createCli } from "trpc-cli";
import { z } from "zod";

const t = initTRPC.create();

const router = t.router({
  add: t.procedure
    .meta({})
    .input(
      z.object({
        left: z.number().meta({ alias: "l", description: "Left number" }),
        right: z.number().meta({ alias: "r", description: "Right number" }),
      })
    )
    .query(({ input }) => input.left + input.right),
});

createCli({ router }).run();

The help text:

Usage: index add [options]

Options:
  -l, --left <number>   Left number; Alias: l
  -r, --right <number>  Right number; Alias: r
  -h, --help            display help for command

Is there a way to hide/not print the Alias: l and Alias: r. They're redundant, given that -l, --left/-r, --right is printed at the start of the line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions