Skip to content

Commit 2cb2088

Browse files
authored
fix(main): add maxItems option to scope prompt (#104)
Fixed glitch on small height screen for long scopes list. Base on @clack/prompts@0.7.0 via bombshell-dev/clack#174
1 parent 722b153 commit 2cb2088

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"license": "MIT",
2424
"dependencies": {
2525
"@clack/core": "^0.3.1",
26-
"@clack/prompts": "^0.6.2",
26+
"@clack/prompts": "^0.7.0",
2727
"configstore": "^5.0.1",
2828
"picocolors": "^1.0.0",
2929
"valibot": "^0.30.0"

readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ Better-commits (& better-branch) are highly flexible with sane defaults. These o
9191
"commit_type": {
9292
"enable": true,
9393
"initial_value": "feat",
94+
"max_items": Infinity,
9495
"infer_type_from_branch": true,
9596
"append_emoji_to_label": false,
9697
"append_emoji_to_commit": false,
@@ -168,6 +169,7 @@ Better-commits (& better-branch) are highly flexible with sane defaults. These o
168169
"enable": true,
169170
"custom_scope": false,
170171
"initial_value": "app",
172+
"max_items": Infinity
171173
"options": [
172174
{
173175
"value": "app",
@@ -281,6 +283,7 @@ Expand to see explanations and possible values
281283
| `check_status` | If true run interactive `git status` |
282284
| `commit_type.enable` | If true include commit type |
283285
| `commit_type.initial_value` | Initial selection of commit type |
286+
| `commit_type.max_items` | Maximum number of type displayed on the screen |
284287
| `commit_type.infer_type_from_branch` | If true infer type from branch name |
285288
| `commit_type.append_emoji_to_label` | If true append emoji to prompt |
286289
| `commit_type.append_emoji_to_commit` | If true append emoji to commit |
@@ -292,6 +295,7 @@ Expand to see explanations and possible values
292295
| `commit_scope.enable` | If true include commit scope |
293296
| `commit_scope.custom_scope` | If true allow custom scope at run-time |
294297
| `commit_scope.initial_value` | Default commit scope selected |
298+
| `commit_scope.max_items` | Maximum number of scope displayed on the screen |
295299
| `commit_scope.options.value` | Commit scope value |
296300
| `commit_scope.options.label` | Commit scope label |
297301
| `check_ticket.infer_ticket` | If true infer ticket from branch name |

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export async function main(config: Output<typeof Config>) {
9494
const commit_type = await p.select({
9595
message,
9696
initialValue: initial_value,
97+
maxItems: config.commit_type.max_items,
9798
options: config.commit_type.options,
9899
});
99100
if (p.isCancel(commit_type)) process.exit(0);
@@ -107,6 +108,7 @@ export async function main(config: Output<typeof Config>) {
107108
let commit_scope = await p.select({
108109
message: "Select a commit scope",
109110
initialValue: config.commit_scope.initial_value,
111+
maxItems: config.commit_scope.max_items,
110112
options: config.commit_scope.options,
111113
});
112114
if (p.isCancel(commit_scope)) process.exit(0);

src/valibot-state.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const Config = v.object({
1818
{
1919
enable: v.optional(v.boolean(), true),
2020
initial_value: v.optional(v.string(), "feat"),
21+
max_items: v.optional(v.number(), Infinity),
2122
infer_type_from_branch: v.optional(v.boolean(), true),
2223
append_emoji_to_label: v.optional(v.boolean(), false),
2324
append_emoji_to_commit: v.optional(v.boolean(), false),
@@ -65,6 +66,7 @@ export const Config = v.object({
6566
{
6667
enable: v.optional(v.boolean(), true),
6768
custom_scope: v.optional(v.boolean(), false),
69+
max_items: v.optional(v.number(), Infinity),
6870
initial_value: v.optional(v.string(), "app"),
6971
options: v.optional(
7072
v.array(

0 commit comments

Comments
 (0)