From ce72583fa0a68fe6221c710ba7ce806dc2468609 Mon Sep 17 00:00:00 2001 From: Otto Ahoniemi Date: Thu, 12 Feb 2026 20:27:31 +0200 Subject: [PATCH] fix: avoid dot-prefixed ticket IDs in hidden directories --- features/ticket_creation.feature | 10 ++++++++++ ticket | 3 +++ 2 files changed, 13 insertions(+) diff --git a/features/ticket_creation.feature b/features/ticket_creation.feature index 7cc0776..a2fd168 100644 --- a/features/ticket_creation.feature +++ b/features/ticket_creation.feature @@ -96,3 +96,13 @@ Feature: Ticket Creation When I run "ticket create 'First ticket'" Then the command should succeed And the tickets directory should exist + + Scenario: Create ticket in dot-prefixed directory + Given I am in subdirectory ".nix" + When I run "ticket create 'Dot directory ticket'" + Then the command should succeed + And the output should match pattern "^[^.].*" + And a ticket file should exist with title "Dot directory ticket" + When I run "ticket list" + Then the command should succeed + And the output should contain "Dot directory ticket" diff --git a/ticket b/ticket index 1dedcec..48242de 100755 --- a/ticket +++ b/ticket @@ -82,6 +82,9 @@ generate_id() { local dir_name dir_name=$(basename "$(pwd)") + # Strip a leading dot from the repo name (for example, .nix) so generated ticket files are not hidden. + dir_name=$(echo "$dir_name" | sed 's/^\.*//') + # Extract first letter of each hyphenated/underscored segment local prefix prefix=$(echo "$dir_name" | sed 's/[-_]/ /g' | awk '{for(i=1;i<=NF;i++) printf substr($i,1,1)}')