|
1 | 1 | import { StatusSettings } from '../Config/StatusSettings';
|
2 | 2 | import { MarkdownTable } from '../lib/MarkdownTable';
|
3 | 3 | import { i18n } from '../i18n/i18n';
|
4 |
| -import type { StatusConfiguration } from './StatusConfiguration'; |
5 |
| -import { StatusType } from './StatusConfiguration'; |
| 4 | +import { type StatusConfiguration, StatusType } from './StatusConfiguration'; |
6 | 5 | import { Status } from './Status';
|
| 6 | +import { StatusRegistry } from './StatusRegistry'; |
7 | 7 |
|
8 | 8 | function getFirstIndex(statusConfigurations: StatusConfiguration[], wantedSymbol: string) {
|
9 | 9 | return statusConfigurations.findIndex((s) => s.symbol === wantedSymbol);
|
@@ -114,3 +114,25 @@ export function tabulateStatusSettings(statusSettings: StatusSettings) {
|
114 | 114 | });
|
115 | 115 | return table.markdown;
|
116 | 116 | }
|
| 117 | + |
| 118 | +/** |
| 119 | + * Generates a list of Markdown lines, containing sample tasks based on the given status settings. |
| 120 | + * |
| 121 | + * @param {StatusSettings} statusSettings - The settings object containing custom and core statuses. |
| 122 | + * |
| 123 | + * @returns {string[]} An array of markdown strings representing sample tasks. |
| 124 | + * Each task includes a symbol, an introductory text, and the name of the status. |
| 125 | + * Only the actually registered symbols are used; duplicate and empty symbols are ignored. |
| 126 | + */ |
| 127 | +export function sampleTaskLinesForValidStatuses(statusSettings: StatusSettings) { |
| 128 | + const statusRegistry = new StatusRegistry(); |
| 129 | + StatusSettings.applyToStatusRegistry(statusSettings, statusRegistry); |
| 130 | + const registeredStatuses: StatusConfiguration[] = statusRegistry.registeredStatuses; |
| 131 | + |
| 132 | + return registeredStatuses.map((status, index) => { |
| 133 | + const intro = `Sample task ${index + 1}`; |
| 134 | + const symbol = `status symbol=${getPrintableSymbol(status.symbol)}`; |
| 135 | + const name = `status name='${status.name}'`; |
| 136 | + return `- [${status.symbol}] ${intro}: ${symbol} ${name}`; |
| 137 | + }); |
| 138 | +} |
0 commit comments