@jpillora/take 0.12.0 → 0.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/take.mjs +4 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jpillora/take",
3
- "version": "0.12.0",
3
+ "version": "0.12.3",
4
4
  "description": "A minimal CLI library for building TypeScript-based command-line tools",
5
5
  "type": "module",
6
6
  "main": "./take.mjs",
package/take.mjs CHANGED
@@ -216,9 +216,11 @@ async function _writeInsertHelp(commands) {
216
216
  continue;
217
217
  const desc = cmd.description ? ` - ${cmd.description}` : "";
218
218
  lines.push(`- \`${cmd.name}\`${desc}`);
219
- // Add flags as sub-bullets
219
+ // Add flags as sub-bullets (sorted, matching the CLI --help output, so the
220
+ // generated markdown is deterministic regardless of flag insertion order)
220
221
  const shorts = new Set();
221
- for (const [name, flag] of Object.entries(cmd.flags)) {
222
+ for (const flag of namedFlags(cmd.flags)) {
223
+ const { name } = flag;
222
224
  const letter = name[0];
223
225
  const shortStr = shorts.has(letter) ? "" : ` \`-${letter}\``;
224
226
  shorts.add(letter);