Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

cli: help examples are fixed at construction and can't reflect where a command is mounted

Cerrado
#6,745 1 comentario 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
typescript
Área
cli

Línea de trabajo

Start at Command.withExamples and buildHelpDoc, which already receives commandPath for the USAGE line. Trace how examples are stored and rendered, then verify that the new callback form resolves against the mounted path while the existing array form remains unchanged. Confirm the generated help examples work for commands mounted directly and as subcommands.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement
What is the problem this feature would solve?

USAGE reflects where a command is mounted; its examples don't — they're fixed strings written at construction. Mount one command in two places (own bin, and subcommand of a larger CLI) and its examples describe an invocation that doesn't work.

It can't be fixed in user land: a child is built before withSubcommands attaches it, so the path isn't knowable when withExamples runs. The only workaround is threading the mount path into every command factory by hand.

What is the feature you are proposing to solve the problem?

An overload of Command.withExamples taking (commandPath: ReadonlyArray<string>) => ReadonlyArray<Example>, resolved in buildHelpDoc, which already receives commandPath for the USAGE line. Additive — the array form is unchanged.

Command.withExamples(create, (path) => [
  { command: `${path.join(" ")} --yes`, description: "Take every default." },
])
What alternatives have you considered?
  • Threading the mount path in by hand — what we do now: every command factory takes the path it's mounted at and interpolates it into its own examples. Works, but re-supplies what the parser already computes, and nothing checks the two agree.
  • Prefixing examples at the mount site via the public examples field and withExamples. Same information written in the same place, and it doesn't recurse into grandchildren.
  • Auto-prefixing relative examples with the usage path. Nicest to write, but breaks every existing absolute example — would need its own combinator.
  • A custom help renderer that rewrites examples against the path. Not available: run takes only { version }.
Lenguaje dominante
TypeScript
Estrellas
16.7k
Forks
808
Merge medio
11 h 11 min
PR fusionados (30 d)
840

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Effect-TS/effect

Todos los issues de Effect-TS/effect

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.