diff --git a/README.md b/README.md index 2d7017e5..8794ba8d 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,8 @@ Usage: tk [args] Commands: create [title] [options] Create ticket, prints ID - -d, --description Description text + -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 ff27aae2..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,11 +175,16 @@ 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 done + if [[ $description = "-" ]]; then + description="$(< /dev/stdin)" + fi + # Validate and resolve parent if specified if [[ -n "$parent" ]]; then local parent_file @@ -230,6 +235,10 @@ cmd_create() { fi } > "$file" + if [[ $edit = 1 ]]; then + ${VISUAL:-${EDITOR:-vi}} "$file" + fi + echo "$id" } @@ -1300,7 +1309,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]