Skip to content

Commit 1f5e1bd

Browse files
Copilotvobu
andauthored
fix: --between flag incorrectly flagged as unrecognized for all search commands (#112)
* Initial plan * fix: add --between and --dateField to GLOBAL_FLAGS so they are recognized for all search commands Co-authored-by: vobu <6573426+vobu@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vobu <6573426+vobu@users.noreply.github.com>
1 parent 301b174 commit 1f5e1bd

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/commands/search.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type SearchResult = { items: Array<Record<string, unknown>>; total?: numb
1313
* Flags that are valid globally (not specific to any search resource).
1414
*/
1515
export const GLOBAL_FLAGS = new Set([
16-
'profile', 'sortBy', 'asc', 'desc', 'help', 'version',
16+
'profile', 'sortBy', 'asc', 'desc', 'help', 'version', 'between', 'dateField',
1717
]);
1818

1919
/**

tests/unit/search-feedback.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,30 @@ describe('GLOBAL_FLAGS', () => {
150150
assert.ok(GLOBAL_FLAGS.has('version'));
151151
});
152152

153+
test('contains between and dateField (date range filtering applies to all search commands)', () => {
154+
assert.ok(GLOBAL_FLAGS.has('between'));
155+
assert.ok(GLOBAL_FLAGS.has('dateField'));
156+
});
157+
153158
test('does not contain limit (limit is only valid for variable search)', () => {
154159
assert.ok(!GLOBAL_FLAGS.has('limit'));
155160
});
161+
162+
test('--between is not flagged as unknown for any search resource', () => {
163+
const resources = ['process-definition', 'process-instance', 'user-task', 'incident', 'jobs', 'variable'];
164+
for (const resource of resources) {
165+
const unknown = detectUnknownSearchFlags({ between: '2024-01-01..2024-12-31' }, resource);
166+
assert.deepStrictEqual(unknown, [], `--between incorrectly flagged as unknown for '${resource}'`);
167+
}
168+
});
169+
170+
test('--dateField is not flagged as unknown for any search resource', () => {
171+
const resources = ['process-definition', 'process-instance', 'user-task', 'incident', 'jobs', 'variable'];
172+
for (const resource of resources) {
173+
const unknown = detectUnknownSearchFlags({ dateField: 'startDate' }, resource);
174+
assert.deepStrictEqual(unknown, [], `--dateField incorrectly flagged as unknown for '${resource}'`);
175+
}
176+
});
156177
});
157178

158179
describe('SEARCH_RESOURCE_FLAGS', () => {

0 commit comments

Comments
 (0)