Skip to content

Commit 637ecb1

Browse files
committed
doveadm: Add STRING_SINGLEVAL arg type for single-value parameters
Add STRING_SINGLEVAL to doveadm_arg_types to flag parameters that can only be specified once. Applied to all user arguments.
1 parent cc89d96 commit 637ecb1

6 files changed

Lines changed: 31 additions & 22 deletions

File tree

.github/actions/spelling/expect.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,6 @@ MUAs
490490
MULTIAPPEND
491491
multiscript
492492
murchison
493-
mutltiple
494493
muttmua
495494
Muttrc
496495
mybox
@@ -711,6 +710,7 @@ showcerts
711710
showq
712711
sievec
713712
sievemailinglist
713+
singleval
714714
slashdot
715715
smartsieve
716716
smbfs
@@ -849,7 +849,6 @@ unpriv
849849
unsubscribable
850850
unsubscriptions
851851
uoff
852-
Uou
853852
uppercased
854853
uppercasing
855854
upperfirst

.vitepress/theme/custom.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
}
3838

3939
section.VPSidebarItem.level-0:not(.collapsible) {
40-
padding-bottom: 12px !important;
40+
padding-bottom: 12px !important;
4141
}
4242

4343
.VPNavBar.has-sidebar .content {

components/DoveadmCliComponent.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ const d = computed(() => props.data)
2626
<tbody>
2727
<template v-for="elem in d.args">
2828
<tr>
29-
<td><code>{{ elem.flag }}</code></td>
29+
<td>
30+
<code>{{ elem.flag }}</code>
31+
<span v-if="elem.singleval"><Badge type="warning">single value</Badge></span>
32+
</td>
3033
<td>{{ elem.type }}</td>
3134
<td v-html="elem.text" />
3235
<td><code v-if="elem.example !== undefined">{{ JSON.stringify(elem.example) }}</code></td>

components/DoveadmHttpApiComponent.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ const examples = computed(() => {
6969
<tbody>
7070
<template v-for="elem in d.args">
7171
<tr v-if="!elem.cli_only">
72-
<td><code>{{ elem.param }}</code></td>
72+
<td>
73+
<code>{{ elem.param }}</code>
74+
<span v-if="elem.singleval"><Badge type="warning">single value</Badge></span>
75+
</td>
7376
<td>{{ elem.type }}</td>
7477
<td v-html="elem.text" />
7578
<td><code v-if="elem.example">{{ JSON.stringify(elem.example) }}</code></td>

data/doveadm.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ Applicable to [[link,mdbox]] and [[link,sdbox]] mailbox formats only.
315315
user: {
316316
example: 'username',
317317
positional: true,
318-
type: doveadm_arg_types.STRING,
319-
text: `Login UID.`,
318+
type: doveadm_arg_types.STRING_SINGLEVAL,
319+
text: `The user to add.`,
320320
},
321321
password: {
322322
example: `password`,
@@ -354,8 +354,8 @@ Applicable to [[link,mdbox]] and [[link,sdbox]] mailbox formats only.
354354
user: {
355355
example: 'username',
356356
positional: true,
357-
type: doveadm_arg_types.ARRAY,
358-
text: `UID of user to query.`,
357+
type: doveadm_arg_types.STRING_SINGLEVAL,
358+
text: `Login UID.`,
359359
},
360360
},
361361
man: 'doveadm-auth',
@@ -391,8 +391,8 @@ Applicable to [[link,mdbox]] and [[link,sdbox]] mailbox formats only.
391391
user: {
392392
example: 'username',
393393
positional: true,
394-
type: doveadm_arg_types.STRING,
395-
text: `Login UID.`
394+
type: doveadm_arg_types.STRING_SINGLEVAL,
395+
text: `Login UID.`,
396396
},
397397
password: {
398398
example: `password`,
@@ -718,7 +718,7 @@ the source user name, e.g., \`user sourceuser\`.`
718718
user: {
719719
cli: 'u',
720720
example: 'username',
721-
type: doveadm_arg_types.STRING,
721+
type: doveadm_arg_types.STRING_SINGLEVAL,
722722
text: `uid of user to query.`,
723723
},
724724
'dict-uri': {
@@ -743,7 +743,7 @@ the source user name, e.g., \`user sourceuser\`.`
743743
user: {
744744
cli: 'u',
745745
example: 'username',
746-
type: doveadm_arg_types.STRING,
746+
type: doveadm_arg_types.STRING_SINGLEVAL,
747747
text: `uid of user to modify.`,
748748
},
749749
'dict-uri': {
@@ -774,8 +774,8 @@ the source user name, e.g., \`user sourceuser\`.`
774774
user: {
775775
cli: 'u',
776776
example: 'username',
777-
type: doveadm_arg_types.STRING,
778-
text: `uid of user to query.`,
777+
type: doveadm_arg_types.STRING_SINGLEVAL,
778+
text: `Username to use for schemes that require one.`,
779779
},
780780
exact: {
781781
cli: '1',
@@ -814,7 +814,7 @@ the source user name, e.g., \`user sourceuser\`.`
814814
user: {
815815
cli: 'u',
816816
example: 'username',
817-
type: doveadm_arg_types.STRING,
817+
type: doveadm_arg_types.STRING_SINGLEVAL,
818818
text: `uid of user to query.`,
819819
},
820820
'dict-uri': {
@@ -844,7 +844,7 @@ the source user name, e.g., \`user sourceuser\`.`
844844
args: {
845845
user: {
846846
example: 'username',
847-
type: doveadm_arg_types.STRING,
847+
type: doveadm_arg_types.STRING_SINGLEVAL,
848848
text: `uid of user to query.`,
849849
},
850850
'dict-uri': {
@@ -1485,8 +1485,8 @@ For each mailbox that has FTS data, it outputs the following key/value fields:
14851485
user: {
14861486
example: 'username',
14871487
positional: true,
1488-
type: doveadm_arg_types.STRING,
1489-
text: `The user to add.`,
1488+
type: doveadm_arg_types.STRING_SINGLEVAL,
1489+
text: `UID of user to query.`,
14901490
},
14911491
mailbox: {
14921492
example: 'INBOX',
@@ -2539,8 +2539,8 @@ returned.`,
25392539
user: {
25402540
cli: 'u',
25412541
example: 'username',
2542-
type: doveadm_arg_types.STRING,
2543-
text: `Username to use for schemes that require one.`,
2542+
type: doveadm_arg_types.STRING_SINGLEVAL,
2543+
text: `uid of user to query.`,
25442544
},
25452545
'reverse-verify': {
25462546
cli: 'V',

lib/doveadm.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const doveadm_arg_types = {
1212
STRING: 4,
1313
SEARCH_QUERY: 5, // Search query is an ARG_ARRAY
1414
ISTREAM: 6,
15+
STRING_SINGLEVAL: 7,
1516
}
1617

1718
/* List of Doveadm flag value types. */
@@ -91,7 +92,7 @@ const doveadm_userargs = {
9192
user: {
9293
cli: 'u',
9394
example: 'username',
94-
type: doveadm_arg_types.STRING,
95+
type: doveadm_arg_types.STRING_SINGLEVAL,
9596
text: `UID of user to apply operation to.`,
9697
},
9798
}
@@ -124,6 +125,8 @@ function typeToString(type) {
124125
return 'search_query'
125126
case doveadm_arg_types.ISTREAM:
126127
return 'istream'
128+
case doveadm_arg_types.STRING_SINGLEVAL:
129+
return 'string'
127130
}
128131
}
129132

@@ -199,6 +202,7 @@ async function normalizeDoveadm(doveadm) {
199202
example: v2.example,
200203
flag: v2.cli ? '-' + v2.cli : (v2.positional ? k2 : '--' + k2),
201204
param: argToHttpParam(k2),
205+
singleval: v2.type === doveadm_arg_types.STRING_SINGLEVAL,
202206
type: typeToString(v2.type),
203207
text: v2.text ? md.render(v2.text) : null
204208
})

0 commit comments

Comments
 (0)