Refactor attached option values

Abierto
#992 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
swift
Área
cli

Línea de trabajo

Start by reading the existing .next and .scanningForValue parsing strategies and how defaultAsFlag options generate help text. Trace how long options handle attached values, then check the relevant parsing and help tests. Done means the new strategy uses the default for --opt, accepts --opt=value including an empty value, leaves the next argument untouched, and renders --opt[=<value>] in generated help.

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

Descripción

additive change enhancement

Refactor attached option values to support:

  1. Custom option name / value delimiters, e.g., --option=value, --option:value, etc.
    1. Delimiters are planned to be single characters, not strings, but that can be changed upon request.
    2. Each option can support as many separators as desired (default is just =), including none, which implements 2.1. below.
  2. Forbidding either:
    1. Attached option values, e.g., allow --option value, but forbid --option=value.
    2. Separated option values, e.g., allow --option=value, but forbid --option value.
  3. The above for all parsing strategies.

Out of scope for the initial version, but probably nice to support eventually:

  1. Configuring a different default delimiter set instead of always defaulting to just =.
  2. Array option attached value element delimiters, e.g., , in --option=a,b,c.

Out of scope for the initial version, but probably shouldn't ever support:

  1. Configuring consumption of array option attached & separated values by 1 option "flag", e.g., in --option=a,b,c d, --option always consumes a,b,c as a value, but does not consume d.

Versions

ArgumentParser version: 1.8.2 & main

Lenguaje dominante
Swift
Estrellas
3.8k
Forks
436
Merge medio
4 d 11 h
PR fusionados (30 d)
2

Preparar el entorno

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 apple/swift-argument-parser

Todos los issues de apple/swift-argument-parser

Issues similares

Más issues de Swift

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.