Skip to content

Commit

Permalink
feat: add support for skipping issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed Aug 12, 2024
1 parent 2a67ba1 commit 10eed02
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
"typescript": "^5.5.4",
"vitest": "^2.0.5"
}
}
}
24 changes: 20 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import {
issueStatusSchema,
issueTypeSchema,
prioritySchema,
PriorityWithExit,
PriorityWithControls,
Size,
SizeWithExit,
SizeWithControls,
} from './schema/jira';

dotenv.config({
Expand Down Expand Up @@ -77,7 +77,7 @@ const cli = async () => {

let storyPoints: Size = issue.fields[jira.fields.storyPoints];
if (!storyPoints) {
const answer: SizeWithExit = await select({
const answer: SizeWithControls = await select({
message: 'Story Points',
choices: [
{
Expand Down Expand Up @@ -105,6 +105,10 @@ const cli = async () => {
value: 13,
},
new Separator('---'),
{
name: 'SKIP',
value: 0,
},
{
name: 'EXIT',
value: -1,
Expand All @@ -114,6 +118,10 @@ const cli = async () => {
loop: false,
});

if (answer === 0) {
continue;
}

if (answer === -1) {
process.exit(0);
}
Expand All @@ -127,7 +135,7 @@ const cli = async () => {
);
let priority = parsedPriority.success ? parsedPriority.data : undefined;
if (!priority) {
const answer: PriorityWithExit = await select({
const answer: PriorityWithControls = await select({
message: 'Priority',
choices: [
{
Expand All @@ -151,6 +159,10 @@ const cli = async () => {
value: 'Blocker',
},
new Separator(),
{
name: 'SKIP',
value: '0',
},
{
name: 'EXIT',
value: '-1',
Expand All @@ -160,6 +172,10 @@ const cli = async () => {
loop: false,
});

if (answer === '0') {
continue;
}

if (answer === '-1') {
process.exit(0);
}
Expand Down
4 changes: 2 additions & 2 deletions src/schema/jira.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const colorSizeSchema = sizeSchema.transform(val => {
});

export type Size = z.infer<typeof sizeSchema>;
export type SizeWithExit = Size | -1;
export type SizeWithControls = Size | 0 | -1;

export const prioritySchema = z.union([
z.literal('Blocker'), // red bold
Expand All @@ -56,7 +56,7 @@ export const colorPrioritySchema = prioritySchema.transform(val => {
});

export type Priority = z.infer<typeof prioritySchema>;
export type PriorityWithExit = Priority | '-1';
export type PriorityWithControls = Priority | '0' | '-1';

export const issueIdSchema = z.string().regex(/^RHEL-\d+$/);

Expand Down

0 comments on commit 10eed02

Please sign in to comment.