Refactor attached option values

Aperta
#992 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
swift
Ambito
cli

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Swift
Stelle
3.8k
Fork
436
Merge medio
4g 11h
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apple/swift-argument-parser

Tutte le issue di apple/swift-argument-parser

Issue simili

Altre issue su Swift

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.