feat(*.liquid): apply prettier to liquid templates
- offer to create tag when none is found while adding a link from cli - fix tag display in search
This commit is contained in:
parent
49e21d574e
commit
efe701f939
112 changed files with 1319 additions and 1134 deletions
|
@ -1,13 +1,13 @@
|
|||
import inquirer from 'inquirer';
|
||||
import { loadConfig } from '../config.js';
|
||||
import { initDirectusClient, searchItems, updateItem } from '../directus/client.js';
|
||||
import inquirer from "inquirer";
|
||||
import { loadConfig } from "../config.js";
|
||||
import { initDirectusClient, searchItems, updateItem } from "../directus/client.js";
|
||||
|
||||
export const updateReadingProgress = async () => {
|
||||
const config = await loadConfig();
|
||||
|
||||
initDirectusClient(config);
|
||||
|
||||
const readingBooks = await searchItems('books', '', { read_status: 'started' });
|
||||
const readingBooks = await searchItems("books", "", { read_status: "started" });
|
||||
|
||||
if (!readingBooks.length) {
|
||||
console.log('📖 No books currently marked as "started".');
|
||||
|
@ -16,9 +16,9 @@ export const updateReadingProgress = async () => {
|
|||
}
|
||||
|
||||
const { bookId } = await inquirer.prompt({
|
||||
type: 'list',
|
||||
name: 'bookId',
|
||||
message: '📚 Select a book to update progress:',
|
||||
type: "list",
|
||||
name: "bookId",
|
||||
message: "📚 Select a book to update progress:",
|
||||
choices: readingBooks.map((book) => {
|
||||
const title = book.title || book.name || `Book #${book.id}`;
|
||||
const progress = book.progress ?? 0;
|
||||
|
@ -30,16 +30,16 @@ export const updateReadingProgress = async () => {
|
|||
})
|
||||
});
|
||||
const { progress } = await inquirer.prompt({
|
||||
name: 'progress',
|
||||
message: '📕 New progress percentage (0–100):',
|
||||
name: "progress",
|
||||
message: "📕 New progress percentage (0–100):",
|
||||
validate: (input) => {
|
||||
const num = Number(input);
|
||||
|
||||
return (!isNaN(num) && num >= 0 && num <= 100) || 'Enter a number from 0 to 100';
|
||||
return (!isNaN(num) && num >= 0 && num <= 100) || "Enter a number from 0 to 100";
|
||||
}
|
||||
});
|
||||
|
||||
await updateItem('books', bookId, { progress: Number(progress) });
|
||||
await updateItem("books", bookId, { progress: Number(progress) });
|
||||
|
||||
console.log(`✅ Updated book progress to ${progress}%`);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue