chore(addLinkToShare.js): add author url in search results when adding link
This commit is contained in:
parent
c54d27dc33
commit
f2bca309f5
4 changed files with 15 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
|||
import inquirer from 'inquirer';
|
||||
import { loadConfig } from '../config.js';
|
||||
import { initDirectusClient, searchItems, createItem } from '../directus/client.js';
|
||||
import { removeUrlProtocol } from '../sanitize.js';
|
||||
|
||||
export const addLinkToShare = async () => {
|
||||
const config = await loadConfig();
|
||||
|
@ -68,10 +69,15 @@ export const addLinkToShare = async () => {
|
|||
type: 'list',
|
||||
name: 'author',
|
||||
message: 'Select an author:',
|
||||
choices: authorMatches.map(a => ({
|
||||
name: a.name || a.id,
|
||||
value: a.id,
|
||||
}))
|
||||
choices: authorMatches.map(a => {
|
||||
const cleanUrl = removeUrlProtocol(a.url);
|
||||
const display = cleanUrl ? `${a.name} (${cleanUrl})` : a.name;
|
||||
|
||||
return {
|
||||
name: display,
|
||||
value: a.id,
|
||||
};
|
||||
})
|
||||
});
|
||||
|
||||
author = response.author;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue