From f6f6863152756034946a8f956918f2982665eb0b Mon Sep 17 00:00:00 2001 From: Lars Kellogg-Stedman Date: Wed, 18 Mar 2026 08:49:55 -0400 Subject: [PATCH 1/2] Allow ticket to read description from stdin If the argument to --description is "-", read the description from stdin. --- README.md | 2 +- ticket | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2d7017e5..3c00ac5a 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Usage: tk [args] Commands: create [title] [options] Create ticket, prints ID - -d, --description Description text + -d, --description Description text, or - to read from stdin --design Design notes --acceptance Acceptance criteria -t, --type Type (bug|feature|task|epic|chore) [default: task] diff --git a/ticket b/ticket index ff27aae2..5d8818b8 100755 --- a/ticket +++ b/ticket @@ -180,6 +180,10 @@ cmd_create() { esac done + if [[ $description = "-" ]]; then + description="$(< /dev/stdin)" + fi + # Validate and resolve parent if specified if [[ -n "$parent" ]]; then local parent_file @@ -1300,7 +1304,7 @@ Usage: $cmd [args] Commands: create [title] [options] Create ticket, prints ID - -d, --description Description text + -d, --description Description text (or "-" to read from stdin) --design Design notes --acceptance Acceptance criteria -t, --type Type (bug|feature|task|epic|chore) [default: task] From 1178674e76c06ce6fbbf149b9795b0e8230722be Mon Sep 17 00:00:00 2001 From: Lars Kellogg-Stedman Date: Wed, 18 Mar 2026 08:50:24 -0400 Subject: [PATCH 2/2] Add --edit/-e option to the create command The --edit option will open the new ticket in your editor. The code looks first at $VISUAL, then at $EDITOR, and then defaults to `vi`. Closes: #23 --- README.md | 1 + ticket | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3c00ac5a..8794ba8d 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ Usage: tk [args] Commands: create [title] [options] Create ticket, prints ID -d, --description Description text, or - to read from stdin + -e, --edit Open editor ($VISUAL or $EDITOR or vi) to edit ticket --design Design notes --acceptance Acceptance criteria -t, --type Type (bug|feature|task|epic|chore) [default: task] diff --git a/ticket b/ticket index 5d8818b8..457d5474 100755 --- a/ticket +++ b/ticket @@ -158,7 +158,7 @@ cmd_create() { ensure_dir local title="" description="" design="" acceptance="" - local priority=2 issue_type="task" assignee="" external_ref="" parent="" tags="" + local priority=2 issue_type="task" assignee="" external_ref="" parent="" tags="" edit="" # Default assignee to git user.name if available assignee=$(git config user.name 2>/dev/null || true) @@ -175,6 +175,7 @@ cmd_create() { --external-ref) external_ref="$2"; shift 2 ;; --parent) parent="$2"; shift 2 ;; --tags) tags="$2"; shift 2 ;; + -e|--edit) edit=1; shift ;; -*) echo "Unknown option: $1" >&2; return 1 ;; *) title="$1"; shift ;; esac @@ -234,6 +235,10 @@ cmd_create() { fi } > "$file" + if [[ $edit = 1 ]]; then + ${VISUAL:-${EDITOR:-vi}} "$file" + fi + echo "$id" }