feat(issue): read description/comment from file or stdin (YT-13) #57
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/issue-file-input-YT-13"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Resolves YT-13.
What
Adds file-input flags so issue descriptions and comments can come from a file or stdin instead of only an inline argument:
yt issue create --description-file <PATH>(mutually exclusive with--description)yt issue update <id> --description-file <PATH>(mutually exclusive with--description)yt issue comment <id> --comment-file <PATH>(mutually exclusive with the positional text)Each
*-fileflag accepts-to read from stdin. The file is read as UTF-8 and used verbatim. A missing, unreadable, or non-UTF-8 file produces a clear error and performs no API mutation.--dry-runresolves the body before the POST, so it works with every variant.How
A shared
read_text_arg(inline, file)helper insrc/commands/issue/mod.rscentralizes the file/stdin/conflict resolution and returnsOption<String>. That preservesupdate's "field not provided means do not touch it" semantics whilecreate/commentfall back to empty-or-required-body handling. The clapconflicts_withattribute enforces mutual exclusivity, producing a clear error when both inline and file inputs are supplied.Acceptance criteria
yt issue create --description-file <path>creates an issue whose description is the file contents.yt issue update <id> --description-file <path>sets the description from the file.yt issue comment <id> --comment-file <path>posts a comment with the file contents.*-fileflag accepts-to read the body from stdin.--description-fileconflicts with--description, and--comment-fileconflicts with the positionaltext, with a clear clap error when both are supplied.--dry-runworks with each*-filevariant.Testing
cargo fmt --all -- --check,cargo clippy --all-targets -- -D warnings,cargo build --release, andcargo test --all-targets(306 passed). New tests cover the helper (file read, missing file, non-UTF-8, inline passthrough, None), plus end-to-end--description-file(create) and--comment-file(comment). Manually verified stdin (-) and--dry-runfor both create and comment, and the two clap conflict errors.