From 2c544a69f48e730ac4516f615113226dc1a986bd Mon Sep 17 00:00:00 2001 From: levelio Date: Thu, 14 Nov 2024 13:20:25 +0800 Subject: [PATCH] feat(nr): add sorting configuration option to Fzf (#239) --- src/commands/nr.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/nr.ts b/src/commands/nr.ts index f5d955f..f7bdf4f 100644 --- a/src/commands/nr.ts +++ b/src/commands/nr.ts @@ -1,7 +1,7 @@ import process from 'node:process' import type { Choice } from '@posva/prompts' import prompts from '@posva/prompts' -import { Fzf } from 'fzf' +import { Fzf, byLengthAsc } from 'fzf' import { dump, load } from '../storage' import { parseNr } from '../parse' import { getPackageJSON } from '../fs' @@ -54,6 +54,7 @@ runCli(async (agent, args, ctx) => { const fzf = new Fzf(raw, { selector: item => `${item.key} ${item.description}`, casing: 'case-insensitive', + tiebreakers: [byLengthAsc], }) if (storage.lastRunCommand) {